- 论坛徽章:
- 0
|
下面就我目前的应用分析一下: 注以下仅为芯片ZYNQ ZC702的相关信息,本人不确认是否适用于所有场景。
核
1: Kernel编译时可配置是否支持 SMP(CONFIG_SMP),若关闭此选项,系统按单核启动运行。
2: Kernel编译时可配置是否在线检测SMP(CONFIG_SMP_ON_UP),此选项用于KERNEL启动时是否在线检测为双核还是单核,若为获取芯片信息为单核,则进行__fixup_smp,因为编译生成的代码按双核编译,现判断为该芯片不支持双核,则将进行指令校正。下面代码为相关宏定义,用于指令校正。
3: 以上处理在arch\arm\kernel\head.S中完成。
4: 源码
http://git.xilinx.com/?p=linux-x ... 5c6b324b3a57632aa40
5: 还有Kernel判断是几核,是根据芯片提供的信息读取的,这个出错的可能性。。。- #ifdef CONFIG_SMP
- #define ALT_SMP(instr...) \
- 9998: instr
- /*
- * Note: if you get assembler errors from ALT_UP() when building with
- * CONFIG_THUMB2_KERNEL, you almost certainly need to use
- * ALT_SMP( W(instr) ... )
- */
- #define ALT_UP(instr...) \
- .pushsection ".alt.smp.init", "a" ;\
- .long 9998b ;\
- 9997: instr ;\
- .if . - 9997b != 4 ;\
- .error "ALT_UP() content must assemble to exactly 4 bytes";\
- .endif ;\
- .popsection
- #define ALT_UP_B(label) \
- .equ up_b_offset, label - 9998b ;\
- .pushsection ".alt.smp.init", "a" ;\
- .long 9998b ;\
- W(b) . + up_b_offset ;\
- .popsection
- #else
- #define ALT_SMP(instr...)
- #define ALT_UP(instr...) instr
- #define ALT_UP_B(label) b label
- #endif
复制代码 |
|