- 论坛徽章:
- 0
|
在x86/kernel/head_32.S中:
movl $(__KERNEL_PERCPU), %eax
movl %eax,%fs
而__KERNEL_PERCPU是per-CPU GDT的一项:
* ------- start of kernel segments:
*
* 12 - kernel code segment <==== new cacheline
* 13 - kernel data segment
* 14 - default user CS
* 15 - default user DS
* 16 - TSS
* 17 - LDT
* 18 - PNPBIOS support (16->32 gate)
* 19 - PNPBIOS support
* 20 - PNPBIOS support
* 21 - PNPBIOS support
* 22 - PNPBIOS support
* 23 - APM BIOS support
* 24 - APM BIOS support
* 25 - APM BIOS support
*
* 26 - ESPFIX small SS
* 27 - per-cpu [ offset to per-cpu data area ]
* 28 - stack_canary-20 [ for stack protector ]
* 29 - unused
* 30 - unused
* 31 - TSS for double fault handler
在BP运行时,这个27项,也就是per-cpu项中的值,是如何设置的呢?
因为在start_kernel的开始调用boot_cpu_init的时候,就会调用smp_processor_id了,这里面会使用%%fs:cpu_number来获取cpu id。。。
那说明这个fs在之前肯定需要设置妥当!
有人帮忙解答下这个问题吗? |
|