forked from 10RE/VE470_Superscalar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrt.s
55 lines (53 loc) · 726 Bytes
/
crt.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#####################################
# crt.s
# C Runtime setup for our environment
# allocates the stack pointer
# initializes all registers
# provide a simpler exit() function
# - Jielun Tan, 02/2019
####################################
.global crt
.section .text.prologue, "ax"
.align 4
crt:
nop
la ra, exit
la sp, _sp
mv s0, sp
la gp, __global_pointer$
li tp, 0
li t0, 0
li t1, 0
li t2, 0
li s1, 0
li a0, 0
li a1, 0
li a2, 0
li a3, 0
li a4, 0
li a5, 0
li a6, 0
li a7, 0
li s2, 0
li s3, 0
li s4, 0
li s5, 0
li s6, 0
li s7, 0
li s8, 0
li s9, 0
li s10, 0
li s11, 0
li t3, 0
li t4, 0
li t5, 0
li t6, 0
j main
.global exit
.section .text
.align 4
exit:
la sp, _sp
sw a0, -8(sp)
nop
wfi