diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2016-07-01 00:05:33 +0200 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2016-07-04 15:55:56 +0200 |
commit | 19a9090164ef1e1b5e321d822a9213a2a6867f17 (patch) | |
tree | 2e7d4ddff804c412f7e3f8090e7d5d019beb1dc3 /c | |
parent | bsp/atsam: Add RTC driver (diff) | |
download | rtems-19a9090164ef1e1b5e321d822a9213a2a6867f17.tar.bz2 |
arm/score and shared: define ARM hypervisor mode and alternate vector table base access.
The main reason for inclusion of minimum hypervisor related defines
is that current ARM boards firmware and loaders (U-boot for example)
start loaded operating system kernel in HYP mode to allow it take
control of virtualization (Linux/KVM for example).
Diffstat (limited to 'c')
-rw-r--r-- | c/src/lib/libcpu/arm/shared/include/arm-cp15.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/c/src/lib/libcpu/arm/shared/include/arm-cp15.h b/c/src/lib/libcpu/arm/shared/include/arm-cp15.h index 4c1966d7ff..8357656bd8 100644 --- a/c/src/lib/libcpu/arm/shared/include/arm-cp15.h +++ b/c/src/lib/libcpu/arm/shared/include/arm-cp15.h @@ -1324,6 +1324,36 @@ arm_cp15_set_vector_base_address(void *base) ); } +ARM_CP15_TEXT_SECTION static inline void +*arm_cp15_get_hyp_vector_base_address(void) +{ + ARM_SWITCH_REGISTERS; + void *base; + + __asm__ volatile ( + ARM_SWITCH_TO_ARM + "mrc p15, 4, %[base], c12, c0, 0\n" + ARM_SWITCH_BACK + : [base] "=&r" (base) ARM_SWITCH_ADDITIONAL_OUTPUT + ); + + return base; +} + +ARM_CP15_TEXT_SECTION static inline void +arm_cp15_set_hyp_vector_base_address(void *base) +{ + ARM_SWITCH_REGISTERS; + + __asm__ volatile ( + ARM_SWITCH_TO_ARM + "mcr p15, 4, %[base], c12, c0, 0\n" + ARM_SWITCH_BACK + : ARM_SWITCH_OUTPUT + : [base] "r" (base) + ); +} + /** * @brief Sets the @a section_flags for the address range [@a begin, @a end). * |