From f99cd767a4a4eb400ebefcf45a7a9dab5137ec6a Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 12 Jun 2021 22:26:45 -0700 Subject: periodic run of misc_checks I should really stop using /disp8 jumps at the top-level given how inconvenient it is to check for overly large offsets. --- 108write.subx | 4 ++-- linux/bootstrap/033check_operands.cc | 1 + shell/trace.mu | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/108write.subx b/108write.subx index 9dc9742b..952ed909 100644 --- a/108write.subx +++ b/108write.subx @@ -141,7 +141,7 @@ try-write: # f: (addr stream byte), s: (addr array byte) -> overflow?/eax: bool 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # if (s == 0) return 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 0/imm32 # compare *(ebp+12) - 74/jump-if-= $write:end/disp8 + 74/jump-if-= $try-write:end/disp8 # . save registers 51/push-ecx # if (f->size - f->write < s->size) return @@ -202,7 +202,7 @@ stream-size: # f: (addr stream byte) -> n/eax: int 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . . # copy *ecx to eax # . restore registers 59/pop-to-ecx -$space-remaining-in-stream:end: +$stream-size:end: # . epilogue 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp 5d/pop-to-ebp diff --git a/linux/bootstrap/033check_operands.cc b/linux/bootstrap/033check_operands.cc index 62618204..0d5311ce 100644 --- a/linux/bootstrap/033check_operands.cc +++ b/linux/bootstrap/033check_operands.cc @@ -667,6 +667,7 @@ map Permitted_arguments_0f; //// Class D: just op and disp32 // imm32 imm8 disp32 |disp16 disp8 subop modrm // 0 0 1 |0 0 0 0 +put_new(Permitted_arguments_0f, "80", 0x10); put_new(Permitted_arguments_0f, "82", 0x10); put_new(Permitted_arguments_0f, "83", 0x10); put_new(Permitted_arguments_0f, "84", 0x10); diff --git a/shell/trace.mu b/shell/trace.mu index 3aa80141..298b7e23 100644 --- a/shell/trace.mu +++ b/shell/trace.mu @@ -417,10 +417,10 @@ fn dump-trace-with-label _self: (addr trace), label: (addr array byte) { var i/edx: int <- copy 0 var max-addr/ebx: (addr int) <- get self, first-free var max/ebx: int <- copy *max-addr - $dump-trace:loop: { + $dump-trace-with-label:loop: { compare i, max break-if->= - $dump-trace:iter: { + $dump-trace-with-label:iter: { var offset/ebx: (offset trace-line) <- compute-offset trace, i var curr/ebx: (addr trace-line) <- index trace, offset var curr-label-ah/eax: (addr handle array byte) <- get curr, label -- cgit 1.4.1-2-gfad0