DIRECTORY MIPSArchitecture, MIPSManger; MIPSBreakpoint: CEDAR DEFINITIONS ~ { registerSaveArea: NAT ~ 66 * BYTES[MIPSArchitecture.MIPSContents]; PatchStruct: TYPE ~ MACHINE DEPENDENT RECORD [ closureCaller: ClosureCaller, manger: MIPSManger.Manger ]; ClosureCaller: TYPE ~ MACHINE DEPENDENT RECORD [ subiu: MIPSArchitecture.MIPSInstruction, sw: MIPSArchitecture.MIPSInstruction, callSaveRegs: MIPSArchitecture.MIPSInstruction, noop1: MIPSArchitecture.MIPSInstruction, argHiClientData: MIPSArchitecture.MIPSInstruction, callClientProc: MIPSArchitecture.MIPSInstruction, argLoClientData: MIPSArchitecture.MIPSInstruction, callRestoreRegs: MIPSArchitecture.MIPSInstruction, noop2: MIPSArchitecture.MIPSInstruction, lw: MIPSArchitecture.MIPSInstruction, addiu: MIPSArchitecture.MIPSInstruction ]; }.  MIPSBreakpoint.mesa Copyright 1992 by Xerox Corporation. All rights reserved. Katsuyuki Komatsu August 5, 1992 6:03 pm PDT Patches can't be monitored, since the processor executes out of them. My accesses of the patches and the pc's executing in them are races. That isn't a problem because the pc's never get to the patches until I'm done setting them up (fortunately), and I don't clear the patch. Clearing a breakpoint is just putting the instruction back, since you can't tell when the pc (or several of them) are done with the patch (that's is a garbage collection problem). This closureCaller is for MIPS's: it includes pushing a link register and allocating space for saving the rest of the registers. addiu $sp, $sp, -(stackAllocationForCallee+registerSaveArea) sw r31, 20(sp) jal _save_regs noop -- save_regs(@registerSaveArea). lui %hi(clientData), $4 jal clientProc ori %lo(clientData), $4 -- clientProc(clientData). jal _restore_regs noop -- restore_regs(@registerSaveArea). lw r31, 20(sp) addiu $sp, $sp, (stackAllocationForCallee+registerSaveArea) Constants. 30 words (general without r0 & r31) + 32 words (floating-point) + 2 words (special) + 1 word (floating-point control) for saving the rest of the registers (double-word aligned). Types. Patches are self-describing, in that they include the address of the replaced instruction (in the header) and the replaced instruction (relocated into the patch). in the delay slot. in the delay slot. in the delay slot. RNewlineDelimiter codeK r1