MIPSBreakWorldUtilitiesImpl.mesa
Copyright Ó 1992, 1993 by Xerox Corporation. All rights reserved.
Katsuyuki Komatsu August 5, 1992 6:03 pm PDT
DIRECTORY
BreakWorldArchitecture,
MIPSArchitecture,
TargetArchitecture,
MIPSBreakWorldUtilities;
MIPSBreakWorldUtilitiesImpl: CEDAR PROGRAM
IMPORTS BreakWorldArchitecture, MIPSArchitecture, TargetArchitecture
EXPORTS MIPSBreakWorldUtilities
~ {
MIPSInstructionFromBreakWorldAddress: PUBLIC PROCEDURE [
address: BreakWorldArchitecture.Address,
displacement: TargetArchitecture.Displacement ¬ TargetArchitecture.nullDisplacement]
RETURNS [MIPSArchitecture.MIPSInstruction] ~ {
IF address.IsNullAddress[] THEN {
ERROR BreakWorldArchitecture.Cant[
code: $NullAddress, message: "MIPSInstructionFromBreakWorldAddress[nullAddress]"];
};
{
instruction: MIPSArchitecture.MIPSInstruction ~
MIPSArchitecture.MIPSInstructionFromTargetInstruction[
instruction: BreakWorldArchitecture.PeekInstruction[
pc: address, displacement: displacement]];
RETURN [instruction];
};
};
MIPSAddressFromBreakWorldAddress: PUBLIC PROCEDURE [
address: BreakWorldArchitecture.Address,
displacement: TargetArchitecture.Displacement ¬ TargetArchitecture.nullDisplacement]
RETURNS [MIPSArchitecture.MIPSAddress] ~ {
IF address.IsNullAddress[] THEN {
ERROR BreakWorldArchitecture.Cant[
code: $NullAddress, message: "MIPSInstructionFromBreakWorldAddress[nullAddress]"];
};
{
targetAddress: TargetArchitecture.Address ~ TargetArchitecture.AddressFromDisplacement[
address: BreakWorldArchitecture.TargetAddressFromBreakWorldAddress[address: address],
displacement: displacement];
mipsAddress: MIPSArchitecture.MIPSAddress ~
MIPSArchitecture.MIPSAddressFromTargetAddress[
address: targetAddress];
RETURN [mipsAddress];
};
};
}.