2016-11-08 20:22:09 +00:00
|
|
|
! boot.s for osxppc
|
2016-10-02 18:58:05 +00:00
|
|
|
|
|
|
|
! Declare segments (the order is important).
|
|
|
|
|
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
|
|
|
|
|
|
|
.sect .text
|
|
|
|
|
|
|
|
begtext:
|
|
|
|
! This code is placed at the entry point of the Mach-o
|
|
|
|
! executable and is the first thing that runs.
|
|
|
|
!
|
|
|
|
! On entry, the stack looks like this:
|
|
|
|
!
|
|
|
|
! sp+... NULL
|
|
|
|
! sp+8+(4*argc) env (X quads)
|
|
|
|
! sp+4+(4*argc) NULL
|
|
|
|
! sp+4 argv (argc quads)
|
|
|
|
! sp argc
|
|
|
|
!
|
|
|
|
! The ACK actually expects:
|
|
|
|
!
|
|
|
|
! sp+8 argc
|
|
|
|
! sp+4 ptr to argv
|
|
|
|
! sp ptr to env
|
|
|
|
|
|
|
|
lwz r3, 0(sp) ! r3 = argc
|
|
|
|
addi r4, sp, 4 ! r4 = argv
|
|
|
|
rlwinm r5, r3, 32-2, 2, 31 ! shift left 2 bits
|
2016-11-08 20:22:09 +00:00
|
|
|
add r5, r5, r4
|
2016-10-02 18:58:05 +00:00
|
|
|
addi r5, r5, 8 ! r5 = env
|
2016-11-08 20:22:09 +00:00
|
|
|
|
2016-10-02 18:58:05 +00:00
|
|
|
stwu r5, -4(sp)
|
|
|
|
stwu r4, -4(sp)
|
|
|
|
stwu r3, -4(sp)
|
2016-11-08 20:22:09 +00:00
|
|
|
|
2016-10-02 18:58:05 +00:00
|
|
|
b __m_a_i_n
|
|
|
|
|
2016-11-20 00:23:42 +00:00
|
|
|
.sect .rom
|
2016-10-02 18:58:05 +00:00
|
|
|
begrom:
|
|
|
|
|
|
|
|
.sect .data
|
|
|
|
begdata:
|
|
|
|
|
|
|
|
! Some magic data. All EM systems need these.
|
|
|
|
|
|
|
|
.sect .bss
|
|
|
|
begbss:
|
|
|
|
.define hol0
|
|
|
|
.comm hol0, 8 ! line number and filename (for debugging)
|
|
|
|
|
|
|
|
.define _errno
|
|
|
|
.comm _errno, 4 ! Posix errno storage
|
|
|
|
|
|
|
|
.define .trppc, .ignmask
|
|
|
|
.comm .trppc, 4 ! ptr to user trap handler
|
2016-11-08 20:22:09 +00:00
|
|
|
.comm .ignmask, 4 ! user trap ignore mask
|