45 code.push_back(
movImm(kArg0, resourceId));
48 code.push_back(
movImm(kArg3, 0));
59 inline void emitRead(std::vector<Block> &code, std::uint8_t fdReg)
65 code.push_back(
movReg(kArg0, fdReg));
76 inline void emitWrite(std::vector<Block> &code, std::uint8_t fdReg, std::uint8_t valReg)
83 code.push_back(
movReg(kArg0, fdReg));
84 code.push_back(
movReg(kArg1, valReg));
92 inline void emitClose(std::vector<Block> &code, std::uint8_t fdReg)
98 code.push_back(
movReg(kArg0, fdReg));
Block — the fundamental unit of simulated memory.
File descriptor types and descriptor-table abstraction.
Interrupt enum class — hardware and software interrupt codes.
Common I/O descriptor and resource-type definitions.
@ SystemCall
Software interrupt — syscall entry.
Block interrupt(Interrupt code) noexcept
Raises a software interrupt.
Block movReg(std::uint8_t dst, std::uint8_t src) noexcept
Copies the value of one register into another.
void emitClose(std::vector< Block > &code, std::uint8_t fdReg)
Emits instructions to close a kernel I/O descriptor.
constexpr std::uint8_t SYSCALL_ID_REGISTER
Register used to pass syscall id and receive return value.
void emitRead(std::vector< Block > &code, std::uint8_t fdReg)
Emits instructions to read one value from a kernel I/O descriptor.
Block movImm(std::uint8_t reg, RegisterValue value) noexcept
Loads an immediate value into a register.
OpenMode
Open mode bit flags.
@ Write
Write bytes to a kernel-managed sink.
@ Read
Read bytes from a kernel-managed source.
@ Close
Close file/device.
void emitWrite(std::vector< Block > &code, std::uint8_t fdReg, std::uint8_t valReg)
Emits instructions to write one value to a kernel I/O descriptor.
IoResourceKind
Resource kinds supported by the kernel I/O layer.
constexpr std::array< std::uint8_t, 4 > SYSCALL_ARG_REGISTERS
Registers used to pass syscall arguments.
std::int32_t RegisterValue
Value stored in a CPU register.
void emitOpen(std::vector< Block > &code, RegisterValue resourceId, IoResourceKind kind, OpenMode mode)
Emits instructions to open a kernel I/O resource.
Inline Block construction helpers for assembling bytecode programs.
Register conventions for system call dispatch.
Syscall IDs for the user-kernel boundary.
Common type aliases, sentinel constants, and forward declarations used throughout the Contur 2 kernel...