asm疑问

qq_18310569 2018-04-10 04:48:49
// Reset handler stores the address of op code start. The address is offset by 1 because
// it is meant to be used with the BX instruction. BX instruction requires bit[0] of the
// register providing address to branch to be set to 1 for correct execution.
register uint32_t opcode_reset = *((uint32_t *)OPCODE_RESET_ADDRESS);
asm("BX %[reg]" : : [reg] "r" (opcode_reset));
while(1); //end bootloader
return 0;



请问这一句:asm("BX %[reg]" : : [reg] "r" (opcode_reset)); 是什么意思?
...全文
557 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
就是把存储opcode_reset的那个寄存器替换BX %[reg]中的reg,比如分配的是r0,那么生成的指令就是bx %r0 (gas默认的at&t语法)。
C++实习生 2018-04-11
  • 打赏
  • 举报
回复
这不是汇编语法吧。

21,458

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧