kernel/entry.S

21 lines
1        # qemu -kernel loads the kernel at 0x800000002        # and causes each hart (i.e. CPU) to jump there.3        # kernel.ld causes the following code to4        # be placed at 0x80000000.5.section .text6.global _entry7_entry:8        # set up a stack for C.9        # stack0 is declared in start.c,10        # with a 4096-byte stack per CPU.11        # sp = stack0 + ((hartid + 1) * 4096)12        la sp, stack013        li a0, 1024*414        csrr a1, mhartid15        addi a1, a1, 116        mul a0, a0, a117        add sp, sp, a018        # jump to start() in start.c19        call start20spin:21        j spin22