Module riscv_shared

Source
Expand description

Shared RISC-V intrinsics

§Missing floating-point register instructions

We are deliberately not providing instructions that could change the floating-point rounding mode or exception behavior or read the accrued exceptions flags: frcsr, fscsr, fsrm, frflags, fsflags.

Rust makes no guarantees whatsoever about the contents of the accrued exceptions register: Rust floating-point operations may or may not result in this register getting updated with exception state, and the register can change between two invocations of this function even when no floating-point operations appear in the source code (since floating-point operations appearing earlier or later can be reordered).

Modifying the rounding mode leads to immediate Undefined Behavior: Rust assumes that the default rounding mode is always set and will optimize accordingly. This even applies when the rounding mode is altered and later reset to its original value without any floating-point operations appearing in the source code between those operations (since floating-point operations appearing earlier or later can be reordered).

If you need to perform some floating-point operations and check whether they raised an exception, use a single inline assembly block for the entire sequence of operations.

If you need to perform some floating-point operations under a differen rounding mode, use a single inline assembly block and make sure to restore the original rounding mode before the end of the block.

Re-exports§

pub use p::*;
pub use zb::*;
pub use zk::*;

Modules§

p 🔒
RISC-V Packed SIMD intrinsics; shared part.
zb 🔒
zk 🔒

Functions§

fence_iExperimental
Generates the FENCE.I instruction
frrmExperimental
Reads the floating-point rounding mode register frm
hfence_gvmaExperimental
Hypervisor memory management fence for guest physical address and virtual machine
hfence_gvma_allExperimental
Hypervisor memory management fence for all virtual machines and guest physical addresses
hfence_gvma_gaddrExperimental
Hypervisor memory management fence for guest physical address
hfence_gvma_vmidExperimental
Hypervisor memory management fence for given virtual machine
hfence_vvmaExperimental
Hypervisor memory management fence for given guest virtual address and guest address space
hfence_vvma_allExperimental
Hypervisor memory management fence for all guest address spaces and guest virtual addresses
hfence_vvma_asidExperimental
Hypervisor memory management fence for given guest address space
hfence_vvma_vaddrExperimental
Hypervisor memory management fence for given guest virtual address
hinval_gvmaExperimental
Invalidate hypervisor translation cache for guest physical address and virtual machine
hinval_gvma_allExperimental
Invalidate hypervisor translation cache for all virtual machines and guest physical addresses
hinval_gvma_gaddrExperimental
Invalidate hypervisor translation cache for guest physical address
hinval_gvma_vmidExperimental
Invalidate hypervisor translation cache for given virtual machine
hinval_vvmaExperimental
Invalidate hypervisor translation cache for given guest virtual address and guest address space
hinval_vvma_allExperimental
Invalidate hypervisor translation cache for all guest address spaces and guest virtual addresses
hinval_vvma_asidExperimental
Invalidate hypervisor translation cache for given guest address space
hinval_vvma_vaddrExperimental
Invalidate hypervisor translation cache for given guest virtual address
hlv_bExperimental
Loads virtual machine memory by signed byte integer
hlv_buExperimental
Loads virtual machine memory by unsigned byte integer
hlv_hExperimental
Loads virtual machine memory by signed half integer
hlv_huExperimental
Loads virtual machine memory by unsigned half integer
hlv_wExperimental
Loads virtual machine memory by signed word integer
hlvx_huExperimental
Accesses virtual machine instruction by unsigned half integer
hlvx_wuExperimental
Accesses virtual machine instruction by unsigned word integer
hsv_bExperimental
Stores virtual machine memory by byte integer
hsv_hExperimental
Stores virtual machine memory by half integer
hsv_wExperimental
Stores virtual machine memory by word integer
nopExperimental
Generates the NOP instruction
pauseExperimental
Generates the PAUSE instruction
sfence_inval_irExperimental
Generates the SFENCE.INVAL.IR instruction
sfence_vmaExperimental
Supervisor memory management fence for given virtual address and address space
sfence_vma_allExperimental
Supervisor memory management fence for all address spaces and virtual addresses
sfence_vma_asidExperimental
Supervisor memory management fence for given address space
sfence_vma_vaddrExperimental
Supervisor memory management fence for given virtual address
sfence_w_invalExperimental
Generates the SFENCE.W.INVAL instruction
sinval_vmaExperimental
Invalidate supervisor translation cache for given virtual address and address space
sinval_vma_allExperimental
Invalidate supervisor translation cache for all address spaces and virtual addresses
sinval_vma_asidExperimental
Invalidate supervisor translation cache for given address space
sinval_vma_vaddrExperimental
Invalidate supervisor translation cache for given virtual address
wfiExperimental
Generates the WFI instruction