- 论坛徽章:
- 13
|
本帖最后由 _nosay 于 2016-04-01 11:05 编辑
回复 4# nswcfd
还发现了一点“r_base = .”与“r_here:”的区别,r_base类似“局部标号”,fun1()、fun2()都可以有“r_base = .”,页r_here类似“全局标号”,fun1()、fun2()如果都有“r_here:”,编译会报错,说r_here重复定义。
BP负责将trampoline.S(trampoline_data标号处)的代码设置到一个中断向量上,用于AP在处理IPI中断时过渡到保护模式,BP自己好像不执行这段代码,那BP是怎么过渡到保护模式的?- void __init smp_boot_cpus(void)
- {
- ...
- for (apicid = 0; apicid < NR_CPUS; apicid++) {
- /*
- * Don't even attempt to start the boot CPU!
- */
- if (apicid == boot_cpu_id) // 引导CPU跳过
- continue;
- if (!(phys_cpu_present_map & (1 << apicid)))
- continue;
- if ((max_cpus >= 0) && (max_cpus <= cpucount+1))
- continue;
- do_boot_cpu(apicid); // 这里面会执行trampoline.S代码
- /*
- * Make sure we unmap all failed CPUs
- */
- if ((x86_apicid_to_cpu[apicid] == -1) &&
- (phys_cpu_present_map & (1 << apicid)))
- printk("phys CPU #%d not responding - cannot use it.\n",apicid);
- }
- ...
- }
复制代码 setup.S里面发现:- start:
- jmp trampoline
- ...
- trampoline: call start_of_setup
- ...
- start_of_setup:
- # 一大堆代码,看不懂
复制代码 |
|