xv6_chapter2 Operating system organization
2.6 Code: starting xv6, the first process and system call 启动代码: entry.S 为每个CPU设置堆栈,然后跳进start.c的start函数。 # qemu -kernel loads the kernel at 0x80000000 # and causes each CPU to jump there. # kernel.ld causes the following code to # be placed at 0x80000000. .section .text .global _entry _entry: # set up a stack for C. # stack0 is declared in start.c, # with a 4096-byte stack per CPU. # sp = stack0 + (hartid * 4096) la sp, stack0 li a0, 1024*4 csrr a1, mhartid # CPUs 0~7 has hartid from 0~7 addi a1, a1, 1 mul a0, a0, a1 add sp, sp, a0 # jump to start() in start....