From 9b6be85df033ead196dc3821ef1d62cc59899e69 Mon Sep 17 00:00:00 2001 From: Elliot Nunn Date: Thu, 4 Jan 2018 11:13:19 +0800 Subject: [PATCH] Patch CFDispatch (AA5A) to log some calls GetSharedLibrary and FindSymbol in particular --- OS/StartMgr/StartInit.a | 89 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/OS/StartMgr/StartInit.a b/OS/StartMgr/StartInit.a index f26ef8e..f2a45d7 100644 --- a/OS/StartMgr/StartInit.a +++ b/OS/StartMgr/StartInit.a @@ -1482,7 +1482,7 @@ BootRetry MOVE #$2700,SR ; disable interrupts ; initialize the expanded low-mem area (really in the system heap) WITH ExpandMemRec ; - Move.l #emRecSize,d0 ; size of ext to old low-mem + Move.l #emRecSize + 100,d0 ; size of ext to old low-mem _NewPtr sys,clear ; get a blob Move.l a0,ExpandMem ; stuff global ptr Move.w #emCurVersion,(a0)+ ; version number @@ -1538,6 +1538,18 @@ BootRetry MOVE #$2700,SR ; disable interrupts _SysError ; Put up a dialog and die. @noPower + ; PATCH THE CodeFragmentDispatch trap! + + move.l ExpandMem, a1 + move.w #$AA5A, d0 + _GetToolTrapAddress + move.l a0, ExpandMemRec.emRecSize + 100 - 4(a1) + + lea MyNewGoNativeTrap, a0 + move.w #$AA5A, d0 + _SetToolTrapAddress + + ; 268 IMPORT InterC_1690_CodeRegister BSR.L InterC_1690_CodeRegister @@ -3985,6 +3997,81 @@ FiddleWithEmulator Rts +MyNewGoNativeTrap + + STRING Pascal + + clr.l -(sp) ; room to jump! + movem.l a0-a6/d0-d7, -(sp) ; 15 registers = 60 bytes of stack + + lea 64(sp), a3 ; a3 = stack ptr on entry, contains args! + + + cmp #1, 4(a3) + bne.s @notSharedLib + + lea #'GetSharedLibrary: ', a0 + bsr PrintP + + move.l 26(a3), a0 + bsr PrintP + + lea #' ...^n', a0 + bsr PrintP +@notSharedLib + + + cmp #5, 4(a3) + bne.s @notGetSym + + lea #'FindSymbol: ', a0 + bsr PrintP + + move.l 14(a3), a0 + bsr PrintP + + lea #' ...^n', a0 + bsr PrintP +@notGetSym + + + move.l ExpandMem, a4 + move.l ExpandMemRec.emRecSize + 100 - 4(a4), 60(sp) + + movem.l (sp)+, a0-a6/d0-d7 + + rts + + +PrintP ; takes arg in a0, clobbers a1 and d0 + + sub.l #256, sp + move.l sp, a1 + + move.b (a0)+, d0 ; copy a0 to a1 +@loop tst.b d0 + bz.s @exitLoop + move.b (a0)+, (a1)+ + sub.b #1, d0 + bra.s @loop +@exitLoop + clr.b (a1)+ + + move.l sp, a0 + bsr PrintC + + add.l #256, sp + + rts + + +PrintC + move.l a0, -(sp) + move.w #-3, -(sp) + dc.w $AA7F + + rts + align 16 end \ No newline at end of file