Use a spare slot in the machine context for a flags word to indicate

whether the machine context is valid and whether the FPU state is
valid (saved).

Mark the machine context valid before copying it out when sending a
signal.

Approved by:	-arch
This commit is contained in:
Daniel Eischen 2002-01-10 02:32:30 +00:00
parent a7f6ff2e8c
commit 2e615b482d
4 changed files with 10 additions and 2 deletions

View file

@ -463,6 +463,7 @@ sendsig(catcher, sig, mask, code)
? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
sf.sf_uc.uc_mcontext.mc_gs = rgs();
sf.sf_uc.uc_mcontext.mc_flags = __UC_MC_VALID; /* no FP regs */
bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs));
/* Allocate and validate space for the signal handler context. */

View file

@ -59,7 +59,10 @@ typedef struct __mcontext {
int mc_ss;
int mc_fpregs[28]; /* env87 + fpacc87 + u_long */
int __spare__[17];
#define __UC_MC_VALID 0x0001 /* mcontext register state is valid */
#define __UC_FP_VALID 0x0002 /* FP registers have been saved */
int mc_flags;
int __spare__[16];
} mcontext_t;
#endif /* !_MACHINE_UCONTEXT_H_ */

View file

@ -463,6 +463,7 @@ sendsig(catcher, sig, mask, code)
? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
sf.sf_uc.uc_mcontext.mc_gs = rgs();
sf.sf_uc.uc_mcontext.mc_flags = __UC_MC_VALID; /* no FP regs */
bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs));
/* Allocate and validate space for the signal handler context. */

View file

@ -59,7 +59,10 @@ typedef struct __mcontext {
int mc_ss;
int mc_fpregs[28]; /* env87 + fpacc87 + u_long */
int __spare__[17];
#define __UC_MC_VALID 0x0001 /* mcontext register state is valid */
#define __UC_FP_VALID 0x0002 /* FP registers have been saved */
int mc_flags;
int __spare__[16];
} mcontext_t;
#endif /* !_MACHINE_UCONTEXT_H_ */