Define bit definitions for cr0 register.
[seabios.git] / src / system.c
index 11b1cc8cc7639c246a967d9473faa19916e4293c..1c96b989c0fcf6251f54af2ed47bae454821f152 100644 (file)
@@ -144,9 +144,9 @@ handle_1587(struct bregs *regs)
         "lgdtw %%es:0x8(%%si)\n"
         "lidtw %%cs:pmode_IDT_info\n"
 
-        // set PE bit in CR0
+        // Enable protected mode
         "movl %%cr0, %%eax\n"
-        "orb $0x01, %%al\n"
+        "orl $" __stringify(CR0_PE) ", %%eax\n"
         "movl %%eax, %%cr0\n"
 
         // far jump to flush CPU queue after transition to protected mode
@@ -164,9 +164,9 @@ handle_1587(struct bregs *regs)
         "xorw %%di, %%di\n"
         "rep movsw\n"
 
-        // reset PG bit in CR0 ???
+        // Disable protected mode
         "movl %%cr0, %%eax\n"
-        "andb $0xfe, %%al\n"
+        "andl $~" __stringify(CR0_PE) ", %%eax\n"
         "movl %%eax, %%cr0\n"
 
         // far jump to flush CPU queue after transition to real mode