<<>> <> <> <> <<>> DIRECTORY BreakWorldArchitecture, SPARCArchitecture, TargetArchitecture, SPARCBreakWorldUtilities; SPARCBreakWorldUtilitiesImpl: CEDAR PROGRAM IMPORTS BreakWorldArchitecture, SPARCArchitecture, TargetArchitecture EXPORTS SPARCBreakWorldUtilities ~ { SPARCInstructionFromBreakWorldAddress: PUBLIC PROCEDURE [ address: BreakWorldArchitecture.Address, displacement: TargetArchitecture.Displacement ¬ TargetArchitecture.nullDisplacement] RETURNS [SPARCArchitecture.SPARCInstruction] ~ { IF address.IsNullAddress[] THEN { ERROR BreakWorldArchitecture.Cant[ code: $NullAddress, message: "SPARCInstructionFromBreakWorldAddress[nullAddress]"]; }; { instruction: SPARCArchitecture.SPARCInstruction ~ SPARCArchitecture.SPARCInstructionFromTargetInstruction[ instruction: BreakWorldArchitecture.PeekInstruction[ pc: address, displacement: displacement]]; RETURN [instruction]; }; }; SPARCAddressFromBreakWorldAddress: PUBLIC PROCEDURE [ address: BreakWorldArchitecture.Address, displacement: TargetArchitecture.Displacement ¬ TargetArchitecture.nullDisplacement] RETURNS [SPARCArchitecture.SPARCAddress] ~ { IF address.IsNullAddress[] THEN { ERROR BreakWorldArchitecture.Cant[ code: $NullAddress, message: "SPARCInstructionFromBreakWorldAddress[nullAddress]"]; }; { targetAddress: TargetArchitecture.Address ~ TargetArchitecture.AddressFromDisplacement[ address: BreakWorldArchitecture.TargetAddressFromBreakWorldAddress[address: address], displacement: displacement]; sparcAddress: SPARCArchitecture.SPARCAddress ~ SPARCArchitecture.SPARCAddressFromTargetAddress[ address: targetAddress]; RETURN [sparcAddress]; }; }; }.