Skip to content

Commit

Permalink
usermode: clobber all x64 registers.
Browse files Browse the repository at this point in the history
This bug possibly surfaced after adding some additional code to the
syscall handler.

Signed-off-by: kwikner <[email protected]>
  • Loading branch information
sktt committed Aug 3, 2023
1 parent 2623d74 commit 0de5d78
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion include/arch/x86/asm-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,23 @@ name ## _end:
"push %%r9\n" \
"push %%r10\n" \
"push %%r11\n" \
"push %%r12\n" \
"push %%r13\n" \
"push %%r14\n" \
"push %%r15\n" \
::: "memory")

#define RESTORE_CLOBBERED_REGS64() \
asm volatile ( \
"pop %%" STR(r15) "\n" \
"pop %%" STR(r14) "\n" \
"pop %%" STR(r13) "\n" \
"pop %%" STR(r12) "\n" \
"pop %%" STR(r11) "\n" \
"pop %%" STR(r10) "\n" \
"pop %%" STR(r9) "\n" \
"pop %%" STR(r8) "\n" \
::: "r8", "r9", "r10", "r11")
::: "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15")
#else
#define SAVE_CLOBBERED_REGS64()
#define RESTORE_CLOBBERED_REGS64()
Expand Down

0 comments on commit 0de5d78

Please sign in to comment.