mac-rom/QuickDraw/JacksonPollock/VMPatch.a

59 lines
1.8 KiB
Plaintext
Raw Permalink Normal View History

; ======================================================================
; VMPatch.a <09> 1988 by Apple Computer Inc
; by Chris Derossi 4/10/89
; ======================================================================
PrNonPortable EQU 1 ; We're building System SW. This is ok.
PRINT OFF
INCLUDE 'Traps.a'
INCLUDE 'SysEqu.a'
INCLUDE 'ToolEqu.a'
INCLUDE 'Private.a'
INCLUDE 'quickequ.a'
INCLUDE 'colorequ.a'
INCLUDE 'VMCalls.a'
PRINT ON
; ======================================================================
; Header to main init code.
; ======================================================================
MACHINE MC68020
VMPatch PROC EXPORT
; During a page fault exception, MacVM continues to service the cursor interrupt. Now that
; the cursor code is not in ROM, and not in the System heap, it must not get paged out.
; Otherwise, nested page faults could occur, and this is bad.
;
; This patch tells MacVM to keep the cursor code in memory at all times. This patch does
; nothing if MacVM isn't around.
;
; Note: This patch knows that the cursor code is pointed to by JCrsrTask, and ends at the
; location pointed to by JScrnAddr.
Unimplemented EQU $A89F ; the Unimplemented trap number
MemoryDispatch EQU $A05C ; trap number for MacVM Dispatcher
; Does the MacVM dispatch trap exist?
MOVE.W #MemoryDispatch, D0 ; MacVM Trap number
_GetTrapAddress ,NewOS ; get the address of _MemoryDispatch
MOVEA.L A0, A1 ; Hold it for a sec
MOVE.W #Unimplemented, D0 ; get address of Unimplemented trap
_GetTrapAddress
CMPA.L A0,A1 ; see if MacVM is around
BEQ.S @0 ; if not, we're done
MOVE.L jCrsrTask, A0 ; Point to cursor code
MOVE.L jScrnAddr, A1 ; Get end of code
SUBA.L jCrsrTask, A1 ; Calculate length of cursor code
_HoldMemory ; Tell VM to keep it around
@0
RTS
END