diff options
author | Ian Moffett <ian@osmora.org> | 2025-06-25 15:59:39 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-06-25 15:59:39 -0400 |
commit | 074ef7ccfadb6ae36a88fe300b44f16057f970d4 (patch) | |
tree | c6819858a3a6092af34725dfe9d78c04f25879bd /sys | |
parent | 7588a3130c10ef60075b30eb7e8b1433ee9c67df (diff) |
kernel/amd64: Only use USER_DS in md_td_kick()
The function md_td_kick() is only used for user threads and there is no
need reference any kernel segments. Furthermore, the previous code would
introduce a bug where rpl would always be 0.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/proc_machdep.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/sys/arch/amd64/amd64/proc_machdep.c b/sys/arch/amd64/amd64/proc_machdep.c index aa8847a..63604a4 100644 --- a/sys/arch/amd64/amd64/proc_machdep.c +++ b/sys/arch/amd64/amd64/proc_machdep.c @@ -124,18 +124,12 @@ md_td_kick(struct proc *td) { struct trapframe *tfp; struct cpu_info *ci; - uint8_t rpl; - uint16_t ds = KERNEL_DS; + uint16_t ds = USER_DS | 3; tfp = &td->tf; - rpl = tfp->cs & 3; ci = this_cpu(); ci->curtd = td; - - if (rpl == 3) { - td->flags &= ~PROC_KTD; - ds = USER_DS | 3; - } + td->flags &= ~PROC_KTD; __ASMV( "mov %0, %%rax\n" |