Print this page
15254 %ymm registers not restored after signal handler
15367 x86 getfpregs() summons corrupting %xmm ghosts
15333 want x86 /proc xregs support (libc_db, libproc, mdb, etc.)
15336 want libc functions for extended ucontext_t
15334 want ps_lwphandle-specific reg routines
15328 FPU_CW_INIT mistreats reserved bit
15335 i86pc fpu_subr.c isn't really platform-specific
15332 setcontext(2) isn't actually noreturn
15331 need <sys/stdalign.h>
Change-Id: I7060aa86042dfb989f77fc3323c065ea2eafa9ad
Conflicts:
usr/src/uts/common/fs/proc/prcontrol.c
usr/src/uts/intel/os/archdep.c
usr/src/uts/intel/sys/ucontext.h
usr/src/uts/intel/syscall/getcontext.c
@@ -29,10 +29,14 @@
* Copyright (c) 1988 AT&T
* All Rights Reserved
*/
/*
+ * Copyright 2023 Oxide Computer Company
+ */
+
+/*
* Establish the default settings for the floating-point state for a C language
* program:
* rounding mode -- round to nearest default by OS,
* exceptions enabled -- all masked
* sticky bits -- all clear by default by OS.
@@ -46,34 +50,37 @@
#include "lint.h"
#include <sys/types.h>
#include <sys/sysi86.h> /* for SI86FPHW/SI86FPSTART definitions */
#include <sys/fp.h> /* for FPU_CW_INIT and SSE_MXCSR_INIT */
+#include <upanic.h>
extern int __fltrounds();
int _fp_hw; /* default: bss: 0 == no hardware */
int _sse_hw; /* default: bss: 0 == no sse */
int __flt_rounds; /* ANSI rounding mode */
+#define UPANIC_MSG "32-bit FPU init failed!"
+
void
__fpstart()
{
/*
* query OS for HW status and ensure the x87 and (optional)
* SSE control words are (will be) set correctly.
*/
if ((_sse_hw = sysi86(SI86FPSTART,
&_fp_hw, FPU_CW_INIT, SSE_MXCSR_INIT)) == -1) {
- extern void _putcw();
-
/*
- * (fallback to old syscall on old kernels)
+ * Because the system only supports a 64-bit kernel, the above
+ * should always work (we assume it does in 64-bit libc). If it
+ * should fail, we upanic. Note, because the FPU state is
+ * unknown, we use a static message below and don't rely upon
+ * strlen(), but rather constant time lengths.
*/
- _sse_hw = 0;
- (void) sysi86(SI86FPHW, &_fp_hw);
- _putcw(0x133f);
+ upanic(UPANIC_MSG, sizeof (UPANIC_MSG));
}
/*
* At this point the x87 fp environment that has been (or more
* hopefully, will be) established by the kernel is: