From 074ef7ccfadb6ae36a88fe300b44f16057f970d4 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 25 Jun 2025 15:59:39 -0400 Subject: 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 --- sys/arch/amd64/amd64/proc_machdep.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'sys') 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" -- cgit v1.2.3