From 9cf5fe590b95dc8cec32f0102d4c25d2d918918a Mon Sep 17 00:00:00 2001 From: Pawel Wieczorkiewicz Date: Fri, 8 Jul 2022 13:57:36 +0200 Subject: [PATCH] arch: add SET_CR3 assembly macro The macro preserves RAX register via stack, but does not clean the stack. Signed-off-by: Pawel Wieczorkiewicz --- include/arch/x86/asm-macros.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/arch/x86/asm-macros.h b/include/arch/x86/asm-macros.h index 6b946d57..acdb7edd 100644 --- a/include/arch/x86/asm-macros.h +++ b/include/arch/x86/asm-macros.h @@ -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: