Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch bye, bye _MCONTEXT_TO_SIGCONTEXT and vice versa.
details: https://anonhg.NetBSD.org/src/rev/7fff531d9880
branches: trunk
changeset: 555714:7fff531d9880
user: christos <christos%NetBSD.org@localhost>
date: Tue Nov 25 23:11:52 2003 +0000
description:
bye, bye _MCONTEXT_TO_SIGCONTEXT and vice versa.
diffstat:
sys/arch/alpha/include/signal.h | 40 +---------------
sys/arch/amd64/include/signal.h | 24 +---------
sys/arch/arm/include/signal.h | 25 +---------
sys/arch/m68k/include/signal.h | 102 +---------------------------------------
sys/arch/mips/include/signal.h | 47 +------------------
sys/arch/sh3/include/signal.h | 27 +----------
sys/arch/sparc/include/signal.h | 49 +------------------
7 files changed, 7 insertions(+), 307 deletions(-)
diffs (truncated from 417 to 300 lines):
diff -r 02e7480365b4 -r 7fff531d9880 sys/arch/alpha/include/signal.h
--- a/sys/arch/alpha/include/signal.h Tue Nov 25 22:45:33 2003 +0000
+++ b/sys/arch/alpha/include/signal.h Tue Nov 25 23:11:52 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: signal.h,v 1.9 2003/10/18 18:34:10 christos Exp $ */
+/* $NetBSD: signal.h,v 1.10 2003/11/25 23:11:52 christos Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -85,43 +85,5 @@
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_pc = (uc)->uc_mcontext.__gregs[_REG_PC]; \
- (sc)->sc_ps = (uc)->uc_mcontext.__gregs[_REG_PS]; \
- memcpy(&(sc)->sc_regs, &(uc)->uc_mcontext.__gregs, \
- 31 * sizeof(unsigned long)); \
- if ((uc)->uc_flags & _UC_FPU) { \
- (sc)->sc_ownedfp = 1; \
- memcpy(&(sc)->sc_fpregs, \
- &(uc)->uc_mcontext.__fpregs.__fp_fr, \
- 31 * sizeof(unsigned long)); \
- (sc)->sc_fpcr = (uc)->uc_mcontext.__fpregs.__fp_fpcr; \
- /* XXX sc_fp_control */ \
- } else \
- (sc)->sc_ownedfp = 0; \
-} while (/*CONSTCOND*/0)
-
-#define _SIGCONTEXT_TO_MCONTEXT(sc, uc) \
-do { \
- (uc)->uc_mcontext.__gregs[_REG_PC] = (sc)->sc_pc; \
- (uc)->uc_mcontext.__gregs[_REG_PS] = (sc)->sc_ps; \
- memcpy(&(uc)->uc_mcontext.__gregs, &(sc)->sc_regs, \
- 31 * sizeof(unsigned long)); \
- if ((sc)->sc_ownedfp) { \
- memcpy(&(uc)->uc_mcontext.__fpregs.__fp_fr, \
- &(sc)->sc_fpregs, 31 * sizeof(unsigned long)); \
- (sc)->sc_fpcr = (uc)->uc_mcontext.__fpregs.__fp_fpcr; \
- /* XXX sc_fp_control */ \
- (uc)->uc_flags |= _UC_FPU; \
- } \
-} while (/*CONSTCOND*/0)
-
#endif /* _NETBSD_SOURCE */
#endif /* !_ALPHA_SIGNAL_H_*/
diff -r 02e7480365b4 -r 7fff531d9880 sys/arch/amd64/include/signal.h
--- a/sys/arch/amd64/include/signal.h Tue Nov 25 22:45:33 2003 +0000
+++ b/sys/arch/amd64/include/signal.h Tue Nov 25 23:11:52 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: signal.h,v 1.4 2003/10/18 18:34:09 briggs Exp $ */
+/* $NetBSD: signal.h,v 1.5 2003/11/25 23:11:52 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
@@ -60,28 +60,6 @@
mcontext_t sc_mcontext;
};
-#define _MCONTEXT_TO_SIGCONTEXT(uc, sc) \
-do { \
- memcpy(&(sc)->sc_mcontext.__gregs, &(uc)->uc_mcontext.__gregs, \
- sizeof ((uc)->uc_mcontext.__gregs)); \
- if ((uc)->uc_flags & _UC_FPU) { \
- memcpy(&(sc)->sc_mcontext.__fpregs, \
- &(uc)->uc_mcontext.__fpregs, \
- sizeof ((uc)->uc_mcontext.__fpregs)); \
- } \
-} while (/*CONSTCOND*/0)
-
-#define _SIGCONTEXT_TO_MCONTEXT(sc, uc) \
-do { \
- memcpy(&(uc)->uc_mcontext.__gregs, &(sc)->sc_mcontext.__gregs, \
- sizeof ((uc)->uc_mcontext.__gregs)); \
- if ((uc)->uc_flags & _UC_FPU) { \
- memcpy(&(uc)->uc_mcontext.__fpregs, \
- &(sc)->sc_mcontext.__fpregs, \
- sizeof ((uc)->uc_mcontext.__fpregs)); \
- } \
-} while (/*CONSTCOND*/0)
-
#ifdef COMPAT_16
#define SIGTRAMP_VALID(vers) ((unsigned)(vers) <= 2)
#else
diff -r 02e7480365b4 -r 7fff531d9880 sys/arch/arm/include/signal.h
--- a/sys/arch/arm/include/signal.h Tue Nov 25 22:45:33 2003 +0000
+++ b/sys/arch/arm/include/signal.h Tue Nov 25 23:11:52 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: signal.h,v 1.5 2003/10/18 17:57:21 briggs Exp $ */
+/* $NetBSD: signal.h,v 1.6 2003/11/25 23:11:52 christos Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@@ -125,29 +125,6 @@
};
#endif
-/*
- * 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_spsr = (uc)->uc_mcontext.__gregs[_REG_CPSR]; \
- memcpy(&(sc)->sc_r0, (uc)->uc_mcontext.__gregs, \
- 15 * sizeof(unsigned int)); \
- (sc)->sc_svc_lr = 0; /* XXX */ \
- (sc)->sc_pc = (uc)->uc_mcontext.__gregs[_REG_PC]; \
-} while (/*CONSTCOND*/0)
-
-#define _SIGCONTEXT_TO_MCONTEXT(sc, uc) \
-do { \
- (uc)->uc_mcontext.__gregs[_REG_CPSR] = (sc)->sc_spsr; \
- memcpy((uc)->uc_mcontext.__gregs, &(sc)->sc_r0, \
- 15 * sizeof(unsigned int)); \
- (uc)->uc_mcontext.__gregs[_REG_PC] = (sc)->sc_pc; \
-} while (/*CONSTCOND*/0)
-
#endif /* !_LOCORE */
/* Signals codes */
diff -r 02e7480365b4 -r 7fff531d9880 sys/arch/m68k/include/signal.h
--- a/sys/arch/m68k/include/signal.h Tue Nov 25 22:45:33 2003 +0000
+++ b/sys/arch/m68k/include/signal.h Tue Nov 25 23:11:52 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: signal.h,v 1.15 2003/10/18 17:57:06 briggs Exp $ */
+/* $NetBSD: signal.h,v 1.16 2003/11/25 23:11:52 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
@@ -83,33 +83,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).
- *
- * On m68k, we also need the sigstate conversion macros below.
- */
-#define _MCONTEXT_TO_SIGCONTEXT(uc, sc) \
-do { \
- (sc)->sc_sp = (uc)->uc_mcontext.__gregs[_REG_A7]; \
- (sc)->sc_fp = (uc)->uc_mcontext.__gregs[_REG_A6]; \
- /* sc_ap points to sigstate */ \
- (sc)->sc_pc = (uc)->uc_mcontext.__gregs[_REG_PC]; \
- (sc)->sc_ps = (uc)->uc_mcontext.__gregs[_REG_PS]; \
-} while (/*CONSTCOND*/0)
-
-#define _SIGCONTEXT_TO_MCONTEXT(sc, uc) \
-do { \
- (uc)->uc_mcontext.__gregs[_REG_A7] = (sc)->sc_sp; \
- (uc)->uc_mcontext.__gregs[_REG_A6] = (sc)->sc_fp; \
- (uc)->uc_mcontext.__gregs[_REG_PC] = (sc)->sc_pc; \
- (uc)->uc_mcontext.__gregs[_REG_PS] = (sc)->sc_ps; \
-} while (/*CONSTCOND*/0)
-
-
-
#include <m68k/cpuframe.h>
/*
@@ -131,79 +104,6 @@
#define _SIGSTATE_EXFRAMESIZE(fmt) exframesize[(fmt)]
#endif
-#define _MCONTEXT_TO_SIGSTATE(uc, ss) \
-do { \
- (ss)->ss_flags = SS_USERREGS; \
- memcpy(&(ss)->ss_frame.f_regs, &(uc)->uc_mcontext.__gregs, \
- 16 * sizeof(unsigned int)); \
- (ss)->ss_frame.f_pc = (uc)->uc_mcontext.__gregs[_REG_PC]; \
- (ss)->ss_frame.f_sr = (uc)->uc_mcontext.__gregs[_REG_PS]; \
- (ss)->ss_frame.f_pad = 0; \
- (ss)->ss_frame.f_stackadj = 0; \
- (ss)->ss_frame.f_format = \
- (uc)->uc_mcontext.__mc_pad.__mc_frame.__mcf_format; \
- if ((ss)->ss_frame.f_format >= FMT4) { \
- (ss)->ss_flags |= SS_RTEFRAME; \
- (ss)->ss_frame.f_vector = \
- (uc)->uc_mcontext.__mc_pad.__mc_frame.__mcf_vector; \
- memcpy(&(ss)->ss_frame.F_u, \
- &(uc)->uc_mcontext.__mc_pad.__mc_frame.__mcf_exframe,\
- _SIGSTATE_EXFRAMESIZE((ss)->ss_frame.f_format)); \
- } \
- \
- (ss)->ss_fpstate.FPF_u1 = \
- (uc)->uc_mcontext.__mc_pad.__mc_frame.__mcf_fpf_u1; \
- if ((uc)->uc_flags & _UC_FPU) { /* non-null FP frame */ \
- (ss)->ss_fpstate.FPF_u2 = \
- (uc)->uc_mcontext.__mc_pad.__mc_frame.__mcf_fpf_u2; \
- memcpy(&(ss)->ss_fpstate.fpf_regs, \
- &(uc)->uc_mcontext.__fpregs.__fp_fpregs, \
- sizeof((ss)->ss_fpstate.fpf_regs)); \
- (ss)->ss_fpstate.fpf_fpcr = \
- (uc)->uc_mcontext.__fpregs.__fp_pcr; \
- (ss)->ss_fpstate.fpf_fpsr = \
- (uc)->uc_mcontext.__fpregs.__fp_psr; \
- (ss)->ss_fpstate.fpf_fpiar = \
- (uc)->uc_mcontext.__fpregs.__fp_piaddr; \
- (ss)->ss_flags |= SS_FPSTATE; \
- } \
-} while (/*CONSTCOND*/0)
-
-#define _SIGSTATE_TO_MCONTEXT(ss, uc) \
-do { \
- memcpy(&(uc)->uc_mcontext.__gregs, &(ss)->ss_frame.f_regs, \
- 16 * sizeof(unsigned int)); \
- (uc)->uc_mcontext.__gregs[_REG_PC] = (ss)->ss_frame.f_pc; \
- (uc)->uc_mcontext.__gregs[_REG_PS] = (ss)->ss_frame.f_sr; \
- (uc)->uc_mcontext.__mc_pad.__mc_frame.__mcf_format = \
- (ss)->ss_frame.f_format; \
- if ((ss)->ss_flags & SS_RTEFRAME) { \
- (uc)->uc_mcontext.__mc_pad.__mc_frame.__mcf_vector = \
- (ss)->ss_frame.f_vector; \
- memcpy(&(uc)->uc_mcontext.__mc_pad.__mc_frame.__mcf_exframe,\
- &(ss)->ss_frame.F_u, \
- _SIGSTATE_EXFRAMESIZE((ss)->ss_frame.f_format)); \
- } \
- \
- (uc)->uc_mcontext.__mc_pad.__mc_frame.__mcf_fpf_u1 = \
- (ss)->ss_fpstate.FPF_u1; \
- if ((ss)->ss_flags & SS_FPSTATE) { \
- (uc)->uc_mcontext.__mc_pad.__mc_frame.__mcf_fpf_u2 = \
- (ss)->ss_fpstate.FPF_u2; \
- memcpy(&(uc)->uc_mcontext.__fpregs.__fp_fpregs, \
- &(ss)->ss_fpstate.fpf_regs, \
- sizeof((ss)->ss_fpstate.fpf_regs)); \
- (uc)->uc_mcontext.__fpregs.__fp_pcr = \
- (ss)->ss_fpstate.fpf_fpcr; \
- (uc)->uc_mcontext.__fpregs.__fp_psr = \
- (ss)->ss_fpstate.fpf_fpsr; \
- (uc)->uc_mcontext.__fpregs.__fp_piaddr = \
- (ss)->ss_fpstate.fpf_fpiar; \
- (uc)->uc_flags |= _UC_FPU; \
- } else \
- (uc)->uc_flags &= ~_UC_FPU; \
-} while (/*CONSTCOND*/0)
-
#endif /* __M68K_SIGNAL_PRIVATE */
#endif /* _NETBSD_SOURCE */
diff -r 02e7480365b4 -r 7fff531d9880 sys/arch/mips/include/signal.h
--- a/sys/arch/mips/include/signal.h Tue Nov 25 22:45:33 2003 +0000
+++ b/sys/arch/mips/include/signal.h Tue Nov 25 23:11:52 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: signal.h,v 1.21 2003/10/29 23:40:42 christos Exp $ */
+/* $NetBSD: signal.h,v 1.22 2003/11/25 23:11:52 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -94,51 +94,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_pc = (uc)->uc_mcontext.__gregs[_REG_EPC]; \
- memcpy((sc)->sc_regs, (uc)->uc_mcontext.__gregs, \
- sizeof((sc)->sc_regs)); \
- (sc)->mullo = (uc)->uc_mcontext.__gregs[_REG_MDLO]; \
- (sc)->mulhi = (uc)->uc_mcontext.__gregs[_REG_MDHI]; \
- \
- if ((uc)->uc_flags & _UC_FPU) { \
- memcpy(&(sc)->sc_fpregs, \
- &(uc)->uc_mcontext.__fpregs.__fp_r.__fp_regs32, \
- sizeof((uc)->uc_mcontext.__fpregs.__fp_r.__fp_regs32)); \
- (sc)->sc_fpregs[32] = \
- (uc)->uc_mcontext.__fpregs.__fp_csr; \
- (sc)->sc_fpc_eir = 0; /* XXX */ \
- (sc)->sc_fpused = 1; \
- } else \
- (sc)->sc_fpused = 0; \
-} while (/*CONSTCOND*/0)
-
-#define _SIGCONTEXT_TO_MCONTEXT(sc, uc) \
-do { \
- (uc)->uc_mcontext.__gregs[_REG_EPC] = (sc)->sc_pc; \
- memcpy((uc)->uc_mcontext.__gregs, (sc)->sc_regs, \
- sizeof((sc)->sc_regs)); \
- (uc)->uc_mcontext.__gregs[_REG_MDLO] = (sc)->mullo; \
- (uc)->uc_mcontext.__gregs[_REG_MDHI] = (sc)->mulhi; \
- \
Home |
Main Index |
Thread Index |
Old Index