root/kernel/entry.S

/* [<][>][^][v][top][bottom][index][help] */
   1         # qemu -kernel loads the kernel at 0x80000000
   2         # and causes each hart (i.e. CPU) to jump there.
   3         # kernel.ld causes the following code to
   4         # be placed at 0x80000000.
   5 .section .text
   6 .global _entry
   7 _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 * 4096)
  12         la sp, stack0
  13         li a0, 1024*4
  14         csrr a1, mhartid
  15         addi a1, a1, 1
  16         mul a0, a0, a1
  17         add sp, sp, a0
  18         # jump to start() in start.c
  19         call start
  20 spin:
  21         j spin

/* [<][>][^][v][top][bottom][index][help] */