Move linux_reenter_syscall() to a common location and rename it to
reenter_syscall() - it's going to be shared with COMPAT_SVR4 and soon be used by native code.
This commit is contained in:
parent
4b0326d939
commit
6a9c669828
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.m68k,v 1.23 1998/10/01 01:03:56 thorpej Exp $
|
||||
# $NetBSD: files.m68k,v 1.24 1999/04/19 20:58:37 kleink Exp $
|
||||
#
|
||||
file arch/m68k/m68k/bcopy.s
|
||||
file arch/m68k/m68k/copy.s
|
||||
@ -18,4 +18,6 @@ file arch/m68k/m68k/sig_machdep.c
|
||||
|
||||
file arch/m68k/m68k/compat_13_machdep.c compat_13
|
||||
|
||||
file arch/m68k/m68k/reenter_syscall.s compat_linux
|
||||
|
||||
include "../../../compat/m68k4k/files.m68k4k"
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: frame.h,v 1.15 1997/05/03 12:49:05 mycroft Exp $ */
|
||||
/* $NetBSD: frame.h,v 1.16 1999/04/19 20:58:37 kleink Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -309,4 +309,12 @@ struct fpframe060 {
|
||||
u_long fpf6_upper, fpf6_lower;
|
||||
};
|
||||
|
||||
#if defined(_KERNEL)
|
||||
/*
|
||||
* Utility function to relocate the initial frame, make room to restore an
|
||||
* exception frame and reenter the syscall.
|
||||
*/
|
||||
void reenter_syscall __P((struct frame *, int)) __attribute__((__noreturn__));
|
||||
#endif
|
||||
|
||||
#endif /* _M68K_FRAME_H_ */
|
||||
|
56
sys/arch/m68k/m68k/reenter_syscall.s
Normal file
56
sys/arch/m68k/m68k/reenter_syscall.s
Normal file
@ -0,0 +1,56 @@
|
||||
/* $NetBSD: reenter_syscall.s,v 1.1 1999/04/19 20:58:37 kleink Exp $ */
|
||||
|
||||
/*
|
||||
* Written by ITOH Yasufumi.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <m68k/asm.h>
|
||||
|
||||
/*
|
||||
* void reenter_syscall(struct frame *fp, int stkadj)
|
||||
* __attribute__((__noreturn__));
|
||||
*
|
||||
* Move stack frame by stkadj bytes and re-enter syscall().
|
||||
*
|
||||
* XXX This is a kludge.
|
||||
*/
|
||||
|
||||
ENTRY_NOPROFILE(reenter_syscall)
|
||||
addql #4,sp | pop PC
|
||||
movel sp@+,a0 | current frame addr
|
||||
movel sp@,d1 | stkadj
|
||||
|
||||
| The m68k frame (struct trapframe) format:
|
||||
| 16:l d0-d7/a0-a6/usp
|
||||
| 1:w (pad)
|
||||
| 1:w stkadj
|
||||
| 1:w sr
|
||||
| 1:l pc
|
||||
| 1:w format/vector
|
||||
|
||||
moveal a0,a1
|
||||
subal d1,a1 | new frame address
|
||||
moveal a1,sp | set SP
|
||||
|
||||
| copy down frame (16*4 + 2 + 2 + 2 + 4 + 2 = 76 bytes = 19 longs)
|
||||
moveq #19-1,d0
|
||||
Lcpfr: movel a0@+,a1@+
|
||||
dbra d0,Lcpfr
|
||||
|
||||
movew d1,sp@(16*4+2) | set stack adjust count
|
||||
movel sp@,sp@- | push syscall no (original d0 value)
|
||||
jbsr _C_LABEL(syscall) | re-enter syscall()
|
||||
addql #4,sp | pop syscall no
|
||||
#ifdef DEBUG
|
||||
tstw sp@(16*4+2) | stack adjust must be zero
|
||||
jeq Ladjzero
|
||||
PANIC("reenter_syscall")
|
||||
Ladjzero:
|
||||
#endif
|
||||
moveal sp@(15*4),a0 | grab and restore
|
||||
movel a0,usp | user SP
|
||||
moveml sp@+,#0x7FFF | restore user registers
|
||||
addql #8,sp | pop SP and stack adjust
|
||||
jra _ASM_LABEL(rei) | rte
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_machdep.c,v 1.3 1999/03/02 18:22:29 itohy Exp $ */
|
||||
/* $NetBSD: linux_machdep.c,v 1.4 1999/04/19 20:58:38 kleink Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -551,12 +551,12 @@ bad: sigexit(p, SIGSEGV);
|
||||
* Extra stack space is required but not allocated.
|
||||
* Allocate and re-enter syscall().
|
||||
*/
|
||||
linux_reenter_syscall(frame, sz);
|
||||
reenter_syscall(frame, sz);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
/* linux_reenter_syscall() doesn't adjust stack. */
|
||||
/* reenter_syscall() doesn't adjust stack. */
|
||||
if (sz != frame->f_stackadj)
|
||||
panic("linux_sys_sigreturn: adj: %d != %d",
|
||||
sz, frame->f_stackadj);
|
||||
@ -700,12 +700,12 @@ bad: sigexit(p, SIGSEGV);
|
||||
* Extra stack space is required but not allocated.
|
||||
* Allocate and re-enter syscall().
|
||||
*/
|
||||
linux_reenter_syscall(frame, sz);
|
||||
reenter_syscall(frame, sz);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
/* linux_reenter_syscall() doesn't adjust stack. */
|
||||
/* reenter_syscall() doesn't adjust stack. */
|
||||
if (sz != frame->f_stackadj)
|
||||
panic("linux_sys_rt_sigreturn: adj: %d != %d",
|
||||
sz, frame->f_stackadj);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_machdep.h,v 1.1 1998/12/15 19:25:40 itohy Exp $ */
|
||||
/* $NetBSD: linux_machdep.h,v 1.2 1999/04/19 20:58:38 kleink Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -165,10 +165,6 @@ struct linux_rt_sigframe {
|
||||
void linux_sendsig __P((sig_t, int, sigset_t *, u_long));
|
||||
dev_t linux_fakedev __P((dev_t));
|
||||
|
||||
/* linux_sig_machdep.S */
|
||||
__dead void linux_reenter_syscall __P((struct frame *fp, int stkadj))
|
||||
__attribute__((__noreturn__));
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _M68K_LINUX_MACHDEP_H */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_sig_machdep.S,v 1.1 1998/12/15 19:25:40 itohy Exp $ */
|
||||
/* $NetBSD: linux_sig_machdep.S,v 1.2 1999/04/19 20:58:38 kleink Exp $ */
|
||||
|
||||
/*
|
||||
* Written by ITOH Yasufumi.
|
||||
@ -8,53 +8,6 @@
|
||||
#include <m68k/asm.h>
|
||||
#include <compat/linux/linux_syscall.h>
|
||||
|
||||
/*
|
||||
* __dead void linux_reenter_syscall(struct frame *fp, int stkadj)
|
||||
* __attribute__((__noreturn__));
|
||||
*
|
||||
* Move stack frame by stkadj bytes and re-enter syscall().
|
||||
*
|
||||
* XXX This is a kludge.
|
||||
*/
|
||||
|
||||
ENTRY_NOPROFILE(linux_reenter_syscall)
|
||||
addql #4,sp | pop PC
|
||||
movel sp@+,a0 | current frame addr
|
||||
movel sp@,d1 | stkadj
|
||||
|
||||
| The m68k frame (struct trapframe) format:
|
||||
| 16:l d0-d7/a0-a6/usp
|
||||
| 1:w (pad)
|
||||
| 1:w stkadj
|
||||
| 1:w sr
|
||||
| 1:l pc
|
||||
| 1:w format/vector
|
||||
|
||||
moveal a0,a1
|
||||
subal d1,a1 | new frame address
|
||||
moveal a1,sp | set SP
|
||||
|
||||
| copy down frame (16*4 + 2 + 2 + 2 + 4 + 2 = 76 bytes = 19 longs)
|
||||
moveq #19-1,d0
|
||||
Lcpfr: movel a0@+,a1@+
|
||||
dbra d0,Lcpfr
|
||||
|
||||
movew d1,sp@(16*4+2) | set stack adjust count
|
||||
movel sp@,sp@- | push syscall no (original d0 value)
|
||||
jbsr _C_LABEL(syscall) | re-enter syscall()
|
||||
addql #4,sp | pop syscall no
|
||||
#ifdef DEBUG
|
||||
tstw sp@(16*4+2) | stack adjust must be zero
|
||||
jeq Ladjzero
|
||||
PANIC("linux_reenter_syscall")
|
||||
Ladjzero:
|
||||
#endif
|
||||
moveal sp@(15*4),a0 | grab and restore
|
||||
movel a0,usp | user SP
|
||||
moveml sp@+,#0x7FFF | restore user registers
|
||||
addql #8,sp | pop SP and stack adjust
|
||||
jra _ASM_LABEL(rei) | rte
|
||||
|
||||
/*
|
||||
* Signal "trampoline" code for Linux emulation.
|
||||
* The sigtramp for Linux/m68k is on the stack frame, and this is a dummy.
|
||||
|
Loading…
x
Reference in New Issue
Block a user