快乐虾http://blog.csdn.net/lights_joy/lights@hb165.com本文适用于ADI bf561 DSP优视BF561EVB开发板uclinux-2008r1.5-rc3(smp patch)Visual DSP++ 5.0(update 5)欢迎转载,但请保留作者信息在每个核初始化的时候,都将调用一个叫init_pda的函数,用以初始化每个核的私有数据区:asmlinkage void init_pda(void){unsignedint cpu = raw_smp_processor_id();/* Initialize the PDA fields holding references to other partsof the memory. The content of such memory is stillundefined at the time of the call, we are only setting upvalid pointers to it. */memset(cpu_pda, 0, sizeof(*cpu_pda));#ifdef CONFIG_MPU#elsewrite_pda(ipdt, ipdt_tables[cpu]);#ifdef CONFIG_CPLB_INFOwrite_pda(ipdt_swapcount, ipdt_swapcount_tables[cpu]);write_pda(dpdt_swapcount, dpdt_swapcount_tables[cpu]);#endifwrite_pda(dpdt, dpdt_tables[cpu]);#endifwrite_pda(ex_stack, exception_stacks[cpu + 1]);#ifdef CONFIG_SMPwrite_pda(imask, 0x1f);#endif}在这里,exception_stacks是一个比较特殊的数组,说它特殊,是因为它的定义放在了linux-2.6.x/arch/blackfin/mach-common/entry.S中,且对移植造成了一定的困扰:ENTRY(_exception_stacks).rept 1024*NR_CPUS.long 0;.endr_exception_stack_top:Vdsp的汇编器是不支持.rept的,因此将这段代码改为:.global _exception_stacks;.byte4 _exception_stacks[1024*NR_CPUS] = {0};_exception_stack_top:当然,这样会造成一个警告:[Warning ea1049] "../../linux-2.6.x/arch/blackfin/mach-common/entry.S":1445 Too few initializers specified.Expected 2048 but found 1 for "_exception_stacks".The remaining 2047 elements were initialized to zero.本来就是要把这些元素置0的,所以略过这个警告。