Skip to content
Discussion options

You must be logged in to vote

找到了对宏定义的理解不深刻,本质是符号替换,在汇编中不应该使用语言方式去理解
libcpu/aarch64/common/context_gcc.S

#ifdef RT_USING_SMP
#define rt_hw_interrupt_disable rt_hw_local_irq_disable
#define rt_hw_interrupt_enable rt_hw_local_irq_enable
#endif

.text
/*
 * rt_base_t rt_hw_interrupt_disable();
 */
.globl rt_hw_interrupt_disable
rt_hw_interrupt_disable:
    MRS      X0, DAIF
    MSR      DAIFSet, #3
    DSB      SY
    RET

在编译时汇编文件中的rt_hw_interrupt_disable符号会被rt_hw_local_irq_disable替换掉,这样rt_hw_interrupt_disable定义的汇编代码在编译后的函数名字为rt_hw_local_irq_disable。

使用xxd查看context_gcc.o可以印证

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by aozima
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant