From 31dd30a94a682955c3c9e2f42252b4a07687067a Mon Sep 17 00:00:00 2001 From: Luca Dariz Date: Wed, 19 Apr 2023 21:47:03 +0200 Subject: 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> --- kern/thread.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'kern/thread.c') 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()) -- cgit v1.2.3