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.
This commit is contained in:
Kartik K. Agaram 2021-03-31 23:16:01 -07:00
parent 971062583a
commit d8d9dfa855
3 changed files with 29 additions and 0 deletions

View File

@ -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

misc_checks Executable file
View File

@ -0,0 +1,22 @@
# 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.

misc_checks.subx Normal file
View File

@ -0,0 +1,3 @@
== code 0x00000000
== data 0x80000000