调用c语言函数前,需要把sp指针设置到栈底,这样c函数里面压栈出栈才能正常使用
还有的会初始化BSS段
ldr x0, =Image$$EL3_STACKS$$ZI$$Limit 这里是取的链接器导出的符号,即栈地址
-
//
-
// That's the last of the control settings for now
-
//
-
// Note: no ISB after all these changes, as registers won't be
-
// accessed until after an exception return, which is itself a
-
// context synchronisation event
-
//
-
-
//
-
// Setup some EL3 stack space, ready for calling some subroutines, below.
-
//
-
// Stack space allocation is CPU-specific, so use CPU
-
// number already held in x19
-
//
-
// 2^12 bytes per CPU for the EL3 stacks
-
//
-
ldr x0, =Image$$EL3_STACKS$$ZI$$Limit
-
sub x0, x0, x19, lsl #12
-
mov sp, x0
-
-
//
-
// we need to configure the GIC while still in secure mode, specifically
-
// all PPIs and SPIs have to be programmed as Group1 interrupts
-
//
-
-
//
-
// Before the GIC can be reliably programmed, we need to
-
// enable Affinity Routing, as this affects where the configuration
-
// registers are (with Affinity Routing enabled, some registers are
-
// in the Redistributor, whereas those same registers are in the
-
// Distributor with Affinity Routing disabled (i.e. when in GICv2
-
// compatibility mode).
-
//
-
mov x0, #(1 << 4) | (1 << 5) // gicdctlr_ARE_S | gicdctlr_ARE_NS
-
mov x1, x19
-
bl SyncAREinGICD
阅读(1631) | 评论(0) | 转发(0) |