mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 01:22:39 +02:00
MIPS startup code:
- Removed tabs. - Removed nonsense code involving $s7. + Call finalization procedure in the end, fixes webtbs/tw9089. + added non-executable stack marker. git-svn-id: trunk@23842 -
This commit is contained in:
parent
adfecc8173
commit
0a155e3ae1
@ -12,7 +12,7 @@
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
.set noat
|
||||
|
||||
.set noreorder
|
||||
.section ".text"
|
||||
|
||||
.align 4
|
||||
@ -20,11 +20,9 @@
|
||||
.ent _dynamic_start
|
||||
.type _dynamic_start,@function
|
||||
_dynamic_start:
|
||||
/* TODO: check whether this code is correct */
|
||||
lui $a2,%hi(__dl_fini)
|
||||
sw $v0,%lo(__dl_fini)($a2)
|
||||
b _start
|
||||
nop
|
||||
sw $v0,%lo(__dl_fini)($a2)
|
||||
|
||||
.end _dynamic_start
|
||||
.size _dynamic_start, .-_dynamic_start
|
||||
@ -46,7 +44,7 @@ _dynamic_start:
|
||||
|
||||
...
|
||||
(4*argc)(%sp) NULL
|
||||
(4*(argc+1))(%sp) envp[0]
|
||||
4*(argc+1))(%sp) envp[0]
|
||||
...
|
||||
NULL
|
||||
ra ($31) Return address set to zero.
|
||||
@ -63,12 +61,6 @@ _start:
|
||||
|
||||
addiu $sp,$sp,-32
|
||||
|
||||
lui $s7,0x3d
|
||||
addiu $s7,$s7,2304
|
||||
li $at,-8
|
||||
and $s7,$s7,$at
|
||||
addiu $s7,$s7,-32
|
||||
|
||||
/* store argc */
|
||||
lw $a0,0($s8)
|
||||
lui $a1,%hi(operatingsystem_parameter_argc)
|
||||
@ -99,11 +91,19 @@ _start:
|
||||
.ent _haltproc
|
||||
.type _haltproc,@function
|
||||
_haltproc:
|
||||
/* TODO: need to check whether __dl_fini is non-zero and call the function pointer in case */
|
||||
|
||||
addiu $sp,$sp,-24
|
||||
sw $a0,16($sp) /* $a0 contains the exitcode */
|
||||
lui $at,%hi(__dl_fini)
|
||||
lw $t9,%lo(__dl_fini)($at)
|
||||
beqz $t9,.L1
|
||||
nop
|
||||
jalr $t9
|
||||
.L1:
|
||||
lw $a0,16($sp)
|
||||
li $v0,4001
|
||||
syscall
|
||||
b _haltproc
|
||||
nop
|
||||
b .L1
|
||||
nop
|
||||
|
||||
.end _haltproc
|
||||
@ -116,3 +116,4 @@ _haltproc:
|
||||
.comm operatingsystem_parameter_argc,4
|
||||
.comm operatingsystem_parameter_argv,4
|
||||
|
||||
.section .note.GNU-stack,"",@progbits
|
||||
|
Loading…
Reference in New Issue
Block a user