- call crt stuff correctly

git-svn-id: http://moon:8086/svn/mips@111 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2017-01-21 12:09:38 +00:00
parent ae41d3dc9e
commit 40fb6cfab8
2 changed files with 34 additions and 39 deletions
+6 -3
View File
@@ -1,10 +1,13 @@
#include <regdef.h>
#include <xcpt_asm.h>
.section .exc_vect
.text
.section .exc_vect, "ax"
.align 2
_xcpt_vector_tbl:
.fill 16, 4, 0
la k0, _xcpt_handler
jr k0
nop
.text
LEAF(_xcpt_handler)
+28 -36
View File
@@ -1,3 +1,4 @@
#include <regdef.h>
.file "startup.S"
.section .rodata
@@ -6,19 +7,27 @@ argv0: .asciz "\"This-MIPS-program\""
argv: .word argv0
.text
.section .init, "ax"
.extern board_init
.extern _exc_vect_start
.extern _xcpt_handler
.section .start, "ax"
.extern _init
.extern _bss_zero
.align 2
_start:
.set noreorder
# Set stack pointer
la $sp, stack_ptr
# Set global pointer
la $gp, _gp
_start:
la sp, stack_ptr
la gp, _gp
la ra, _bss_zero
j _init
nop
.text
.section .text, "ax"
.globl _bss_zero
.extern board_init
.align 2
.set noreorder
_bss_zero:
# zero bss
la $8, __bss_start
la $9, _end
@@ -27,43 +36,26 @@ $zeroise:
bne $8, $9, $zeroise
addiu $8, 4
# Install exception vector jump code
la $t1, _exc_vect_copy_start
la $t2, _exc_vect_copy_end
la $t0, _exc_vect_start
$install: lw $v0, 0($t1)
addiu $t1, 4
sw $v0, 0($t0)
bne $t1, $t2, $install
addiu $t0, 4
_init:
_board_init:
# Call board_init
la $k0, board_init
jalr $k0
la k0, board_init
jalr k0
nop
# Set environment
li $a0, 1
la $a1, argv
li a0, 1
la a1, argv
# Call main
la $k0, main
jalr $k0
la k0, main
jalr k0
nop
# Terminate after main returns
_terminate:
nop
la $t0, exit
jalr $t0
move $a0, $v0
la t0, exit
jalr t0
move a0, v0
_exc_vect_copy_start:
la $k0, _xcpt_handler
jr $k0
nop
_exc_vect_copy_end:
.set reorder