Files
jens 21fa0293d6 - removed call to dbg_init()
- added call to libsys_init() which calls dbg_init(). libsys_init()  is in libsys.c
Committed on the Free edition of March Hare Software CVSNT Server.
Upgrade to CVS Suite for more features and support:
http://march-hare.com/cvsnt/


git-svn-id: http://moon:8086/svn/vhdl/trunk@636 cc03376c-175c-47c8-b038-4cd826a8556b
2009-11-08 13:03:06 +00:00

88 lines
1.2 KiB
ArmAsm

.file "startup.S"
.section .rodata
.data
argv0: .asciz "\"This-MIPS-program\""
argv: .word argv0
.text
.section .start, "ax"
.extern _init
.extern libsys_init
.extern _exc_vect_start
.extern _xcpt_handler
.align 2
.globl _start
_start:
.set noreorder
j init
nop
.set reorder
.text
.set noreorder
init:
# Set stack pointer
la $sp, stack_ptr
# Set global pointer
la $gp, _gp
# zero bss
la $8, __bss_start
la $9, _end
$zeroise:
sw $0, 0($8)
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
# Call _init
la $k0, _init
jalr $k0
nop
# Call libsys_init
la $k0, libsys_init
jalr $k0
nop
# Set user-mode
mfc0 $a0, $12
li $a1, 3
or $a0, $a1
mtc0 $a0, $12
# Set environment
li $a0, 1
la $a1, argv
# Call main
la $k0, main
jalr $k0
nop
# Terminate after main returns
_terminate:
nop
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