mirror of
https://github.com/stnolting/neorv32.git
synced 2025-04-23 21:57:33 -04:00
fixed error in goto_user_mode function
This commit is contained in:
parent
b034d734dd
commit
e1fac4d070
1 changed files with 2 additions and 3 deletions
|
@ -242,15 +242,14 @@ void neorv32_cpu_delay_ms(uint32_t time_ms) {
|
|||
* Switch from privilege mode MACHINE to privilege mode USER.
|
||||
*
|
||||
* @note This function requires the U extension to be implemented.
|
||||
* @note Maybe you should do a fencei after this.
|
||||
* @note Maybe you should do a fence.i after this.
|
||||
**************************************************************************/
|
||||
void __attribute__((naked)) neorv32_cpu_goto_user_mode(void) {
|
||||
|
||||
register uint32_t mask = (1<<CPU_MSTATUS_MPP_H) | (1<<CPU_MSTATUS_MPP_L);
|
||||
mask = ~mask;
|
||||
asm volatile ("csrrc zero, mstatus, %[input_j]" : : [input_j] "r" (mask));
|
||||
|
||||
// return and switch to user mode
|
||||
// return switching to user mode
|
||||
asm volatile ("csrw mepc, ra");
|
||||
asm volatile ("mret");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue