diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2023-05-11 16:58:43 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-05-12 00:51:40 +0200 |
commit | 9132d71a75edd11d94076047afa4553a730333c7 (patch) | |
tree | 06ee744c75faf07667c17e19d3c7c730949ec242 | |
parent | 6b5954a07d3d59f26a79bf6a0f0a892d6bc5fd9a (diff) | |
download | gnumach-9132d71a75edd11d94076047afa4553a730333c7.tar.gz gnumach-9132d71a75edd11d94076047afa4553a730333c7.tar.bz2 gnumach-9132d71a75edd11d94076047afa4553a730333c7.zip |
x86_64: Fix updating fsgs base on context switch
Commit 31dd30a94a682955c3c9e2f42252b4a07687067a "add setting gs/fsbase"
added the code to set fs and gs bases on context_switch. However, this
was only being done when switching context via the explicit
switch_context() method, but not in other cases where the context is
switched, such as with call_continuation().
Instead, put setting fsgs base into switch_ktss(), where it will be
called in all cases.
Message-Id: <20230511135844.837338-1-bugaevc@gmail.com>
-rw-r--r-- | i386/i386/pcb.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c index 8a9e3bf4..a5efb9a8 100644 --- a/i386/i386/pcb.c +++ b/i386/i386/pcb.c @@ -223,6 +223,11 @@ void switch_ktss(pcb_t pcb) pcb->ims.user_gdt, sizeof pcb->ims.user_gdt); #endif /* MACH_PV_DESCRIPTORS */ +#if defined(__x86_64__) && !defined(USER32) + wrmsr(MSR_REG_FSBASE, pcb->iss.fsbase); + wrmsr(MSR_REG_GSBASE, pcb->iss.gsbase); +#endif + db_load_context(pcb); /* @@ -373,10 +378,6 @@ thread_t switch_context( * Load the rest of the user state for the new thread */ switch_ktss(new->pcb); -#if defined(__x86_64__) && !defined(USER32) - wrmsr(MSR_REG_FSBASE, new->pcb->iss.fsbase); - wrmsr(MSR_REG_GSBASE, new->pcb->iss.gsbase); -#endif return Switch_context(old, continuation, new); } |