Cortex-M3的堆栈增长方式

[复制链接]
5613|5
 楼主| 礦ision 发表于 2009-9-3 21:49 | 显示全部楼层 |阅读模式
Cortex-M3的堆栈增长方式是从上往下,也就是从高地址往低地址,即push psw后sp会减1.
请问这是从哪里得出来的?我在Cortex-M3的参考手册里没有找到源头
mytempid 发表于 2009-9-4 12:37 | 显示全部楼层
堆栈增长方式可以从上往下或从下往上两种方式
记得汇编指令里有向上或向下增长两条指令
arm_fan168 发表于 2009-9-4 15:23 | 显示全部楼层
本帖最后由 arm_fan168 于 2009-9-4 15:30 编辑

arm架构的push和pop执行的是满减堆栈,可参考<ARM架构参考手册>
IJK 发表于 2009-9-4 16:28 | 显示全部楼层
Cortex-M3的堆栈增长方式 可以参考 ARM v7-M Architecture Application Level Reference Manual。

Cortex-A的堆栈增长方式,在芯片设计时是可以设置的:从上往下,从下往上,或同时支持 从上往下+从下往上 (又软件来设置)。

下面一段是  ARM v7-M 中PUSH的相关操作:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
originalSP = SP;
address = SP - 4*BitCount(registers);
SP = SP - 4*BitCount(registers);
for i = 0 to 14
if registers<i> == '1' then
MemA[address,4] = R[i];
address = address + 4;
assert address == originalSP;
 楼主| 礦ision 发表于 2009-9-8 10:58 | 显示全部楼层
谢谢楼上的兄弟

ARM v7-M Architecture Application Level Reference Manual
的B1-12发现这句话:
A full-descending stack format is used, where the stack pointer is decremented immediately before storing a 32-bit word (when pushing context) onto the stack, and incremented after reading a 32-bit word (poppingcontext) from the stack.
一般首席 发表于 2014-3-8 09:22 | 显示全部楼层
学习了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

17

主题

66

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部