Skip to content

Commit e59baa7

Browse files
skttwipawel
authored andcommitted
usermode: clobber all x64 registers.
This bug possibly surfaced after adding some additional code to the syscall handler. Signed-off-by: kwikner <[email protected]>
1 parent 568c5a0 commit e59baa7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

include/arch/x86/asm-macros.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,23 @@ name ## _end:
266266
"push %%r9\n" \
267267
"push %%r10\n" \
268268
"push %%r11\n" \
269+
"push %%r12\n" \
270+
"push %%r13\n" \
271+
"push %%r14\n" \
272+
"push %%r15\n" \
269273
::: "memory")
270274

271275
#define RESTORE_CLOBBERED_REGS64() \
272276
asm volatile ( \
277+
"pop %%" STR(r15) "\n" \
278+
"pop %%" STR(r14) "\n" \
279+
"pop %%" STR(r13) "\n" \
280+
"pop %%" STR(r12) "\n" \
273281
"pop %%" STR(r11) "\n" \
274282
"pop %%" STR(r10) "\n" \
275283
"pop %%" STR(r9) "\n" \
276284
"pop %%" STR(r8) "\n" \
277-
::: "r8", "r9", "r10", "r11")
285+
::: "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15")
278286
#else
279287
#define SAVE_CLOBBERED_REGS64()
280288
#define RESTORE_CLOBBERED_REGS64()

0 commit comments

Comments
 (0)