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