Skip to content
STIMSMITH

RISC-V Proxy Kernel

Tool WIKI v1 · 7/10/2026

The RISC-V Proxy Kernel (pk) is a lightweight execution environment for RISC-V binaries that is loaded by the Swimmer-RISCV instruction set simulator via its `--use-pk` option. It allows user-mode RISC-V ELF binaries to be simulated transparently and is also used as the Berkeley Boot Loader (bbl) for booting Freedom-U-SDK Linux images.

RISC-V Proxy Kernel

The RISC-V Proxy Kernel (pk) is a minimal, user-mode execution environment used to run RISC-V binaries on simulators and emulators. In the Swimmer-RISCV toolchain it serves two roles:

  1. Application loader — When running an ELF binary compiled with riscv64-unknown-elf-gcc, the proxy kernel is passed to Swimmer-RISCV through the --use-pk option. The simulator loads the binary and the proxy kernel together so that the program can execute as if it were running natively under a Unix-like environment.

  2. Berkeley Boot Loader (bbl) — When simulating RISC-V Linux built with Freedom-U-SDK, the proxy kernel is produced as freedom-u-sdk/work/riscv-pk/bbl and passed to Swimmer-RISCV via --binfile to boot the Linux image.

Usage with Swimmer-RISCV

The proxy kernel is integrated with Swimmer-RISCV through the following CLI options (taken from the Swimmer-RISCV README):

  • --use-pk <path> — Specify the location of the RISC-V Proxy Kernel.
  • --binfile <path> — RISC-V binary file to be simulated.
  • --hexfile <path> — RISC-V srec (hex) file to be simulated.
  • --stop-host — Simulator stops when accessing tohost/fromhost memory addresses (the proxy kernel's host-call interface).
  • --vmlinux <path> — Specify location of the vmlinux object, used for simulating RISC-V Linux (often built on top of riscv-pk/bbl).

Running a user program

$ cat test.c
#include <stdio.h>
main () { printf("Hello\n"); }

$ riscv64-unknown-elf-gcc test.c -o test.elf
$ swimmer_riscv --binfile test.elf --use-pk ${RISCV}/riscv64-unknown-elf/bin/pk
Hello

Booting Freedom-U-SDK Linux

$ swimmer_riscv --binfile freedom-u-sdk/work/riscv-pk/bbl

Relationship to Swimmer-RISCV

Swimmer-RISCV is a configurable RISC-V instruction set simulator written in C++. It depends on riscv-pk for:

  • Hosting user-mode RISC-V ELF programs (via --use-pk).
  • Providing the Berkeley Boot Loader that wraps a Linux kernel image for booting via --binfile (and optionally --vmlinux).

The proxy kernel therefore acts as the primary bridge between compiled RISC-V binaries and the Swimmer-RISCV simulator, enabling both application-level and full-Linux simulation flows.

LINKED ENTITIES

1 links

CITATIONS

3 sources
3 citations
[1] Swimmer-RISCV provides a --use-pk option that takes the location of the RISC-V Proxy Kernel, enabling user-mode ELF binaries compiled with riscv64-unknown-elf-gcc to be simulated transparently. msyksphinz-self/swimmer_riscv
[2] Swimmer-RISCV can boot RISC-V Linux built with Freedom-U-SDK by passing the Berkeley Boot Loader produced from riscv-pk (freedom-u-sdk/work/riscv-pk/bbl) via the --binfile option. msyksphinz-self/swimmer_riscv
[3] The --stop-host option causes the simulator to stop when the proxy kernel's tohost/fromhost memory address is accessed. msyksphinz-self/swimmer_riscv