[arch][arm64] add routine to read the boot EL
This commit is contained in:
@@ -25,6 +25,9 @@
|
||||
|
||||
#define LOCAL_TRACE 0
|
||||
|
||||
/* Defined in start.S. */
|
||||
extern uint64_t arm64_boot_el;
|
||||
|
||||
// initial setup per cpu immediately after entering C code
|
||||
void arm64_early_init_percpu(void) {
|
||||
// set the vector base
|
||||
@@ -76,6 +79,12 @@ void arch_early_init(void) {
|
||||
// called after the kernel has been initialized and threading is enabled on the boot cpu
|
||||
void arch_init(void) {
|
||||
arm64_mp_init();
|
||||
|
||||
dprintf(INFO, "ARM64: boot EL%llu\n", arm64_get_boot_el());
|
||||
}
|
||||
|
||||
uint64_t arm64_get_boot_el(void) {
|
||||
return arm64_boot_el >> 2;
|
||||
}
|
||||
|
||||
void arch_quiesce(void) {
|
||||
|
||||
@@ -34,6 +34,8 @@ __BEGIN_CDECLS
|
||||
|
||||
void arm64_context_switch(vaddr_t *old_sp, vaddr_t new_sp);
|
||||
|
||||
uint64_t arm64_get_boot_el(void);
|
||||
|
||||
/* exception handling */
|
||||
struct arm64_iframe_long {
|
||||
uint64_t r[30];
|
||||
@@ -81,5 +83,14 @@ void arm64_local_invalidate_cache_all(void);
|
||||
void arm64_local_clean_invalidate_cache_all(void);
|
||||
void arm64_local_clean_cache_all(void);
|
||||
|
||||
/* Current Exception Level values, as contained in CurrentEL */
|
||||
#define CurrentEL_EL1 (1 << 2)
|
||||
#define CurrentEL_EL2 (2 << 2)
|
||||
|
||||
static inline bool arm64_is_kernel_in_hyp_mode(void) {
|
||||
return ARM64_READ_SYSREG(CURRENTEL) == CurrentEL_EL2;
|
||||
}
|
||||
|
||||
|
||||
__END_CDECLS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user