Skip to content

Commit

Permalink
arch: add SET_CR3 assembly macro
Browse files Browse the repository at this point in the history
The macro preserves RAX register via stack, but does not clean the stack.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Jul 11, 2022
1 parent f53bfa1 commit 9cf5fe5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/arch/x86/asm-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@
#endif
.endm

.macro SET_CR3 val
push %_ASM_AX
mov (\val), %_ASM_AX
mov %_ASM_AX, %cr3
pop %_ASM_AX
.endm

#define GLOBAL(name) \
.global name; \
name:
Expand Down

0 comments on commit 9cf5fe5

Please sign in to comment.