Add spsr_el3 to cpu_context

This commit is contained in:
TuxSH 2018-03-11 12:53:52 +01:00
parent f624cccd0d
commit 52f7adfc50
5 changed files with 27 additions and 16 deletions

View file

@ -21,6 +21,8 @@
#define ALINLINE __attribute__((always_inline))
#define SET_SYSREG(reg, val) do { temp_reg = (val); __asm__ __volatile__ ("msr " #reg ", %0" :: "r"(temp_reg) : "memory"); } while(false)
/* Custom stuff below */
/* For warmboot (and coldboot crt0) */
@ -110,6 +112,12 @@ static inline uint64_t get_debug_authentication_status(void) {
return debug_auth;
}
static inline uint32_t get_spsr(void) {
uint32_t spsr;
__asm__ __volatile__ ("mrs %0, spsr_el3" : "=r"(spsr));
return spsr;
}
static inline bool check_32bit_additive_overflow(uint32_t a, uint32_t b) {
return __builtin_add_overflow_p(a, b, (uint32_t)0);
}