|
struct stack {
u32 irq[3];
u32 abt[3];
u32 und[3];
} ____cacheline_aligned;
static struct stack stacks[NR_CPUS];
.........
unsigned int cpu = smp_processor_id();
struct stack *stk = &stacks[cpu];
__asm__ (
"msr cpsr_c, %1\n\t"
"add sp, %0, %2\n\t"
"msr cpsr_c, %3\n\t"
"add sp, %0, %4\n\t"
"msr cpsr_c, %5\n\t"
"add sp, %0, %6\n\t"
"msr cpsr_c, %7"
:
: "r" (stk),
"I" (PSR_F_BIT | PSR_I_BIT | IRQ_MODE),
"I" (offsetof(struct stack, irq[0])),
"I" (PSR_F_BIT | PSR_I_BIT | ABT_MODE),
"I" (offsetof(struct stack, abt[0])),
"I" (PSR_F_BIT | PSR_I_BIT | UND_MODE),
"I" (offsetof(struct stack, und[0])),
"I" (PSR_F_BIT | PSR_I_BIT | SVC_MODE)
: "r14");
u32 irq[3];
u32 abt[3];
u32 und[3];
这里好像是把&stacks->irq[0]\&stacks->abt[0]\&stacks->und[0]\赋给了sp。。
还是我没有看懂代码???
"r" (stk),它不就是stacks结构体的起始地址吗?
有人说 这个是堆栈的起始地址。。。这样一来那堆栈才12个bytes 。也不够用啊。。
没想明白!
求解 |
|