mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-19 13:16:31 +00:00
bugfix: 在内核线程中,rflags未按照预期值进行设置的问题
This commit is contained in:
@ -27,7 +27,9 @@ ENTRY(kernel_thread_func)
|
|||||||
popq %rax
|
popq %rax
|
||||||
movq %rax, %es
|
movq %rax, %es
|
||||||
popq %rax
|
popq %rax
|
||||||
addq $0x38, %rsp
|
addq $0x20, %rsp
|
||||||
|
popfq
|
||||||
|
addq $0x10, %rsp
|
||||||
movq %rdx, %rdi
|
movq %rdx, %rdi
|
||||||
callq *%rbx
|
callq *%rbx
|
||||||
movq %rax, %rdi
|
movq %rax, %rdi
|
||||||
|
@ -422,6 +422,8 @@ ul initial_kernel_thread(ul arg)
|
|||||||
// 准备切换到用户态
|
// 准备切换到用户态
|
||||||
struct pt_regs *regs;
|
struct pt_regs *regs;
|
||||||
|
|
||||||
|
// 若在后面这段代码中触发中断,return时会导致段选择子错误,从而触发#GP,因此这里需要cli
|
||||||
|
cli();
|
||||||
current_pcb->thread->rip = (ul)ret_from_system_call;
|
current_pcb->thread->rip = (ul)ret_from_system_call;
|
||||||
current_pcb->thread->rsp = (ul)current_pcb + STACK_SIZE - sizeof(struct pt_regs);
|
current_pcb->thread->rsp = (ul)current_pcb + STACK_SIZE - sizeof(struct pt_regs);
|
||||||
current_pcb->thread->fs = USER_DS | 0x3;
|
current_pcb->thread->fs = USER_DS | 0x3;
|
||||||
|
Reference in New Issue
Block a user