aboutsummaryrefslogtreecommitdiff
path: root/src/arch/riscv64/boot/entry.S
blob: f5fa0921e57405debeb8a174dbb2ff2c9edd9ba6 (plain)
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
.section .init

.option norvc

.type start, @function
.global start
start:
	.cfi_startproc

.option push
.option norelax
	la gp, global_pointer
.option pop

	/* Reset satp */
	csrw satp, zero

	/* Setup stack */
	la sp, stack_top

	/* Clear the BSS section */
	la t5, bss_start
	la t6, bss_end
bss_clear:
	sd zero, (t5)
	addi t5, t5, 8
	bltu t5, t6, bss_clear

	la t0, kernel_main
	csrw sepc, t0

	/* Jump to kernel! */
	tail kernel_main

	.cfi_endproc

.end