Expand description
§PolkaKernel
⚠️ This crate is work-in-progress. Expect API changes. ⚠️
This is Linux syscall abstraction layer for PolkaVM/CoreVM that translates Linux system calls to PolkaVM/CoreVM host-calls. The host-calls are abstracted away with traits and can easily be replaced by any meaningful implementation. For example, you can read/write files from/to memory instead of on-disk file system.
The main use case is to support running arbitrary programs written for Linux on PolkaVM/CoreVM without code rewrite. To accomplish that one needs to build the program using PolkaPorts toolchain and then run it via provided “player” tool (work-in-progress). Up-to-date instructions are in the PolkaPorts repository.
╭────────────────╮ Host-calls ╭─────────────╮ Linux system calls ╭───────────────╮
│ PolkaVM/CoreVM │ ←────────────→ │ PolkaKernel │ ←────────────────────→ │ Guest program │
╰────────────────╯ ╰─────────────╯ ╰───────────────╯Modules§
- in_
memory - In-memory
FileSystem. - libc
- Definitions from Musl libc.
Structs§
- Error
- Syscall error.
- Kernel
- Linux kernel engine that implements system calls.
- Kernel
State - Serializable kernel state.
- Metadata
- File system node metadata.
Enums§
- Machine
Error - Machine-specific error.
- Reg
- Available registers.
- Seek
From - File read/write position anchor.
- Syscall
Outcome - System call result.
- Write
DirEntry Err
Traits§
- Environment
- Execution environment of a user-space program.
- File
System - File system of a user-space program.
- Machine
- A machine, virtual or physical, in which user-space programs are running.
Functions§
- dir_
entry_ len - Get directory entry length for the provided file name length.
- write_
dir_ entry - Write directory entry for the specified file name to the provided buffer.