From 598b964ee3c1fab162bfc85fa3725501ab238881 Mon Sep 17 00:00:00 2001 From: stefan Date: Fri, 31 Mar 2023 18:41:36 -0400 Subject: entry.s and kernel.ld --- kernel/boot/entry.S | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 kernel/boot/entry.S (limited to 'kernel/boot/entry.S') diff --git a/kernel/boot/entry.S b/kernel/boot/entry.S new file mode 100644 index 0000000..4c977a3 --- /dev/null +++ b/kernel/boot/entry.S @@ -0,0 +1,36 @@ +.section .text.init + +.globl _start +_start: + csrw satp, zero + csrw sie, zero + csrw sip, zero + + .option push + .option norelax + la gp, __global_pointer$ + .option pop + + la sp, __stack_start + mv t0, a0 + li t1, PAGE_SIZE + mul t0, t0, t1 + add sp, sp, t0 + + li a2, 1 + lla a3, _boot_hart + amoswap.w, a3, a2, (a3) + bnez a3, mp_entry + + la a2, __bss_start + la a3, __bss_end +1: + sd zero, (a2) + addi a2, a2, __SIZEOF_POINTER__ + blt a2, a3, 1b + + call boot + +_boot_hart: + .dword 0 + -- cgit v1.2.3