From 27d4401372adad3b652cfaafc46a1fca1fcd7718 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Thu, 27 Jul 2017 11:01:54 +0200 Subject: [PATCH] avoid memory access by preloading image_size into r11 --- arch/x86/kernel/entry.asm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/entry.asm b/arch/x86/kernel/entry.asm index d80c9befc..a4c68e835 100644 --- a/arch/x86/kernel/entry.asm +++ b/arch/x86/kernel/entry.asm @@ -194,6 +194,7 @@ Lno_mbinfo: xor rcx, rcx mov rsi, 510*0x200000 sub rsi, kernel_start + mov r11, QWORD [image_size] Lremap: mov QWORD [rdi], rax add rax, 0x200000 @@ -202,7 +203,7 @@ Lremap: ; note: the whole code segement has to fit in the first pgd cmp rcx, rsi jnb Lno_pml4_init - cmp rcx, QWORD [image_size] + cmp rcx, r11 jb Lremap Lno_pml4_init: