about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-12-23 09:57:40 -0800
committerKartik Agaram <vc@akkartik.com>2020-12-23 10:04:01 -0800
commitd70711e1b0cce6e9b6c4bd7a4775f218e220e3b2 (patch)
tree3fd3475e2c33afc8aa773185b106057ab009f3c9 /apps
parentf29b6c6b1abf167ccb3527635edd69834ea83e80 (diff)
downloadmu-d70711e1b0cce6e9b6c4bd7a4775f218e220e3b2.tar.gz
7384
Currently at commit 7378 (reset the A20 address line) except without 7376
(enabling interrupts).
Diffstat (limited to 'apps')
-rw-r--r--apps/boot.hex27
1 files changed, 23 insertions, 4 deletions
diff --git a/apps/boot.hex b/apps/boot.hex
index ffb4b277..d09287a8 100644
--- a/apps/boot.hex
+++ b/apps/boot.hex
@@ -62,19 +62,38 @@
   0f 82 76 00  # jump-if-carry disk-error
 
 # 26:
+  # undo the A20 hack: https://en.wikipedia.org/wiki/A20_line
+  # this is from https://github.com/mit-pdos/xv6-public/blob/master/bootasm.S
+  # seta20.1:
+  e4 64  # al <- port 0x64
+  a8 02  # set zf if bit 1 (second-least) is not set
+  75 fa  # if zf not set, goto seta20.1 (-6)
+
+  b0 d1  # al <- 0xd1
+  e6 64  # port 0x64 <- al
+
+# 30:
+  # seta20.2:
+  e4 64  # al <- port 0x64
+  a8 02  # set zf if bit 1 (second-least) is not set
+  75 fa  # if zf not set, goto seta20.2 (-6)
+
+  b0 df  # al <- 0xdf
+  e6 64  # port 0x64 <- al
+
+# 3a:
   # switch to 32-bit mode
   0f 01 16  # lgdt 00/mod/indirect 010/subop 110/rm32/TODO
     80 7c  # *gdt_descriptor
-# 2b:
+# 3f:
   0f 20 c0  # eax <- cr0
   66 83 c8 01  # eax <- or 0x1
   0f 22 c0  # cr0 <- eax
   ea c0 7c 08 00  # far jump to initialize_32bit_mode after setting cs to the record at offset 8 in the gdt (gdt_code)
 
 # padding
-# 3a:
-                              00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+# 4e:
+                                          00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
 ## GDT: 3 records of 8 bytes each