diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-05-14 20:52:27 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-05-14 20:52:27 -0700 |
commit | 73744d098ca59a3844987e0919b990a880ec6895 (patch) | |
tree | e2e1c92237c514e9db50b968206221423e33b3cb /317abort.subx | |
parent | a3f5da03337813a7d8c33b3ef35c5a37e30ee010 (diff) | |
download | mu-73744d098ca59a3844987e0919b990a880ec6895.tar.gz |
dump addresses of call stack on abort
Diffstat (limited to '317abort.subx')
-rw-r--r-- | 317abort.subx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/317abort.subx b/317abort.subx index 9d196ed8..8c6b3b48 100644 --- a/317abort.subx +++ b/317abort.subx @@ -9,7 +9,38 @@ abort: # e: (addr array byte) # (set-cursor-position-on-real-screen 0 0) (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 *(ebp+8) 0xf 0xc) # 0/real-screen, 0xf/fg=white, 0xc/bg=red + (dump-call-stack) # crash { eb/jump loop/disp8 } + +dump-call-stack: + # . prologue + 55/push-ebp + 89/<- %ebp 4/r32/esp + # . save registers + 50/push-eax + 53/push-ebx + # traverse the linked list of ebp pointers: https://wiki.osdev.org/Stack_Trace + 8b/-> *ebp 3/r32/ebx + { + # loop termination check + 81 7/subop/compare %ebx 0/imm32 + 0f 84/jump-if-= break/disp32 + # loop body + (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "\n" 0 0xc) + (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *(ebx+4) 0xf 0xc) + # loop update + 8b/-> *ebx 3/r32/ebx + # + e9/jump loop/disp32 + } +$dump-call-stack:end: + # . restore registers + 5b/pop-to-ebx + 58/pop-to-eax + # . epilogue + 89/<- %esp 5/r32/ebp + 5d/pop-to-ebp + c3/return |