Chinaunix首页 | 论坛 | 博客
  • 博客访问: 305204
  • 博文数量: 65
  • 博客积分: 185
  • 博客等级: 入伍新兵
  • 技术积分: 609
  • 用 户 组: 普通用户
  • 注册时间: 2012-11-06 21:41
个人简介

好好学习,天天向上

文章分类

全部博文(65)

文章存档

2022年(3)

2021年(25)

2020年(1)

2019年(3)

2016年(2)

2015年(3)

2014年(14)

2013年(7)

2012年(7)

我的朋友

分类: C/C++

2021-06-26 16:39:16

调用c语言函数前,需要把sp指针设置到栈底,这样c函数里面压栈出栈才能正常使用
还有的会初始化BSS段

 ldr x0, =Image$$EL3_STACKS$$ZI$$Limit   这里是取的链接器导出的符号,即栈地址

点击(此处)折叠或打开

  1. //
  2.     // That's the last of the control settings for now
  3.     //
  4.     // Note: no ISB after all these changes, as registers won't be
  5.     // accessed until after an exception return, which is itself a
  6.     // context synchronisation event
  7.     //

  8.     //
  9.     // Setup some EL3 stack space, ready for calling some subroutines, below.
  10.     //
  11.     // Stack space allocation is CPU-specific, so use CPU
  12.     // number already held in x19
  13.     //
  14.     // 2^12 bytes per CPU for the EL3 stacks
  15.     //
  16.     ldr x0, =Image$$EL3_STACKS$$ZI$$Limit
  17.     sub x0, x0, x19, lsl #12
  18.     mov sp, x0

  19.     //
  20.     // we need to configure the GIC while still in secure mode, specifically
  21.     // all PPIs and SPIs have to be programmed as Group1 interrupts
  22.     //

  23.     //
  24.     // Before the GIC can be reliably programmed, we need to
  25.     // enable Affinity Routing, as this affects where the configuration
  26.     // registers are (with Affinity Routing enabled, some registers are
  27.     // in the Redistributor, whereas those same registers are in the
  28.     // Distributor with Affinity Routing disabled (i.e. when in GICv2
  29.     // compatibility mode).
  30.     //
  31.     mov x0, #(1 << 4) | (1 << 5) // gicdctlr_ARE_S | gicdctlr_ARE_NS
  32.     mov x1, x19
  33.     bl SyncAREinGICD

阅读(1631) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~