Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Move linux_reenter_syscall() to a common location and re...
details: https://anonhg.NetBSD.org/src/rev/6aed69a9e5ce
branches: trunk
changeset: 472046:6aed69a9e5ce
user: kleink <kleink%NetBSD.org@localhost>
date: Mon Apr 19 20:58:37 1999 +0000
description:
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.
diffstat:
sys/arch/m68k/conf/files.m68k | 4 +-
sys/arch/m68k/include/frame.h | 10 ++++-
sys/arch/m68k/m68k/reenter_syscall.s | 56 ++++++++++++++++++++++++++
sys/compat/linux/arch/m68k/linux_machdep.c | 10 ++--
sys/compat/linux/arch/m68k/linux_machdep.h | 6 +--
sys/compat/linux/arch/m68k/linux_sig_machdep.S | 49 +----------------------
6 files changed, 75 insertions(+), 60 deletions(-)
diffs (220 lines):
diff -r 327b386ae5af -r 6aed69a9e5ce sys/arch/m68k/conf/files.m68k
--- a/sys/arch/m68k/conf/files.m68k Mon Apr 19 19:27:31 1999 +0000
+++ b/sys/arch/m68k/conf/files.m68k Mon Apr 19 20:58:37 1999 +0000
@@ -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/compat_13_machdep.c compat_13
+file arch/m68k/m68k/reenter_syscall.s compat_linux
+
include "../../../compat/m68k4k/files.m68k4k"
diff -r 327b386ae5af -r 6aed69a9e5ce sys/arch/m68k/include/frame.h
--- a/sys/arch/m68k/include/frame.h Mon Apr 19 19:27:31 1999 +0000
+++ b/sys/arch/m68k/include/frame.h Mon Apr 19 20:58:37 1999 +0000
@@ -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 @@
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_ */
diff -r 327b386ae5af -r 6aed69a9e5ce sys/arch/m68k/m68k/reenter_syscall.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/m68k/m68k/reenter_syscall.s Mon Apr 19 20:58:37 1999 +0000
@@ -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
+
diff -r 327b386ae5af -r 6aed69a9e5ce sys/compat/linux/arch/m68k/linux_machdep.c
--- a/sys/compat/linux/arch/m68k/linux_machdep.c Mon Apr 19 19:27:31 1999 +0000
+++ b/sys/compat/linux/arch/m68k/linux_machdep.c Mon Apr 19 20:58:37 1999 +0000
@@ -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 @@
* 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 @@
* 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);
diff -r 327b386ae5af -r 6aed69a9e5ce sys/compat/linux/arch/m68k/linux_machdep.h
--- a/sys/compat/linux/arch/m68k/linux_machdep.h Mon Apr 19 19:27:31 1999 +0000
+++ b/sys/compat/linux/arch/m68k/linux_machdep.h Mon Apr 19 20:58:37 1999 +0000
@@ -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 @@
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 */
diff -r 327b386ae5af -r 6aed69a9e5ce sys/compat/linux/arch/m68k/linux_sig_machdep.S
--- a/sys/compat/linux/arch/m68k/linux_sig_machdep.S Mon Apr 19 19:27:31 1999 +0000
+++ b/sys/compat/linux/arch/m68k/linux_sig_machdep.S Mon Apr 19 20:58:37 1999 +0000
@@ -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.
@@ -9,53 +9,6 @@
#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.
*/
Home |
Main Index |
Thread Index |
Old Index