linux_sig_machdep.S revision 1.1 1 /* $NetBSD: linux_sig_machdep.S,v 1.1 1998/12/15 19:25:40 itohy Exp $ */
2
3 /*
4 * Written by ITOH Yasufumi.
5 * Public domain.
6 */
7
8 #include <m68k/asm.h>
9 #include <compat/linux/linux_syscall.h>
10
11 /*
12 * __dead void linux_reenter_syscall(struct frame *fp, int stkadj)
13 * __attribute__((__noreturn__));
14 *
15 * Move stack frame by stkadj bytes and re-enter syscall().
16 *
17 * XXX This is a kludge.
18 */
19
20 ENTRY_NOPROFILE(linux_reenter_syscall)
21 addql #4,sp | pop PC
22 movel sp@+,a0 | current frame addr
23 movel sp@,d1 | stkadj
24
25 | The m68k frame (struct trapframe) format:
26 | 16:l d0-d7/a0-a6/usp
27 | 1:w (pad)
28 | 1:w stkadj
29 | 1:w sr
30 | 1:l pc
31 | 1:w format/vector
32
33 moveal a0,a1
34 subal d1,a1 | new frame address
35 moveal a1,sp | set SP
36
37 | copy down frame (16*4 + 2 + 2 + 2 + 4 + 2 = 76 bytes = 19 longs)
38 moveq #19-1,d0
39 Lcpfr: movel a0@+,a1@+
40 dbra d0,Lcpfr
41
42 movew d1,sp@(16*4+2) | set stack adjust count
43 movel sp@,sp@- | push syscall no (original d0 value)
44 jbsr _C_LABEL(syscall) | re-enter syscall()
45 addql #4,sp | pop syscall no
46 #ifdef DEBUG
47 tstw sp@(16*4+2) | stack adjust must be zero
48 jeq Ladjzero
49 PANIC("linux_reenter_syscall")
50 Ladjzero:
51 #endif
52 moveal sp@(15*4),a0 | grab and restore
53 movel a0,usp | user SP
54 moveml sp@+,#0x7FFF | restore user registers
55 addql #8,sp | pop SP and stack adjust
56 jra _ASM_LABEL(rei) | rte
57
58 /*
59 * Signal "trampoline" code for Linux emulation.
60 * The sigtramp for Linux/m68k is on the stack frame, and this is a dummy.
61 */
62 .align 2
63 GLOBAL(linux_sigcode)
64 moveq #LINUX_SYS_exit,d0 | _exit(?)
65 trap #0
66 .align 2
67 GLOBAL(linux_esigcode)
68