SPARCBreakWorldUtilitiesImpl.mesa
Copyright Ó 1990 by Xerox Corporation. All rights reserved.
Peter B. Kessler, April 18, 1990 9:06:00 pm PDT
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];
};
};
}.