about summary refs log tree commit diff stats
path: root/baremetal
diff options
context:
space:
mode:
Diffstat (limited to 'baremetal')
-rw-r--r--baremetal/boot.hex19
-rw-r--r--baremetal/ex8.mu6
2 files changed, 20 insertions, 5 deletions
diff --git a/baremetal/boot.hex b/baremetal/boot.hex
index 4e4222b0..7b29e49f 100644
--- a/baremetal/boot.hex
+++ b/baremetal/boot.hex
@@ -257,13 +257,22 @@ e9 fd ff  # loop forever
   e6 21  # port 0x21 <- al
 
 # 11e:
-  # initialization is done; enable interrupts
-  fb
-  e9 dc 16 00 00  # jump to 0x9400 [label]
+  fb  # enable interrupts
+  db e3  # initialize FPU
+  # eax <- cr4
+  0f 20  # copy cr4 to rm32
+    e0  # 11/mod/direct 100/r32/CR4 000/rm32/eax
+  # eax <- or bit 9
+  0f ba
+    e8  # 11/mod/direct 101/subop/bit-test-and-set 000/rm32/eax
+    09  # imm8
+  # cr4 <- eax
+  0f 22  # copy rm32 to cr4
+    e0  # 11/mod/direct 100/r32/CR4 000/rm32/eax
+  e9 d0 16 00 00  # jump to 0x9400 [label]
 
 # padding
-# 124:
-            00 00 00 00 00 00 00 00 00 00 00 00
+# 130:
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff --git a/baremetal/ex8.mu b/baremetal/ex8.mu
new file mode 100644
index 00000000..367c665f
--- /dev/null
+++ b/baremetal/ex8.mu
@@ -0,0 +1,6 @@
+# Demo of floating-point
+
+fn main {
+  var n/eax: int <- copy 0
+  var result/xmm0: float <- convert n
+}