about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-03-14 22:46:03 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-03-14 22:46:03 -0700
commitdda5fd08d8920b247b1880ff7d28dc7f4db60617 (patch)
tree0f2f2c845b112b4fefffe9415b0ce713ed30e27d
parent0e5d7e06248c22f663ce6d65e88676dba12f5a48 (diff)
downloadmu-dda5fd08d8920b247b1880ff7d28dc7f4db60617.tar.gz
.
-rw-r--r--boot.subx21
1 files changed, 16 insertions, 5 deletions
diff --git a/boot.subx b/boot.subx
index f43bac65..b8b34c4a 100644
--- a/boot.subx
+++ b/boot.subx
@@ -156,15 +156,26 @@
 == code
   cd/syscall 0x10/imm8/bios-video-services
 
-== data
-
   # switch to 32-bit mode
-  0f 01 16  # lgdt 00/mod/indirect 010/subop 110/rm/use-disp16
+  # . load global descriptor table
+  0f 01/lgdt 0/mod/indirect 2/subop/lgdt 6/rm32/use-disp16
+== data
     f8 7c  # *gdt_descriptor [label]
-  0f 20 c0  # eax <- cr0
+== code
+  # . enable paging
+  0f 20/cr-> 3/mod/direct 0/rm32/cr0 0/r32/eax
+== data
+  # TODO: SubX doesn't understand 66 prefix
+#?   66 83/or 3/mod/direct 0/rm32/eax 1/r32/?? 1/imm8  # eax <- or 0x1
   66 83 c8 01  # eax <- or 0x1
-  0f 22 c0  # cr0 <- eax
+== code
+  0f 22/cr<- 3/mod/direct 0/rm32/cr0 0/r32/eax
+== data
+  # . far jump that sets cs to offset 8 in the gdt in the process
   ea 00 7d 08 00  # far jump to initialize_32bit_mode after setting cs to the record at offset 8 in the gdt (gdt_code) [label]
+== code
+
+== data
 
 # padding
 # 8e: