File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ diff -uNr 09_hw_debug_JTAG/src/arch/aarch64.rs 10_privilege_level/src/arch/aarch
270270 pub mod sync;
271271 mod time;
272272
273- @@ -21,15 +22,51 @@
273+ @@ -21,15 +22,56 @@
274274 pub unsafe extern "C" fn _start() -> ! {
275275 const CORE_MASK: u64 = 0x3;
276276
@@ -289,8 +289,13 @@ diff -uNr 09_hw_debug_JTAG/src/arch/aarch64.rs 10_privilege_level/src/arch/aarch
289289 }
290290
291291+ /// Transition from EL2 to EL1.
292+ + ///
293+ + /// # Safety
294+ + ///
295+ + /// - The HW state of EL1 must be prepared in a sound way.
296+ + /// - Exception return from EL2 must must continue execution in EL1 with ´runtime_init::init()`.
292297+ #[inline(always)]
293- + fn el2_to_el1_transition() -> ! {
298+ + unsafe fn el2_to_el1_transition() -> ! {
294299+ // Enable timer counter registers for EL1.
295300+ CNTHCTL_EL2.write(CNTHCTL_EL2::EL1PCEN::SET + CNTHCTL_EL2::EL1PCTEN::SET);
296301+
@@ -325,7 +330,7 @@ diff -uNr 09_hw_debug_JTAG/src/arch/aarch64.rs 10_privilege_level/src/arch/aarch
325330 //--------------------------------------------------------------------------------------------------
326331 // Global instances
327332 //--------------------------------------------------------------------------------------------------
328- @@ -61,3 +98 ,36 @@
333+ @@ -61,3 +103 ,36 @@
329334 asm::wfe()
330335 }
331336 }
Original file line number Diff line number Diff line change @@ -34,8 +34,13 @@ pub unsafe extern "C" fn _start() -> ! {
3434}
3535
3636/// Transition from EL2 to EL1.
37+ ///
38+ /// # Safety
39+ ///
40+ /// - The HW state of EL1 must be prepared in a sound way.
41+ /// - Exception return from EL2 must must continue execution in EL1 with ´runtime_init::init()`.
3742#[ inline( always) ]
38- fn el2_to_el1_transition ( ) -> ! {
43+ unsafe fn el2_to_el1_transition ( ) -> ! {
3944 // Enable timer counter registers for EL1.
4045 CNTHCTL_EL2 . write ( CNTHCTL_EL2 :: EL1PCEN :: SET + CNTHCTL_EL2 :: EL1PCTEN :: SET ) ;
4146
You can’t perform that action at this time.
0 commit comments