Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

entry: SAVE/RESTORE_ALL_REGS cond. exclude AX #298

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions arch/x86/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ ENTRY(enter_usermode)
END_FUNC(enter_usermode)

ENTRY(syscall_handler_entry)
SAVE_ALL_REGS
SAVE_ALL_REGS include_ax=0
syscall_from_usermode

cmp $SYSCALL_EXIT, %_ASM_AX
Expand All @@ -219,12 +219,12 @@ ENTRY(syscall_handler_entry)
pop %_ASM_CX

syscall_to_usermode
RESTORE_ALL_REGS
RESTORE_ALL_REGS include_ax=0
SYSRET
END_FUNC(syscall_handler_entry)

ENTRY(sysenter_handler_entry)
SAVE_ALL_REGS
SAVE_ALL_REGS include_ax=0
syscall_from_usermode

MASK_USER_FLAGS
Expand All @@ -238,13 +238,13 @@ ENTRY(sysenter_handler_entry)
call syscall_handler

syscall_to_usermode
RESTORE_ALL_REGS
RESTORE_ALL_REGS include_ax=0

SYSEXIT
END_FUNC(sysenter_handler_entry)

ENTRY(int80_handler_entry)
SAVE_ALL_REGS
SAVE_ALL_REGS include_ax=0
syscall_from_usermode

MASK_USER_FLAGS
Expand All @@ -257,7 +257,7 @@ ENTRY(int80_handler_entry)
call syscall_handler

syscall_to_usermode
RESTORE_ALL_REGS
RESTORE_ALL_REGS include_ax=0
IRET
END_FUNC(int80_handler_entry)
GLOBAL(end_usermode_helpers)
Expand Down
8 changes: 6 additions & 2 deletions include/arch/x86/asm-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@
pop %eax
.endm

.macro SAVE_ALL_REGS
.macro SAVE_ALL_REGS include_ax=1
.if \include_ax
push %_ASM_AX
.endif
push %_ASM_BX
push %_ASM_CX
push %_ASM_DX
Expand All @@ -108,7 +110,7 @@
#endif
.endm

.macro RESTORE_ALL_REGS
.macro RESTORE_ALL_REGS include_ax=1
#if defined(__x86_64__)
pop %r15
pop %r14
Expand All @@ -125,7 +127,9 @@
pop %_ASM_DX
pop %_ASM_CX
pop %_ASM_BX
.if \include_ax
pop %_ASM_AX
.endif
.endm

.macro SAVE_CALLEE_SAVED_REGS
Expand Down