From 8ec12ea9ce96e6395207d6d3334a7ed7d76749cf Mon Sep 17 00:00:00 2001 From: Daniel Eischen Date: Thu, 10 Jan 2002 02:36:30 +0000 Subject: [PATCH] Use a spare slot in the machine context to identify the context format and to inherently verify its validity. Alpha signal frames and trap frames are different; this field identifies which format the context is Set the machine context format (signal frame) before copying it out when sending a signal. Approved by: -arch --- sys/alpha/alpha/machdep.c | 1 + sys/alpha/include/ucontext.h | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 668042597aeb..d43b841f5e55 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -1329,6 +1329,7 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) frame->tf_regs[FRAME_TRAPARG_A1]; sf.sf_uc.uc_mcontext.mc_regs[R_TRAPARG_A2] = frame->tf_regs[FRAME_TRAPARG_A2]; + sf.sf_uc.uc_mcontext.mc_format = __UC_REV0_SIGFRAME; /* * Allocate and validate space for the signal handler diff --git a/sys/alpha/include/ucontext.h b/sys/alpha/include/ucontext.h index 50b1418c391e..3e8888143853 100644 --- a/sys/alpha/include/ucontext.h +++ b/sys/alpha/include/ucontext.h @@ -44,7 +44,10 @@ typedef struct __mcontext { unsigned long mc_fpcr; unsigned long mc_fp_control; long mc_ownedfp; - long __spare__[7]; +#define __UC_REV0_SIGFRAME 1 /* context is a signal frame */ +#define __UC_REV0_TRAPFRAME 2 /* context is a trap frame */ + long mc_format; + long __spare__[6]; } mcontext_t; #endif /* !_MACHINE_UCONTEXT_H_ */