Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/sparc64 Add sunos_sigcode (32 bit only)
details: https://anonhg.NetBSD.org/src/rev/f73a211b2201
branches: trunk
changeset: 472430:f73a211b2201
user: christos <christos%NetBSD.org@localhost>
date: Thu Apr 29 16:40:41 1999 +0000
description:
Add sunos_sigcode (32 bit only)
diffstat:
sys/arch/sparc64/sparc64/locore.s | 133 +++++++++++++++++++++++++++++++++++++-
1 files changed, 131 insertions(+), 2 deletions(-)
diffs (168 lines):
diff -r 7b228347c8ba -r f73a211b2201 sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Thu Apr 29 16:40:38 1999 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Thu Apr 29 16:40:41 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.36 1999/03/26 04:29:22 eeh Exp $ */
+/* $NetBSD: locore.s,v 1.37 1999/04/29 16:40:41 christos Exp $ */
/*
* Copyright (c) 1996, 1997, 1998 Eduardo Horvath
* Copyright (c) 1996 Paul Kranenburg
@@ -65,6 +65,7 @@
#include "opt_ddb.h"
#include "opt_compat_svr4.h"
+#include "opt_compat_sunos.h"
#include "opt_compat_netbsd32.h"
#include "assym.h"
@@ -82,6 +83,9 @@
#include <machine/frame.h>
#include <machine/pte.h>
#include <machine/pmap.h>
+#ifdef COMPAT_SUNOS
+#include <compat/sunos/sunos_syscall.h>
+#endif
#ifdef COMPAT_SVR4
#include <compat/svr4/svr4_syscall.h>
#endif
@@ -5712,6 +5716,131 @@
#endif
#endif
+#ifdef COMPAT_SUNOS
+/*
+ * This code is still 32-bit only.
+ */
+/*
+ * The following code is copied to the top of the user stack when each
+ * process is exec'ed, and signals are `trampolined' off it.
+ *
+ * When this code is run, the stack looks like:
+ * [%sp] 64 bytes to which registers can be dumped
+ * [%sp + 64] signal number (goes in %o0)
+ * [%sp + 64 + 4] signal code (goes in %o1)
+ * [%sp + 64 + 8] placeholder
+ * [%sp + 64 + 12] argument for %o3, currently unsupported (always 0)
+ * [%sp + 64 + 16] first word of saved state (sigcontext)
+ * .
+ * .
+ * .
+ * [%sp + NNN] last word of saved state
+ * (followed by previous stack contents or top of signal stack).
+ * The address of the function to call is in %g1; the old %g1 and %o0
+ * have already been saved in the sigcontext. We are running in a clean
+ * window, all previous windows now being saved to the stack.
+ *
+ * Note that [%sp + 64 + 8] == %sp + 64 + 16. The copy at %sp+64+8
+ * will eventually be removed, with a hole left in its place, if things
+ * work out.
+ */
+ .globl _C_LABEL(sunos_sigcode)
+ .globl _C_LABEL(sunos_esigcode)
+_C_LABEL(sunos_sigcode):
+ /*
+ * XXX the `save' and `restore' below are unnecessary: should
+ * replace with simple arithmetic on %sp
+ *
+ * Make room on the stack for 32 %f registers + %fsr. This comes
+ * out to 33*4 or 132 bytes, but this must be aligned to a multiple
+ * of 8, or 136 bytes.
+ */
+ save %sp, -CCFSZ - 136, %sp
+ mov %g2, %l2 ! save globals in %l registers
+ mov %g3, %l3
+ mov %g4, %l4
+ mov %g5, %l5
+ mov %g6, %l6
+ mov %g7, %l7
+ /*
+ * Saving the fpu registers is expensive, so do it iff the fsr
+ * stored in the sigcontext shows that the fpu is enabled.
+ */
+ ld [%fp + 64 + 16 + SC_PSR_OFFSET], %l0
+ sethi %hi(PSR_EF), %l1 ! FPU enable bit is too high for andcc
+ andcc %l0, %l1, %l0 ! %l0 = fpu enable bit
+ be 1f ! if not set, skip the saves
+ rd %y, %l1 ! in any case, save %y
+
+ ! fpu is enabled, oh well
+ st %fsr, [%sp + CCFSZ + 0]
+ std %f0, [%sp + CCFSZ + 8]
+ std %f2, [%sp + CCFSZ + 16]
+ std %f4, [%sp + CCFSZ + 24]
+ std %f6, [%sp + CCFSZ + 32]
+ std %f8, [%sp + CCFSZ + 40]
+ std %f10, [%sp + CCFSZ + 48]
+ std %f12, [%sp + CCFSZ + 56]
+ std %f14, [%sp + CCFSZ + 64]
+ std %f16, [%sp + CCFSZ + 72]
+ std %f18, [%sp + CCFSZ + 80]
+ std %f20, [%sp + CCFSZ + 88]
+ std %f22, [%sp + CCFSZ + 96]
+ std %f24, [%sp + CCFSZ + 104]
+ std %f26, [%sp + CCFSZ + 112]
+ std %f28, [%sp + CCFSZ + 120]
+ std %f30, [%sp + CCFSZ + 128]
+
+1:
+ ldd [%fp + 64], %o0 ! sig, code
+ ld [%fp + 76], %o3 ! arg3
+ call %g1 ! (*sa->sa_handler)(sig,code,scp,arg3)
+ add %fp, 64 + 16, %o2 ! scp
+
+ /*
+ * Now that the handler has returned, re-establish all the state
+ * we just saved above, then do a sigreturn.
+ */
+ tst %l0 ! reload fpu registers?
+ be 1f ! if not, skip the loads
+ wr %l1, %g0, %y ! in any case, restore %y
+
+ ld [%sp + CCFSZ + 0], %fsr
+ ldd [%sp + CCFSZ + 8], %f0
+ ldd [%sp + CCFSZ + 16], %f2
+ ldd [%sp + CCFSZ + 24], %f4
+ ldd [%sp + CCFSZ + 32], %f6
+ ldd [%sp + CCFSZ + 40], %f8
+ ldd [%sp + CCFSZ + 48], %f10
+ ldd [%sp + CCFSZ + 56], %f12
+ ldd [%sp + CCFSZ + 64], %f14
+ ldd [%sp + CCFSZ + 72], %f16
+ ldd [%sp + CCFSZ + 80], %f18
+ ldd [%sp + CCFSZ + 88], %f20
+ ldd [%sp + CCFSZ + 96], %f22
+ ldd [%sp + CCFSZ + 104], %f24
+ ldd [%sp + CCFSZ + 112], %f26
+ ldd [%sp + CCFSZ + 120], %f28
+ ldd [%sp + CCFSZ + 128], %f30
+
+1:
+ mov %l2, %g2
+ mov %l3, %g3
+ mov %l4, %g4
+ mov %l5, %g5
+ mov %l6, %g6
+ mov %l7, %g7
+
+ ! get registers back & set syscall #
+ restore %g0, SUNOS_SYS_sigreturn, %g1
+ add %sp, 64 + 16, %o0 ! compute scp
+ t ST_SYSCALL ! sigreturn(scp)
+ ! sigreturn does not return unless it fails
+ mov SUNOS_SYS_exit, %g1 ! exit(errno)
+ t ST_SYSCALL
+_C_LABEL(sunos_esigcode):
+#endif /* COMPAT_SUNOS */
+
#ifdef COMPAT_SVR4
/*
* This code is still 32-bit only.
@@ -5835,7 +5964,7 @@
mov SYS_exit, %g1 ! exit(errno)
t ST_SYSCALL
_C_LABEL(svr4_esigcode):
-#endif
+#endif /* COMPAT_SVR4 */
/*
* Primitives
Home |
Main Index |
Thread Index |
Old Index