Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/include add SIGTRAMP_VALID and gc old sigconte...



details:   https://anonhg.NetBSD.org/src/rev/b38a08a791b5
branches:  trunk
changeset: 552549:b38a08a791b5
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Sep 27 03:14:31 2003 +0000

description:
add SIGTRAMP_VALID and gc old sigcontext <-> ucontext macros.

diffstat:

 sys/arch/i386/include/signal.h |  58 ++++-------------------------------------
 1 files changed, 6 insertions(+), 52 deletions(-)

diffs (79 lines):

diff -r 2e221c1e02c8 -r b38a08a791b5 sys/arch/i386/include/signal.h
--- a/sys/arch/i386/include/signal.h    Sat Sep 27 02:09:36 2003 +0000
+++ b/sys/arch/i386/include/signal.h    Sat Sep 27 03:14:31 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: signal.h,v 1.23 2003/09/12 01:13:35 christos Exp $     */
+/*     $NetBSD: signal.h,v 1.24 2003/09/27 03:14:31 christos Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
@@ -39,6 +39,11 @@
 typedef int sig_atomic_t;
 
 #define __HAVE_SIGINFO
+#ifdef COMPAT_16
+#define SIGTRAMP_VALID(vers)   ((unsigned)(vers) <= 2)
+#else
+#define SIGTRAMP_VALID(vers)   ((vers) == 2)
+#endif
 
 #if defined(_NETBSD_SOURCE)
 /*
@@ -113,57 +118,6 @@
        sigset_t sc_mask;               /* signal mask to restore (new style) */
 };
 
-/*
- * The following macros are used to convert from a ucontext to sigcontext,
- * and vice-versa.  This is for building a sigcontext to deliver to old-style
- * signal handlers, and converting back (in the event the handler modifies
- * the context).
- */
-#define        _MCONTEXT_TO_SIGCONTEXT(uc, sc)                                 \
-do {                                                                   \
-       (sc)->sc_gs  = (uc)->uc_mcontext.__gregs[_REG_GS];              \
-       (sc)->sc_fs  = (uc)->uc_mcontext.__gregs[_REG_FS];              \
-       (sc)->sc_es  = (uc)->uc_mcontext.__gregs[_REG_ES];              \
-       (sc)->sc_ds  = (uc)->uc_mcontext.__gregs[_REG_DS];              \
-       (sc)->sc_edi = (uc)->uc_mcontext.__gregs[_REG_EDI];             \
-       (sc)->sc_esi = (uc)->uc_mcontext.__gregs[_REG_ESI];             \
-       (sc)->sc_ebp = (uc)->uc_mcontext.__gregs[_REG_EBP];             \
-       (sc)->sc_ebx = (uc)->uc_mcontext.__gregs[_REG_EBX];             \
-       (sc)->sc_edx = (uc)->uc_mcontext.__gregs[_REG_EDX];             \
-       (sc)->sc_ecx = (uc)->uc_mcontext.__gregs[_REG_ECX];             \
-       (sc)->sc_eax = (uc)->uc_mcontext.__gregs[_REG_EAX];             \
-       (sc)->sc_eip = (uc)->uc_mcontext.__gregs[_REG_EIP];             \
-       (sc)->sc_cs  = (uc)->uc_mcontext.__gregs[_REG_CS];              \
-       (sc)->sc_eflags = (uc)->uc_mcontext.__gregs[_REG_EFL];          \
-       (sc)->sc_esp = (uc)->uc_mcontext.__gregs[_REG_UESP];            \
-       (sc)->sc_ss  = (uc)->uc_mcontext.__gregs[_REG_SS];              \
-       (sc)->sc_trapno = (uc)->uc_mcontext.__gregs[_REG_TRAPNO];       \
-       (sc)->sc_err = (uc)->uc_mcontext.__gregs[_REG_ERR];             \
-} while (/*CONSTCOND*/0)
-
-#define        _SIGCONTEXT_TO_MCONTEXT(sc, uc)                                 \
-do {                                                                   \
-       (uc)->uc_mcontext.__gregs[_REG_GS]  = (sc)->sc_gs;              \
-       (uc)->uc_mcontext.__gregs[_REG_FS]  = (sc)->sc_fs;              \
-       (uc)->uc_mcontext.__gregs[_REG_ES]  = (sc)->sc_es;              \
-       (uc)->uc_mcontext.__gregs[_REG_DS]  = (sc)->sc_ds;              \
-       (uc)->uc_mcontext.__gregs[_REG_EDI] = (sc)->sc_edi;             \
-       (uc)->uc_mcontext.__gregs[_REG_ESI] = (sc)->sc_esi;             \
-       (uc)->uc_mcontext.__gregs[_REG_EBP] = (sc)->sc_ebp;             \
-       (uc)->uc_mcontext.__gregs[_REG_EBX] = (sc)->sc_ebx;             \
-       (uc)->uc_mcontext.__gregs[_REG_EDX] = (sc)->sc_edx;             \
-       (uc)->uc_mcontext.__gregs[_REG_ECX] = (sc)->sc_ecx;             \
-       (uc)->uc_mcontext.__gregs[_REG_EAX] = (sc)->sc_eax;             \
-       (uc)->uc_mcontext.__gregs[_REG_EIP] = (sc)->sc_eip;             \
-       (uc)->uc_mcontext.__gregs[_REG_CS]  = (sc)->sc_cs;              \
-       (uc)->uc_mcontext.__gregs[_REG_EFL] = (sc)->sc_eflags;          \
-       (uc)->uc_mcontext.__gregs[_REG_UESP] = (sc)->sc_esp;            \
-       (uc)->uc_mcontext.__gregs[_REG_UESP] = (sc)->sc_esp;            \
-       (uc)->uc_mcontext.__gregs[_REG_SS]  = (sc)->sc_ss;              \
-       (uc)->uc_mcontext.__gregs[_REG_TRAPNO] = (sc)->sc_trapno;       \
-       (uc)->uc_mcontext.__gregs[_REG_ERR] = (sc)->sc_err;             \
-} while (/*CONSTCOND*/0)
-
 #define sc_sp sc_esp
 #define sc_fp sc_ebp
 #define sc_pc sc_eip



Home | Main Index | Thread Index | Old Index