mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-22 01:15:26 +08:00
[fix][libcpu][riscv][t-head] fix rt_hw_interrupt_disable/rt_hw_interrupt_enable bug
使用不同的优化等级会出现不同的效果 当使用-O0 等级时,无法正确得到关闭中断之前的状态 Using different optimization levels will have different effects When the - o0 level is used, the state before the shutdown interrupt cannot be obtained correctly
This commit is contained in:
parent
3f3418d173
commit
7d07c61a47
@ -329,5 +329,22 @@ PendSV_Handler:
|
|||||||
.pendsv_exit:
|
.pendsv_exit:
|
||||||
mret
|
mret
|
||||||
|
|
||||||
|
/*
|
||||||
|
* rt_base_t rt_hw_interrupt_disable(void);
|
||||||
|
*/
|
||||||
|
.globl rt_hw_interrupt_disable
|
||||||
|
.type rt_hw_interrupt_disable, %function
|
||||||
|
rt_hw_interrupt_disable:
|
||||||
|
csrrci a0, mstatus, 8
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* void rt_hw_interrupt_enable(rt_base_t level);
|
||||||
|
*/
|
||||||
|
.globl rt_hw_interrupt_enable
|
||||||
|
.type rt_hw_interrupt_enable, %function
|
||||||
|
rt_hw_interrupt_enable:
|
||||||
|
csrw mstatus, a0
|
||||||
|
ret
|
||||||
|
|
||||||
|
@ -134,34 +134,6 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
|
|||||||
return stk;
|
return stk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function will disable global interrupt
|
|
||||||
*
|
|
||||||
* @param none
|
|
||||||
*
|
|
||||||
* @return zero
|
|
||||||
*/
|
|
||||||
|
|
||||||
rt_base_t rt_hw_interrupt_disable(void)
|
|
||||||
{
|
|
||||||
__asm volatile("csrrci a0, mstatus, 8");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function will ennable global interrupt
|
|
||||||
*
|
|
||||||
* @param level not used
|
|
||||||
*
|
|
||||||
* @return none
|
|
||||||
*/
|
|
||||||
/* XXX:rename rt_hw_interrupt_restore? */
|
|
||||||
void rt_hw_interrupt_enable(rt_base_t level)
|
|
||||||
{
|
|
||||||
__asm volatile("csrw mstatus, a0");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** shutdown CPU */
|
/** shutdown CPU */
|
||||||
RT_WEAK void rt_hw_cpu_shutdown()
|
RT_WEAK void rt_hw_cpu_shutdown()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user