Make the MIPS boot code produce correct code.

This commit is contained in:
David Given 2018-09-18 23:39:04 +02:00
parent d23d2dd1b3
commit 9333b323a5

View file

@ -8,7 +8,8 @@
.sect .text .sect .text
begtext: .define .entry
.entry:
! This code is placed at the beginning of the ELF executable and is the ! This code is placed at the beginning of the ELF executable and is the
! first thing that runs. ! first thing that runs.
! !
@ -29,13 +30,13 @@ begtext:
lw r4, 0(sp) ! r4 = argc lw r4, 0(sp) ! r4 = argc
addiu r5, sp, 4 ! r5 = argv addiu r5, sp, 4 ! r5 = argv
sll r6, r4, 2 ! r6 = argc*4 sll r6, r4, 2 ! r6 = argc*4
addu r6, r6, r5 ! r6 = last arg addu r6, r6, r5 ! r6 = null after last arg
addiu r6, r6, 8 ! r6 = env addiu r6, r6, 4 ! r6 = env
addiu sp, sp, -3 * 4 addiu sp, sp, -3 * 4
sw r4, 0(sp) sw r4, 0(sp) ! argc
sw r5, 4(sp) sw r5, 4(sp) ! argv
sw r6, 8(sp) sw r6, 8(sp) ! envp
j __m_a_i_n j __m_a_i_n
nop nop