Because self documenting macros are better than hardcoded constants with
comments next to them.

---
 i386/i386/msr.h  | 1 +
 x86_64/boothdr.S | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/i386/i386/msr.h b/i386/i386/msr.h
index 8f09b80b..eefdf685 100644
--- a/i386/i386/msr.h
+++ b/i386/i386/msr.h
@@ -20,6 +20,7 @@
 #define _MACHINE_MSR_H_
 
 #define MSR_REG_EFER  0xC0000080
+# define MSR_REG_EFER_LONG_MODE_EN (1 << 8)
 #define MSR_REG_STAR  0xC0000081
 #define MSR_REG_LSTAR 0xC0000082
 #define MSR_REG_CSTAR 0xC0000083
diff --git a/x86_64/boothdr.S b/x86_64/boothdr.S
index 020aff93..7ca26cfc 100644
--- a/x86_64/boothdr.S
+++ b/x86_64/boothdr.S
@@ -20,6 +20,7 @@
 
 #include <i386/i386asm.h>
 #include <i386/i386/proc_reg.h>
+#include <i386/i386/msr.h>
 #include <i386/i386/seg.h>
 #include <i386/apic.h>
 
@@ -150,9 +151,9 @@ switch64:
        mov     %cr4,%eax
        or      $CR4_PAE,%eax
        mov     %eax,%cr4
-       mov     $0xC0000080,%ecx  // select EFER register
+       mov     $MSR_REG_EFER,%ecx
        rdmsr
-       or      $(1 << 8),%eax  // long mode enable bit
+       or      $MSR_REG_EFER_LONG_MODE_EN,%eax
        wrmsr
        mov     $p4table,%eax
        mov     %eax,%cr3
-- 
2.51.0



Reply via email to