mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-24 23:32:06 +00:00
b86da1d406
This prevents crashes when calling a struct-returning function triggers a LoadSeg (the address for the returned struct is passed via A0)
40 lines
813 B
ArmAsm
40 lines
813 B
ArmAsm
.text
|
|
.globl PATCHEDLOADSEG
|
|
|
|
PATCHEDLOADSEG:
|
|
|
|
# Stack on Entry:
|
|
# (arguments for function)
|
|
# (return address)
|
|
# (return address from trap (== address in jt entry))
|
|
movem.l %a0-%a1/%d0-%d2, -(%sp)
|
|
subq #4, %sp
|
|
move.l 24(%sp), -(%sp)
|
|
|
|
# Stack now:
|
|
# (arguments for function)
|
|
# (return address)
|
|
# (don't care any more -- address in jt entry)
|
|
# (saved registers)
|
|
# (4 bvtes of space for return value)
|
|
# (address in jt entry)
|
|
|
|
jsr RETRO68LOADSEGMENT
|
|
|
|
# Stack now:
|
|
# (arguments for function)
|
|
# (return address)
|
|
# (don't care -- address in jt entry)
|
|
# (saved registers)
|
|
# (address of loaded function)
|
|
|
|
move.l (%sp)+, 20(%sp)
|
|
movem.l (%sp)+, %a0-%a1/%d0-%d2
|
|
|
|
# Stack now:
|
|
# (arguments for function)
|
|
# (return address)
|
|
# (address of loaded function)
|
|
|
|
rts
|