Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/include Add compatibility for some userspace co...



details:   https://anonhg.NetBSD.org/src/rev/6c8bfa71a132
branches:  trunk
changeset: 326645:6c8bfa71a132
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Feb 09 14:44:42 2014 +0000

description:
Add compatibility for some userspace code (eg firefox) that seems to look
  inside the ucontext structure passed to signal handlers to modify the
  xmm registers.
This should make the code compile - I'm not at all sure it works as expected,
  the interactions between FP and signal handlers aren't at all clear.
AFAICT the FP state is saved on the user stack when the handler is called,
  however the FP trap code can already done odd things to the FPU....

diffstat:

 sys/arch/x86/include/cpu_extended_state.h |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r a503a5ccb19e -r 6c8bfa71a132 sys/arch/x86/include/cpu_extended_state.h
--- a/sys/arch/x86/include/cpu_extended_state.h Sun Feb 09 14:02:39 2014 +0000
+++ b/sys/arch/x86/include/cpu_extended_state.h Sun Feb 09 14:44:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu_extended_state.h,v 1.3 2014/02/08 22:36:50 dsl Exp $       */
+/*     $NetBSD: cpu_extended_state.h,v 1.4 2014/02/09 14:44:42 dsl Exp $       */
 
 #ifndef _X86_CPU_EXTENDED_STATE_H_
 #define _X86_CPU_EXTENDED_STATE_H_
@@ -110,12 +110,17 @@
        uint32_t        fx_mxcsr;       /* MXCSR Register State */
        uint32_t        fx_mxcsr_mask;
        struct fpaccfx  fx_87_ac[8];    /* 8 x87 registers */
-       struct xmmreg   fx_xmmregs[16]; /* XMM regs (8 in 32bit modes) */
+       struct xmmreg   fx_xmm[16];     /* XMM regs (8 in 32bit modes) */
        uint8_t         fx_rsvd[48];
        uint8_t         fx_kernel[48];  /* Not written by the hardware */
 } __aligned(16);
 __CTASSERT_NOLINT(sizeof (struct fxsave) == 512);
 
+#ifndef _KERNEL
+/* Backwards compatibility for firefox (looks at fx_xmm) */
+#define fxsave64 fxsave
+#endif
+
 /* The end of the fsave buffer can be used by the operating system */
 struct fxsave_os {
        uint8_t fxo_fxsave[512 - 48];



Home | Main Index | Thread Index | Old Index