Skip to content

Commit f223c27

Browse files
committed
Tidy Code & Bug Fix
1 parent 4e8239a commit f223c27

2 files changed

Lines changed: 9 additions & 30 deletions

File tree

arch/x86/entry/entry_64.S

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -120,25 +120,10 @@ SYM_INNER_LABEL(entry_SYSCALL_64_after_hwframe, SYM_L_GLOBAL)
120120
call do_syscall_64 /* returns with IRQs disabled */
121121

122122
// 終わりしよ!
123-
POP_REGS pop_rdi=0
124-
125-
// make a debug signal to QEMU
126-
// push %dx
127-
// push %ax
128-
// push %bx
129-
// mov $0x2333, %dx // destination port
130-
// mov $0xE399, %ax // dump stack command
131-
// mov $(6+56), %bx // dump length
132-
// out %ax, %dx
133-
// pop %bx
134-
// pop %ax
135-
// pop %dx
136-
137-
// The stack is now: user_RDI, orig_ax, RIP, CS, EFLAGS, RSP, SS.
138-
SWITCH_TO_USER_CR3_STACK scratch_reg=%rdi
139-
popq %rdi
123+
POP_REGS
124+
// The stack is now: RAX, RIP, CS, EFLAGS, RSP, SS
140125
add $8, %rsp // skip RAX
141-
// ready to go!
126+
// Go!
142127
SYM_INNER_LABEL(entry_SYSRETQ_unsafe_stack, SYM_L_GLOBAL)
143128
ANNOTATE_NOENDBR
144129
swapgs
@@ -665,18 +650,12 @@ SYM_INNER_LABEL(swapgs_restore_regs_and_return_to_usermode, SYM_L_GLOBAL)
665650
ALTERNATIVE "", "jmp xenpv_restore_regs_and_return_to_usermode", X86_FEATURE_XENPV
666651
#endif
667652

668-
POP_REGS pop_rdi=0
669-
670-
/*
671-
* The stack is now user RDI, orig_ax, RIP, CS, EFLAGS, RSP, SS.
672-
* Save old stack pointer and switch to trampoline stack.
673-
*/
674-
675-
SWITCH_TO_USER_CR3_STACK scratch_reg=%rdi
676-
popq %rdi
653+
POP_REGS
654+
// The stack is now: RAX, RIP, CS, EFLAGS, RSP, SS
677655
add $8, %rsp // skip RAX
656+
// Go!
678657
swapgs
679-
jmp .Lnative_iret
658+
iretq
680659

681660
SYM_INNER_LABEL(restore_regs_and_return_to_kernel, SYM_L_GLOBAL)
682661
POP_REGS

arch/x86/kernel/idt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ static const __initconst struct idt_data def_idts[] = {
8282
#else
8383
ISTG(X86_TRAP_DF, asm_exc_double_fault, IST_INDEX_DF),
8484
#endif
85-
ISTG(X86_TRAP_DB, asm_exc_debug, IST_INDEX_DB),
86-
ISTG(X86_TRAP_BP, asm_exc_int3, IST_INDEX_DB),
85+
INTG(X86_TRAP_DB, asm_exc_debug),
86+
SYSG(X86_TRAP_BP, asm_exc_int3),
8787

8888
#ifdef CONFIG_X86_MCE
8989
ISTG(X86_TRAP_MC, asm_exc_machine_check, IST_INDEX_MCE),

0 commit comments

Comments
 (0)