Browse Source

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.
main
Kartik K. Agaram 1 year ago
parent
commit
f99cd767a4
  1. 4
      108write.subx
  2. 1
      linux/bootstrap/033check_operands.cc
  3. 4
      shell/trace.mu

4
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

1
linux/bootstrap/033check_operands.cc

@ -667,6 +667,7 @@ map</*op*/string, /*bitvector*/uint8_t> 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);

4
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

Loading…
Cancel
Save