summaryrefslogtreecommitdiff
path: root/sys/kern/entry.S
diff options
context:
space:
mode:
authorstefan <stefan@s00.xyz>2023-04-19 20:50:10 -0400
committerstefan <stefan@s00.xyz>2023-04-19 20:50:10 -0400
commit83e17e29456ec9b6d45f4d9f2634eb280c6f414f (patch)
tree004a9b2a7cd3f0c7bb4224b59204680bd5d79681 /sys/kern/entry.S
parentaf1ce4b2e637ceb418ea72d51c49a3eee276a938 (diff)
downloadsv-83e17e29456ec9b6d45f4d9f2634eb280c6f414f.tar.gz
ticket locks
Diffstat (limited to 'sys/kern/entry.S')
-rw-r--r--sys/kern/entry.S69
1 files changed, 0 insertions, 69 deletions
diff --git a/sys/kern/entry.S b/sys/kern/entry.S
deleted file mode 100644
index 9bf72ea..0000000
--- a/sys/kern/entry.S
+++ /dev/null
@@ -1,69 +0,0 @@
-.section ".text.init"
-
-// entrypoint for boot hart(s). a0: hartid, a1: *fdt
-.globl _start
-
-
-// entrypoint for other harts. a0: hartid, a1: unused for now
-.global _mpentry
-
-_start:
- /* disable interrupts and paging */
- csrw satp, zero
- csrw sie, zero
- csrw sip, zero
-
- .option push
- .option norelax
- la gp, __global_pointer$
- .option pop
-
- /* setup stack.
- * stack grows toward lower address so sp will mark end of frame.
- */
- addi t0, a0, 1
- li t1, PAGE_SIZE
- la sp, __stack_start
- mul t1, t1, t0
- add sp, sp, t1
-
- /* setup thread pointer */
- mv tp, a0
-
- /* the label _boot_hart is shared between threads. after the first atomic swap, all other harts will branch to mpentry */
- li a2, 1
- lla a3, _boot_hart
- amoswap.w a3, a2, (a3)
- bnez a3, _mpentry
-
- /* clear the bss section */
- la a2, __bss_start
- la a3, __bss_end
-1:
- sd zero, (a2)
- addi a2, a2, __SIZEOF_POINTER__
- blt a2, a3, 1b
-2:
- call init
- j _spin
-
-_mpentry:
- /* satp = 0, sstatus.sie = 0, a0 = hartid, a1 = opaque */
-
- call mpinit
- /* shouldn't reach this point */
- j _spin
-
-_spin:
- wfi
- j _spin
-
-.section ".data"
-_boot_hart:
- .word 0
-
-.section ".rodata"
-/* linker imports */
-.globl HEAP_START
-HEAP_START: .dword __heap_start
-