about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-03-31 23:16:01 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-03-31 23:16:01 -0700
commitd8d9dfa855c83fe52c7b8d26ef1f52dafdec8fa0 (patch)
tree8a1e92e16ed909be84ad30b530970230f552aa22
parent971062583a431f916a742b161cc524f4e52d2a9e (diff)
downloadmu-d8d9dfa855c83fe52c7b8d26ef1f52dafdec8fa0.tar.gz
some hacky checks for common errors
They're not really baked into the regular compilation process; I have to
remember to run them if I see strange behavior.
-rw-r--r--linux/bootstrap/033check_operands.cc4
-rwxr-xr-xmisc_checks22
-rw-r--r--misc_checks.subx3
3 files changed, 29 insertions, 0 deletions
diff --git a/linux/bootstrap/033check_operands.cc b/linux/bootstrap/033check_operands.cc
index c764fc61..62618204 100644
--- a/linux/bootstrap/033check_operands.cc
+++ b/linux/bootstrap/033check_operands.cc
@@ -145,6 +145,10 @@ void init_permitted_arguments() {
   put(Permitted_arguments, "99", 0x00);
   // return
   put(Permitted_arguments, "c3", 0x00);
+  // enable/disable interrupts
+  // not really part of SubX; just needed in low-level boot.subx
+  put(Permitted_arguments, "fa", 0x00);
+  put(Permitted_arguments, "fb", 0x00);
 
   //// Class B: just op and disp8
   //  imm32 imm8  disp32 |disp16  disp8 subop modrm
diff --git a/misc_checks b/misc_checks
new file mode 100755
index 00000000..91384ea3
--- /dev/null
+++ b/misc_checks
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Hackily check for certain kinds of errors.
+#
+# We still rely exclusively on linux/bootstrap/bootstrap for some static
+# checks on bare SubX code that aren't implemented yet in the self-hosted
+# translator phases.
+#
+# However, boot.subx uses instructions that bootstrap doesn't recognize. So we
+# won't check it.
+
+set -e
+
+cat $* [0-9]*.mu                                      |linux/mu      > a.subx
+
+cat misc_checks.subx mu-init.subx [0-9]*.subx a.subx  |linux/braces  > a.braces
+cat a.braces                                          |linux/calls   > a.calls
+cat a.calls                                           |linux/sigils  > a.sigils
+
+CXXFLAGS=-g linux/bootstrap/bootstrap --debug translate a.sigils -o a.elf
+# Translation will never succeed,
+# but if we get to "missing reference to global" errors, they're expected and
+# we've gotten to the end of what bootstrap can check for us.
diff --git a/misc_checks.subx b/misc_checks.subx
new file mode 100644
index 00000000..f9cedf92
--- /dev/null
+++ b/misc_checks.subx
@@ -0,0 +1,3 @@
+== code 0x00000000
+
+== data 0x80000000