1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#![cfg_attr(feature = "std", allow(dead_code, unreachable_code))]
use core::cell::UnsafeCell;
extern "C" {
static STACK_POINTER: UnsafeCell<usize>;
}
pub unsafe fn stack_pointer_init() {
#[cfg(feature = "std")]
return unimplemented!();
#[cfg(not(feature = "std"))]
unsafe {
asm!("mv sp, {}", in(reg) STACK_POINTER.get() as usize);
}
}
#[inline]
pub fn wait_for_int() {
#[cfg(feature = "std")]
return unimplemented!();
#[cfg(not(feature = "std"))]
unsafe {
asm!("wfi", options(nomem, nostack, preserves_flags));
}
}