Expand description
Procedural macros for declaring nub_rt guest endpoints.
The #[nub_rt::endpoint(N)] attribute marks a function as
endpoint N of a PVM2 program. The macro emits three items
into the guest crate:
- The function definition itself, unchanged.
- A per-endpoint trampoline
__nub_rt_ep_N_trampolinein.textthat calls the user function, then halts the VM via a bareecallwith no CSR marker, which the linker rewrites tocustom-0 ecalli imm=0— the clean-halt convention. The trampoline lives in regular code; the engine enters it atendpoints[N].entry_pc. - A
nub_rt::EndpointDescriptorstatic in the.nub.endpointsELF section whosefn_ptrpoints at the trampoline (not the user fn).nub-linkerreads the section at link time and resolves eachfn_ptrto a PVM PC.
ⓘ
#[nub_rt::endpoint(0)]
fn process(args_len: u64) -> u64 { ... }On host targets the macro emits only the function definition;
the trampoline and descriptor are gated behind
cfg(all(target_os = "none", target_arch = "riscv64")).
Attribute Macros§
- endpoint
- Mark a function as endpoint
Nof a PVM2 program.