多核移植时rt_hw_local_irq_disable函数是要bsp实现吗 #10803
Answered
by
piterzhang
piterzhang
asked this question in
Q&A
-
多核移植时以邮箱为例 level = rt_hw_interrupt_disable();
/*include/rthw.h/
#define rt_hw_interrupt_disable rt_cpus_lock
rt_cpus_lock
level = rt_hw_local_irq_disable(); 这里的rt_hw_local_irq_disable函数并没有定义,搜索整个代码仓库也没有发现定义的地方。 |
Beta Was this translation helpful? Give feedback.
Answered by
piterzhang
Oct 13, 2025
Replies: 1 comment
-
找到了对宏定义的理解不深刻,本质是符号替换,在汇编中不应该使用语言方式去理解 #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可以印证 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
aozima
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
找到了对宏定义的理解不深刻,本质是符号替换,在汇编中不应该使用语言方式去理解
libcpu/aarch64/common/context_gcc.S
在编译时汇编文件中的rt_hw_interrupt_disable符号会被rt_hw_local_irq_disable替换掉,这样rt_hw_interrupt_disable定义的汇编代码在编译后的函数名字为rt_hw_local_irq_disable。
使用xxd查看context_gcc.o可以印证