OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [lib/] [source/] [neorv32_cpu.c] - Diff between revs 14 and 15

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 14 Rev 15
Line 236... Line 236...
    cnt--;
    cnt--;
  }
  }
}
}
 
 
 
 
 No newline at end of file
 No newline at end of file
 
/**********************************************************************//**
 
 * Switch from privilege mode MACHINE to privilege mode USER.
 
 *
 
 * @note This function requires the U extension to be implemented.
 
 **************************************************************************/
 
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
 
  asm volatile ("csrw mepc, ra");
 
  asm volatile ("mret");
 
}
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.