summaryrefslogtreecommitdiff
path: root/kern/thread.c
diff options
context:
space:
mode:
authorLuca Dariz <luca@orpolo.org>2023-04-19 21:47:03 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-05-01 03:30:18 +0200
commit31dd30a94a682955c3c9e2f42252b4a07687067a (patch)
tree66be830d547a1e9cbd1b9b7bbc0378398be089d8 /kern/thread.c
parent660bc8ab3813737b3857648b7ec60d88494aeed1 (diff)
add setting gs/fsbase
* i386/i386/i386asm.sym: add offsets for asm * i386/i386/pcb.c: switch FSBASE/GSBASE on context switch and implement accessors in thread setstatus/getstatus * i386/i386/thread.h: add new state to thread saved state * kern/thread.c: add i386_FSGS_BASE_STATE handler * x86_64/locore.S: fix fs/gs handling, skipping the base address and avoid resetting it by manually re-loading fs/gs Message-Id: <20230419194703.410575-5-luca@orpolo.org>
Diffstat (limited to 'kern/thread.c')
-rw-r--r--kern/thread.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kern/thread.c b/kern/thread.c
index 20c11024..a324eed7 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1472,6 +1472,9 @@ kern_return_t thread_set_state(
if (flavor == i386_DEBUG_STATE && thread == current_thread())
/* This state can be set directly for the curren thread. */
return thread_setstatus(thread, flavor, new_state, new_state_count);
+ if (flavor == i386_FSGS_BASE_STATE && thread == current_thread())
+ /* This state can be set directly for the curren thread. */
+ return thread_setstatus(thread, flavor, new_state, new_state_count);
#endif
if (thread == THREAD_NULL || thread == current_thread())