diff options
Diffstat (limited to 'src/arch/x86/c_start.S')
-rw-r--r-- | src/arch/x86/c_start.S | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/arch/x86/c_start.S b/src/arch/x86/c_start.S index 75716c8200..124bfa84bf 100644 --- a/src/arch/x86/c_start.S +++ b/src/arch/x86/c_start.S @@ -402,26 +402,26 @@ _idt_end: SetCodeSelector: .intel_syntax noprefix - # save rsp because iret will align it to a 16 byte boundary - mov rdx, rsp - - # use iret to jump to a 64-bit offset in a new code segment - # iret will pop cs:rip, flags, then ss:rsp - mov ax, ss # need to push ss.. - push rax # push ss instuction not valid in x64 mode, so use ax - push rsp - pushfq - push rcx # cx is code segment selector from caller - mov rax, offset setCodeSelectorLongJump - push rax - - # the iret will continue at next instruction, with the new cs value loaded - iretq + # save rsp because iret will align it to a 16 byte boundary + mov rdx, rsp + + # use iret to jump to a 64-bit offset in a new code segment + # iret will pop cs:rip, flags, then ss:rsp + mov ax, ss # need to push ss.. + push rax # push ss instuction not valid in x64 mode, so use ax + push rsp + pushfq + push rcx # cx is code segment selector from caller + mov rax, offset setCodeSelectorLongJump + push rax + + # the iret will continue at next instruction, with the new cs value loaded + iretq setCodeSelectorLongJump: - # restore rsp, it might not have been 16-byte aligned on entry - mov rsp, rdx - ret + # restore rsp, it might not have been 16-byte aligned on entry + mov rsp, rdx + ret .att_syntax prefix .previous |