pub struct Forward;Expand description
Forwards SBI calls onto current supervisor environment.
If crate feature forward is enabled, this structure implements all RustSBI extensions
by forwarding the calls into the current supervisor environment. This is done by sbi-rt
crate; thus Forward is only available when it’s running in RISC-V SBI environments.
Forward implements all RustSBI traits, but is only effective if #[cfg(feature = "forward")]
is enabled. Otherwise, struct Forward is unimplemented!() on SBI calls.
§Examples
This structure can be used as a structure field in #[derive(RustSBI)], with helper
macro #[rustsbi(extension_1, extension_2, ...)] annotating what extensions should be
forwarded to sbi-rt in the structure.
use rustsbi::{Forward, RustSBI};
// Forwards fence, timer and console extensions, but the hsm extension
// is still handled by the `hsm` field variable.
#[derive(RustSBI)]
struct VmSBI {
hsm: VmHsm,
#[rustsbi(fence, timer, console, info)]
forward: Forward,
}
Trait Implementations§
Source§impl Console for Forward
impl Console for Forward
Source§impl Cppc for Forward
impl Cppc for Forward
Source§fn probe(&self, reg_id: u32) -> SbiRet
fn probe(&self, reg_id: u32) -> SbiRet
Probe whether the CPPC register as specified by the
reg_id parameter
is implemented or not by the platform. Read moreSource§fn read(&self, reg_id: u32) -> SbiRet
fn read(&self, reg_id: u32) -> SbiRet
Reads the register as specified in the
reg_id parameter. Read moreSource§impl Hsm for Forward
impl Hsm for Forward
Source§fn hart_start(&self, hartid: usize, start_addr: usize, opaque: usize) -> SbiRet
fn hart_start(&self, hartid: usize, start_addr: usize, opaque: usize) -> SbiRet
Request the SBI implementation to start executing the given hart at specified address in supervisor-mode. Read more
Source§fn hart_stop(&self) -> SbiRet
fn hart_stop(&self) -> SbiRet
Request the SBI implementation to stop executing the calling hart in supervisor-mode
and return its ownership to the SBI implementation. Read more
Source§impl Nacl for Forward
impl Nacl for Forward
Source§fn probe_feature(&self, feature_id: u32) -> SbiRet
fn probe_feature(&self, feature_id: u32) -> SbiRet
Probe nested acceleration feature. Read more
Source§fn set_shmem(&self, shmem: SharedPtr<[u8; 8192]>, flags: usize) -> SbiRet
fn set_shmem(&self, shmem: SharedPtr<[u8; 8192]>, flags: usize) -> SbiRet
Set nested acceleration shared memory. Read more
Source§impl Pmu for Forward
impl Pmu for Forward
Source§fn num_counters(&self) -> usize
fn num_counters(&self) -> usize
Returns the number of counters (both hardware and firmware). Read more
Source§fn counter_get_info(&self, counter_idx: usize) -> SbiRet
fn counter_get_info(&self, counter_idx: usize) -> SbiRet
Get details about the specified counter such as underlying CSR number, width of the counter,
type of counter (hardware/firmware, etc.). Read more
Source§fn counter_config_matching(
&self,
counter_idx_base: usize,
counter_idx_mask: usize,
config_flags: usize,
event_idx: usize,
event_data: u64,
) -> SbiRet
fn counter_config_matching( &self, counter_idx_base: usize, counter_idx_mask: usize, config_flags: usize, event_idx: usize, event_data: u64, ) -> SbiRet
Find and configure a counter from a set of counters which is not started (or enabled)
and can monitor the specified event. Read more
Source§fn counter_start(
&self,
counter_idx_base: usize,
counter_idx_mask: usize,
start_flags: usize,
initial_value: u64,
) -> SbiRet
fn counter_start( &self, counter_idx_base: usize, counter_idx_mask: usize, start_flags: usize, initial_value: u64, ) -> SbiRet
Start or enable a set of counters on the calling HART with the specified initial value. Read more
Source§fn counter_stop(
&self,
counter_idx_base: usize,
counter_idx_mask: usize,
stop_flags: usize,
) -> SbiRet
fn counter_stop( &self, counter_idx_base: usize, counter_idx_mask: usize, stop_flags: usize, ) -> SbiRet
Stop or disable a set of counters on the calling HART. Read more
Source§impl Rfence for Forward
impl Rfence for Forward
Source§fn remote_fence_i(&self, hart_mask: HartMask) -> SbiRet
fn remote_fence_i(&self, hart_mask: HartMask) -> SbiRet
Instructs remote harts to execute
FENCE.I instruction. Read moreSource§fn remote_sfence_vma(
&self,
hart_mask: HartMask,
start_addr: usize,
size: usize,
) -> SbiRet
fn remote_sfence_vma( &self, hart_mask: HartMask, start_addr: usize, size: usize, ) -> SbiRet
Instructs the remote harts to execute one or more
SFENCE.VMA instructions,
covering the range of virtual addresses between start_addr and size. Read moreSource§fn remote_sfence_vma_asid(
&self,
hart_mask: HartMask,
start_addr: usize,
size: usize,
asid: usize,
) -> SbiRet
fn remote_sfence_vma_asid( &self, hart_mask: HartMask, start_addr: usize, size: usize, asid: usize, ) -> SbiRet
Instruct the remote harts to execute one or more
SFENCE.VMA instructions,
covering the range of virtual addresses between start_addr and size.
This covers only the given address space by asid. Read moreSource§fn remote_hfence_gvma_vmid(
&self,
hart_mask: HartMask,
start_addr: usize,
size: usize,
vmid: usize,
) -> SbiRet
fn remote_hfence_gvma_vmid( &self, hart_mask: HartMask, start_addr: usize, size: usize, vmid: usize, ) -> SbiRet
Instruct the remote harts to execute one or more
HFENCE.GVMA instructions,
covering the range of guest physical addresses between start_addr and size
only for the given virtual machine by vmid. Read moreSource§fn remote_hfence_gvma(
&self,
hart_mask: HartMask,
start_addr: usize,
size: usize,
) -> SbiRet
fn remote_hfence_gvma( &self, hart_mask: HartMask, start_addr: usize, size: usize, ) -> SbiRet
Instruct the remote harts to execute one or more
HFENCE.GVMA instructions,
covering the range of guest physical addresses between start_addr and size
for all the guests. Read moreSource§fn remote_hfence_vvma_asid(
&self,
hart_mask: HartMask,
start_addr: usize,
size: usize,
asid: usize,
) -> SbiRet
fn remote_hfence_vvma_asid( &self, hart_mask: HartMask, start_addr: usize, size: usize, asid: usize, ) -> SbiRet
Instruct the remote harts to execute one or more
HFENCE.VVMA instructions,
covering the range of guest virtual addresses between start_addr and size for the given
address space by asid and current virtual machine (by vmid in hgatp CSR)
of calling hart. Read moreSource§fn remote_hfence_vvma(
&self,
hart_mask: HartMask,
start_addr: usize,
size: usize,
) -> SbiRet
fn remote_hfence_vvma( &self, hart_mask: HartMask, start_addr: usize, size: usize, ) -> SbiRet
Instruct the remote harts to execute one or more
HFENCE.VVMA instructions,
covering the range of guest virtual addresses between start_addr and size
for current virtual machine (by vmid in hgatp CSR) of calling hart. Read moreAuto Trait Implementations§
impl Freeze for Forward
impl RefUnwindSafe for Forward
impl Send for Forward
impl Sync for Forward
impl Unpin for Forward
impl UnwindSafe for Forward
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more