aboutsummaryrefslogtreecommitdiff
path: root/i386/include
diff options
context:
space:
mode:
authorLuca Dariz <luca@orpolo.org>2024-09-04 22:18:04 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2024-09-08 01:03:35 +0200
commite10d0db83b66678a215572d84d23576f5df5a774 (patch)
tree5c1f04777c5a3dc12914cf50f7fb127d9f29c89c /i386/include
parent3a6147244fa0fcadec05e3426a35660682858df8 (diff)
downloadgnumach-e10d0db83b66678a215572d84d23576f5df5a774.tar.gz
gnumach-e10d0db83b66678a215572d84d23576f5df5a774.tar.bz2
gnumach-e10d0db83b66678a215572d84d23576f5df5a774.zip
add xfloat thread state interface
* i386/i386/fpu.c: extend current getter and setter to support the extended state; move the struct casting here to reuse the locking and allocation logic for the thread state; make sure the new state is set as valid, otherwise it won't be applied; add i386_get_xstate_size() to dynamically retrieve the FPU state size. * i386/i386/fpu.h: update prototypes to accept generic thread state * i386/i386/pcb.c: forward raw thread state to getter and setter, only checking for minimum size and use the new i386_get_xstate_size() helper. * i386/include/mach/i386/mach_i386.defs: expose the new helper i386_get_xstate_size(). * i386/include/mach/i386/thread_status.h: add interface definition for I386_XFLOAT_STATE and the corresponding data structure. Message-ID: <20240904201806.510082-1-luca@orpolo.org>
Diffstat (limited to 'i386/include')
-rw-r--r--i386/include/mach/i386/mach_i386.defs7
-rw-r--r--i386/include/mach/i386/thread_status.h12
2 files changed, 19 insertions, 0 deletions
diff --git a/i386/include/mach/i386/mach_i386.defs b/i386/include/mach/i386/mach_i386.defs
index 965d5c3b..78bbc2ed 100644
--- a/i386/include/mach/i386/mach_i386.defs
+++ b/i386/include/mach/i386/mach_i386.defs
@@ -111,3 +111,10 @@ routine i386_get_gdt(
target_thread : thread_t;
selector : int;
out desc : descriptor_t);
+
+/* Returns the size in bytes of the FPU extended state, to be used
+ with i386_XFLOAT_STATE instead of i386_XFLOAT_STATE_COUNT.
+ */
+routine i386_get_xstate_size(
+ host : host_t;
+ out size : vm_size_t);
diff --git a/i386/include/mach/i386/thread_status.h b/i386/include/mach/i386/thread_status.h
index 94596a74..2f472247 100644
--- a/i386/include/mach/i386/thread_status.h
+++ b/i386/include/mach/i386/thread_status.h
@@ -58,6 +58,7 @@
#define i386_REGS_SEGS_STATE 5
#define i386_DEBUG_STATE 6
#define i386_FSGS_BASE_STATE 7
+#define i386_XFLOAT_STATE 8
/*
* This structure is used for both
@@ -148,6 +149,17 @@ struct i386_float_state {
};
#define i386_FLOAT_STATE_COUNT (sizeof(struct i386_float_state)/sizeof(unsigned int))
+struct i386_xfloat_state {
+ int fpkind; /* FP_NO..FP_387X (readonly) */
+ int initialized;
+ int exc_status; /* exception status (readonly) */
+ int fp_save_kind; /* format of hardware state */
+ unsigned char hw_state[]; /* actual "hardware" state */
+ /* don't add anything here, as hw_state is dynamically sized */
+};
+/* NOTE: i386_XFLOAT_STATE_COUNT is not defined as i386_xfloat_state is
+ * dynamically sized. Use i386_get_xstate_size(host) to get the current
+ * size. */
#define PORT_MAP_BITS 0x400
struct i386_isa_port_map_state {