Files

48 lines
1.1 KiB
NASM

; retprobe.asm -- MINIMAL test of the DI return-PC trampoline, no drawing.
;
; Installs `entry` on the DI RAM stub (00000DB0h). `entry` replaces the
; interrupt frame's saved PC with `ret_hook` and runs the stock handler.
; `ret_hook` bumps a marker and returns to the saved PC. It deliberately does
; NOT preserve registers, so TCP liveness tells us whether the frame/PC dance
; itself is sound. Scratch is in the payload's own page (01840800h).
;
; Linked at bit 01840000h by dwt/visual/build.sh.
.text
_start:
pushst
dint
setf 32, 0, 0
movi entry, a0, L
move a0, @00000DC0h, 0
setf 16, 0, 0
movi 0C080h, a0, L
move a0, @00000DB0h, 0
sub a0, a0
move a0, @01840800h, 0 ; marker
popst
rets
entry:
move a0, @01840810h, 1
setf 32, 0, 1
move *sp(020h), a0, 1
move a0, @01840804h, 1 ; orig_pc
movi ret_hook, a0, L
move a0, *sp(020h), 1
move @01840810h, a0, 1
jauc 3F7146D0h
ret_hook:
move @01840800h, a0, 0
inc a0
move a0, @01840800h, 0
setf 32, 0, 1
move @01840804h, a0, 1 ; orig_pc
move a0, -*sp, 1
getst a0 ; (clobbers a0 on purpose)
move a0, -*sp, 1
popst
rets
.end