Functions | |||
Written for the MPW assembler include asmDefs_ppc h start_exported_func currentFrame mr sp blr start_exported_func currentRTOC mr RTOC blr start_exported_func currentReturnAddr lwz LinkageArea | savedPC (sp) blr start_exported_func set_SPLimitReg mr SPLimitReg, r3 | ||
relies on C not save arg1 in stack frame stw LinkageArea | size (sp) | ||
if (callerSaveAddr) store fp, return addr into callerSaveAddr[0], [1] | |||
if (!init) restore fp, return addr from calleeSaveAddr[0], [1] | |||
void | SetSPAndCall ( char** callerSaveAddr, char** calleeSaveAddr, ; bool init, bool* semaphore) | ||
if should also zero out all incl | ctr (count), xer, fp execption, | ||
first make new stack frame& save all registers in it mflr link stw LinkageArea | savedPC (SP) mfcr r0 stw r0,LinkageArea.savedCR(SP) mr fp,sp stwu SP,LinkageArea.savedSP-Frame.size(SP) | ||
rcv_arg set arg0 entry_point_arg set arg1 arg1_arg set arg2 outgoing_arg_count set fr_size | set ((LinkageArea.size + (outgoing_arg_count + NumGlobalNonVolRegisters) * size_of_gpr) + 15) & ~15 export_code_symbol firstSelfFrameSendDescEnd, fsfsde export_code_symbol firstSelfFrameRetPC, fsfrp import_func capture_NLR_parameters_from_registers, capt_NLR_regs start_exported_func EnterSelf | ||
save PC | link (pc to return to) | ||
save global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr stswi NumGlobalNonVolRegisters* size_of_gpr load_global_nonvol_regs stwu | fr_size (SP) | ||
placeholder for StaticNormalLookupType LinkageArea | savedSP (sp) | ||
continue with | capt_NLR_regs (RTOC) lwz Temp1, 0(Temp1) mtlr Temp1 | ||
and back to | caller (which is C code) b fsfsde | ||
I pass args to | C (SendMessage) so need to leave that much stack space | ||
I save args for the send | here (DUPLICATED in runtime.h) SendMessage_stub_ volatile _register_sp_offset | ||
Variables | |||
Copyright Sun | Microsystems | ||
Copyright Sun Inc and Stanford | University | ||
See the LICENSE file for license | information | ||
Written for the MPW assembler include asmDefs_ppc h start_exported_func currentFrame mr | r3 | ||
Written for the MPW assembler include asmDefs_ppc h start_exported_func currentFrame mr sp blr start_exported_func currentRTOC mr | r3 | ||
Written for the MPW assembler include asmDefs_ppc h start_exported_func currentFrame mr sp blr start_exported_func currentRTOC mr RTOC blr start_exported_func currentReturnAddr lwz | r3 | ||
relies on C not save arg1 in stack frame stw | r3 | ||
arg area is right after linkage area | blr | ||
savedFPR record ds b size_of_fpr endr allNVFPRs | record | ||
savedFPR record ds b size_of_fpr endr allNVFPRs decr base set* sf31 ds savedFPR sf30 ds savedFPR sf29 ds savedFPR sf28 ds savedFPR sf27 ds savedFPR sf26 ds savedFPR sf25 ds savedFPR sf24 ds savedFPR sf23 ds savedFPR sf22 ds savedFPR sf21 ds savedFPR sf20 ds savedFPR sf19 ds savedFPR sf18 ds savedFPR sf17 ds savedFPR sf16 ds savedFPR sf15 ds savedFPR sf14 ds savedFPR | endr | ||
local | def | ||
make new stack frame& save all registers in | it | ||
clear | semaphore | ||
clear restore regs& return to return | addr | ||
else setup new stack | fp | ||
else setup new stack sp starting at | calleeSaveAddr [0] | ||
clear | semaphore | ||
clear jump to calleeSaveAddr [1] locals_for_sf record endr FrameTop | record | ||
clear jump to calleeSaveAddr [1] locals_for_sf record endr FrameTop | decr | ||
downwards to align more | easily | ||
assume qw alignment fprs ds allNVFPRs | align | ||
for stm gprs ds l HighestNonVolReg LowestNonVolReg lcls ds locals_for_sf size equ* endr Frame | record | ||
assume qw alignment bot ds LinkageArea ds b FrameTop align top equ* size equ* | endr | ||
process switch | primitive | ||
NOTE ASSUMES switching within same code | segment | ||
in other | words | ||
in other although I save and restore the | RTOC | ||
in other although I save and restore the | I | ||
do not set the new | RTOC | ||
next bit inspired by MPW PPC ASM | manual | ||
next bit inspired by MPW PPC ASM | pg | ||
must save restore nonvol | regs | ||
must save restore nonvol FR14 and | up | ||
must save restore nonvol FR14 and and parts of | CR | ||
if | asserts | ||
if should also zero out all | others | ||
fpscr fp status& control | reg | ||
first make new stack frame& save all registers in it mflr link stw | link | ||
save PC link mflr r0 stw | r0 | ||
save global nonvols for C subi | Temp1 | ||
save global nonvols for C subi | SP | ||
save global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr stswi | LowestNonVolReg | ||
save global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr stswi | Temp1 | ||
save global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr stswi NumGlobalNonVolRegisters* size_of_gpr load_global_nonvol_regs stwu | SP | ||
call Self mtlr | entry_point_arg | ||
dont need to move rcv mr | arg1 | ||
dont need to move rcv mr | arg1_arg | ||
Inline cache | format | ||
Inline cache ReturnTrap | blrl | ||
go | |||
cache | fsfrp | ||
reg mask b contNLR dc | l | ||
placeholder for nmlns dc | l | ||
placeholder for nmlns dc | l | ||
placeholder for selector dc | l | ||
placeholder for StaticNormalLookupType | fsfsde | ||
restore global nonvols for C subi | Temp1 | ||
restore global nonvols for C subi | SP | ||
restore global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr lswi | LowestNonVolReg | ||
restore global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr lswi | Temp1 | ||
restore global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr lswi NumGlobalNonVolRegisters* size_of_gpr lwz | r0 | ||
continue with | NLR | ||
don t need this because they are already in the right | registers | ||
mr | arg0 | ||
mr | NLRResultReg | ||
mr | arg1 | ||
mr | NLRHomeReg | ||
mr | arg2 | ||
mr NLRHomeIDReg | blrl | ||
restore stack& | regs | ||
SendMessage_stub | |||
post | call | ||
post pre | frame | ||
NonVols | |||
This routine goes via SaveSelfNonVolRegs because it calls out to C and | C | ||
If that routine finds a frame for this | stub | ||
If that routine finds a frame for this it can assume that all nonvols are | stored | ||
below its SP import_func | SendMessage | ||
below its SP import_func sm_C_func export | SendMessage_stub_returnPC | ||
for stack walking | num_outgoing_args |
Written for the MPW assembler include asmDefs_ppc h start_exported_func currentFrame mr sp blr start_exported_func currentRTOC mr RTOC blr start_exported_func currentReturnAddr lwz LinkageArea savedPC (sp) |
relies on C not save arg1 in stack frame stw LinkageArea size (sp) |
if (callerSaveAddr) |
if (! init) |
void SetSPAndCall (char ** callerSaveAddr, char ** calleeSaveAddr, ; bool init, bool * semaphore) |
if should also zero out all incl ctr (count) |
first make new stack frame& save all registers in it mflr link stw LinkageArea savedPC (SP) |
rcv_arg set arg0 entry_point_arg set arg1 arg1_arg set arg2 outgoing_arg_count set fr_size set ((LinkageArea.size+(outgoing_arg_count+NumGlobalNonVolRegisters)*size_of_gpr)+ 15) |
save PC link (pc to return to) |
save global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr stswi NumGlobalNonVolRegisters* size_of_gpr load_global_nonvol_regs stwu fr_size (SP) |
placeholder for StaticNormalLookupType LinkageArea savedSP (sp) |
continue with capt_NLR_regs (RTOC) |
and back to caller (which is C code) |
I pass args to C (SendMessage) |
I save args for the send here (DUPLICATED in runtime. h) volatile |
Copyright Sun Microsystems |
Copyright Sun Inc and Stanford University |
See the LICENSE file for license information |
Written for the MPW assembler include asmDefs_ppc h start_exported_func currentFrame mr r3 |
Written for the MPW assembler include asmDefs_ppc h start_exported_func currentFrame mr sp blr start_exported_func currentRTOC mr r3 |
Written for the MPW assembler include asmDefs_ppc h start_exported_func currentFrame mr sp blr start_exported_func currentRTOC mr RTOC blr start_exported_func currentReturnAddr lwz r3 |
relies on C not save arg1 in stack frame stw r3 |
arg area is right after linkage area blr |
savedFPR record ds b size_of_fpr endr allNVFPRs record |
savedFPR record ds b size_of_fpr endr allNVFPRs decr base set* sf31 ds savedFPR sf30 ds savedFPR sf29 ds savedFPR sf28 ds savedFPR sf27 ds savedFPR sf26 ds savedFPR sf25 ds savedFPR sf24 ds savedFPR sf23 ds savedFPR sf22 ds savedFPR sf21 ds savedFPR sf20 ds savedFPR sf19 ds savedFPR sf18 ds savedFPR sf17 ds savedFPR sf16 ds savedFPR sf15 ds savedFPR sf14 ds savedFPR endr |
local def |
make new stack frame& save all registers in it |
clear semaphore |
clear restore regs& return to return addr |
else setup new stack fp |
else setup new stack sp starting at calleeSaveAddr[0] |
clear semaphore |
clear jump to calleeSaveAddr [1] locals_for_sf record endr FrameTop record |
clear jump to calleeSaveAddr [1] locals_for_sf record endr FrameTop decr |
downwards to align more easily |
assume qw alignment fprs ds allNVFPRs align |
for stm gprs ds l HighestNonVolReg LowestNonVolReg lcls ds locals_for_sf size equ* endr Frame record |
assume qw alignment bot ds LinkageArea ds b FrameTop align top equ* size equ* endr |
process switch primitive |
NOTE ASSUMES switching within same code segment |
in other words |
in other although I save and restore the RTOC |
in other although I save and restore the I |
do not set the new RTOC |
next bit inspired by MPW PPC ASM manual |
next bit inspired by MPW PPC ASM pg |
must save restore nonvol regs |
must save restore nonvol FR14 and up |
must save restore nonvol FR14 and and parts of CR |
if asserts |
if should also zero out all others |
fpscr fp status& control reg |
first make new stack frame& save all registers in it mflr link stw link |
save PC link mflr r0 stw r0 |
save global nonvols for C subi Temp1 |
save global nonvols for C subi SP |
save global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr stswi LowestNonVolReg |
save global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr stswi Temp1 |
save global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr stswi NumGlobalNonVolRegisters* size_of_gpr load_global_nonvol_regs stwu SP |
call Self mtlr entry_point_arg |
dont need to move rcv mr arg1 |
dont need to move rcv mr arg1_arg |
Inline cache format |
Inline cache ReturnTrap blrl |
go |
cache fsfrp |
reg mask b contNLR dc l |
placeholder for nmlns dc l |
placeholder for nmlns dc l |
placeholder for selector dc l |
placeholder for StaticNormalLookupType fsfsde |
restore global nonvols for C subi Temp1 |
restore global nonvols for C subi SP |
restore global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr lswi LowestNonVolReg |
restore global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr lswi Temp1 |
restore global nonvols for C subi NumGlobalNonVolRegisters* size_of_gpr lswi NumGlobalNonVolRegisters* size_of_gpr lwz r0 |
continue with NLR |
don t need this because they are already in the right registers |
mr arg0 |
mr NLRResultReg |
mr arg1 |
mr NLRHomeReg |
mr arg2 |
mr NLRHomeIDReg blrl |
restore stack& regs |
SendMessage_stub |
post call |
post pre frame |
NonVols |
This routine goes via SaveSelfNonVolRegs because it calls out to C and C |
If that routine finds a frame for this stub |
If that routine finds a frame for this it can assume that all nonvols are stored |
below its SP import_func SendMessage |
below its SP import_func sm_C_func export SendMessage_stub_returnPC |
for stack walking num_outgoing_args |