![]() |
Contur 2
Educational OS kernel simulator
|
Classes | |
| struct | Block |
| A single memory cell in the simulated architecture. More... | |
| class | RegisterFile |
| The CPU's register bank — holds REGISTER_COUNT (16) registers. More... | |
| class | IClock |
| Abstract clock interface for simulation time. More... | |
| class | SimulationClock |
| Concrete simulation clock — a simple monotonic tick counter. More... | |
| class | Result |
| A result type that holds either a success value of type T or an ErrorCode. More... | |
| class | Result< void > |
| Specialization of Result for void — operations that produce no value on success. More... | |
| class | Event |
| Type-safe event dispatcher supporting multiple subscribers. More... | |
| class | ALU |
| Arithmetic Logic Unit — performs all computational operations. More... | |
| class | Cpu |
| Concrete CPU implementation. More... | |
| class | ICPU |
| Abstract CPU interface. More... | |
| class | Dispatcher |
| Uniprocessor dispatcher implementation. More... | |
| class | DispatcherPool |
| Host-thread worker pool runtime for dispatcher lanes. More... | |
| class | IDispatchRuntime |
| Strategy interface that executes dispatch/tick across dispatcher lanes. More... | |
| class | IDispatcher |
| Interface for process lifecycle dispatch orchestration. More... | |
| class | MPDispatcher |
| Multiprocessor dispatcher delegating to child dispatchers. More... | |
| class | SerialDispatchRuntime |
| Serial runtime strategy that executes dispatcher lanes on the caller thread. More... | |
| struct | HostThreadingConfig |
| Configuration for host-thread dispatch runtime behavior. More... | |
| struct | ExecutionResult |
| Result of an execution burst returned by IExecutionEngine::execute(). More... | |
| class | IExecutionEngine |
| Abstract execution engine interface. More... | |
| class | InterpreterEngine |
| Bytecode interpreter execution engine. More... | |
| class | NativeEngine |
| Native host-process execution engine. More... | |
| class | BlockAllocator |
| Allocates and frees fixed-size disk blocks. More... | |
| struct | DirectoryEntry |
| One child entry in a directory. More... | |
| struct | FileDescriptor |
| Descriptor handle returned by open(). More... | |
| struct | OpenFileState |
| Runtime state for one open descriptor. More... | |
| class | FileDescriptorTable |
| Descriptor table mapping integer handles to open-file state. More... | |
| struct | InodeInfo |
| Public inode metadata returned by stat(). More... | |
| class | IFileSystem |
| Abstract file-system interface. More... | |
| struct | Inode |
| Persistent metadata describing a filesystem node. More... | |
| class | SimpleFS |
| In-memory educational filesystem with inode + block allocation model. More... | |
| class | ConsoleDevice |
| Console output device. More... | |
| class | DeviceManager |
| Registry and dispatcher for I/O devices. More... | |
| class | IDevice |
| Abstract interface for a simulated I/O device. More... | |
| class | IIoManager |
| Kernel I/O manager interface. More... | |
| class | IoManager |
| Unified I/O manager for files and socket-like resources. More... | |
| struct | IoDescriptor |
| Unified descriptor handle returned by the kernel I/O layer. More... | |
| class | NetworkDevice |
| Simulated network (LAN) device. More... | |
| class | IIpcChannel |
| Common interface for IPC channels. More... | |
| class | IpcManager |
| Registry/mediator for named IPC channels. More... | |
| struct | Message |
| Typed message used by MessageQueue. More... | |
| class | MessageQueue |
| FIFO/priority message queue IPC channel. More... | |
| class | Pipe |
| Unidirectional byte-stream IPC channel with bounded capacity. More... | |
| class | SharedMemory |
| Named shared-memory IPC channel. More... | |
| struct | ProcessConfig |
| Configuration payload used to create a process. More... | |
| struct | KernelProcessSnapshot |
| Lightweight process row for diagnostics and TUI rendering. More... | |
| struct | KernelSnapshot |
| Lightweight kernel state snapshot for UI and diagnostics. More... | |
| class | IKernel |
| Top-level kernel facade. More... | |
| struct | KernelDiagnosticsSnapshot |
| Diagnostics snapshot used by external observers. More... | |
| class | IKernelDiagnostics |
| Read-only diagnostics interface for querying kernel state. More... | |
| struct | KernelDependencies |
| Dependency bundle used to construct a Kernel. More... | |
| class | Kernel |
| Concrete kernel facade. More... | |
| class | KernelBuilder |
| Fluent builder that assembles Kernel dependencies. More... | |
| class | KernelDiagnostics |
| Diagnostics adapter that captures snapshots from IKernel facade. More... | |
| class | ClockReplacement |
| Clock (Second Chance) page replacement. More... | |
| class | FifoReplacement |
| First-In First-Out page replacement. More... | |
| class | IMemory |
| Abstract interface for linear addressable memory. More... | |
| class | IMMU |
| Abstract interface for the Memory Management Unit. More... | |
| class | IPageReplacementPolicy |
| Abstract interface for page replacement algorithms. More... | |
| class | IVirtualMemory |
| Abstract interface for virtual memory management. More... | |
| class | LruReplacement |
| Least Recently Used page replacement. More... | |
| class | Mmu |
| Concrete Memory Management Unit implementation. More... | |
| class | OptimalReplacement |
| Optimal page replacement (Belady's algorithm). More... | |
| struct | PageTableEntry |
| Entry in the page table — maps one virtual page to a physical frame. More... | |
| class | PageTable |
| Page table mapping virtual page numbers to physical frames. More... | |
| class | PhysicalMemory |
| Simulated physical RAM — a linear array of Block cells. More... | |
| class | VirtualMemory |
| Concrete virtual memory manager. More... | |
| class | IProcess |
| Read-only interface for inspecting process metadata. More... | |
| struct | ProcessTiming |
| Aggregate holding process timing statistics. More... | |
| struct | ProcessAddressInfo |
| Aggregate holding virtual memory address mapping for a process. More... | |
| class | PCB |
| Process Control Block — stores all metadata for a single process. More... | |
| struct | Priority |
| Composite priority descriptor for a process. More... | |
| class | ProcessImage |
| Full in-memory representation of a process. More... | |
| class | FcfsPolicy |
| First Come First Served (FCFS) scheduling policy. More... | |
| class | HrrnPolicy |
| Highest Response Ratio Next (HRRN) scheduling policy. More... | |
| class | IScheduler |
| Scheduler abstraction managing process state queues. More... | |
| struct | SchedulingProcessSnapshot |
| Immutable process view consumed by scheduling policies. More... | |
| class | ISchedulingPolicy |
| Strategy interface for scheduling algorithms. More... | |
| class | MlfqPolicy |
| Multilevel Feedback Queue (MLFQ) scheduling policy. More... | |
| class | PriorityPolicy |
| Dynamic-priority scheduling policy. More... | |
| class | RoundRobinPolicy |
| Round Robin scheduling policy. More... | |
| class | Scheduler |
| Scheduler host that manages process queues and policy decisions. More... | |
| class | SpnPolicy |
| Shortest Process Next (SPN) scheduling policy. More... | |
| class | SrtPolicy |
| Shortest Remaining Time (SRT) scheduling policy. More... | |
| class | Statistics |
| Tracks per-process burst history and EWMA burst prediction. More... | |
| class | CriticalSection |
| Critical-section adapter over a synchronization primitive. More... | |
| struct | ResourceAllocation |
| Per-process resource vector used by Banker's safety check. More... | |
| class | DeadlockDetector |
| Deadlock detection/prevention helper. More... | |
| class | ISyncPrimitive |
| Common interface for synchronization primitives. More... | |
| class | Mutex |
| Reentrant mutex with ownership tracking. More... | |
| class | Semaphore |
| Counting semaphore synchronization primitive. More... | |
| class | ISyscallHandler |
| Interface for syscall handling. More... | |
| class | SyscallTable |
| Dispatch table mapping SyscallId to handler functions. More... | |
| class | BufferSink |
| Trace sink that stores events in memory. More... | |
| class | ConsoleSink |
| Trace sink that writes formatted events to stdout. More... | |
| class | FileSink |
| Trace sink that appends events to a text file. More... | |
| class | ITracer |
| Tracer interface used by kernel subsystems. More... | |
| class | NullTracer |
| No-op tracer used when tracing is disabled. More... | |
| struct | TraceEvent |
| Structured trace event record. More... | |
| class | TraceScope |
| RAII helper that pushes/pops tracer scope automatically. More... | |
| class | ITraceSink |
| Sink interface that receives structured trace events. More... | |
| class | Tracer |
| Active tracer implementation. More... | |
| class | IDashboardView |
| Composite dashboard contract for rendering full panel layout. More... | |
| struct | FtxuiAppConfig |
| Configuration for FtxuiApp behaviour. More... | |
| class | FtxuiApp |
| Full interactive TUI application using FTXUI ScreenInteractive. More... | |
| class | FtxuiRenderer |
| FTXUI off-screen renderer implementing IRenderer. More... | |
| class | HistoryBuffer |
| Bounded history buffer used for UI-only playback navigation. More... | |
| class | IKernelReadModel |
| Read-only adapter contract for capturing UI-facing kernel snapshots. More... | |
| class | KernelReadModel |
| Default implementation that adapts kernel snapshot data into TUI models. More... | |
| class | IRenderer |
| Renderer contract for painting a full TUI snapshot. More... | |
| class | ITuiController |
| TUI controller interface for command/state orchestration. More... | |
| class | TuiController |
| Default MVC controller implementation. More... | |
| struct | TuiMemoryMapViewModel |
| View model for memory panel rendering. More... | |
| class | IMemoryMapView |
| Memory map panel renderer contract. More... | |
| struct | TuiProcessViewModel |
| View model for process panel rendering. More... | |
| class | IProcessView |
| Process panel renderer contract. More... | |
| struct | TuiSchedulerViewModel |
| View model for scheduler panel rendering. More... | |
| class | ISchedulerView |
| Scheduler panel renderer contract. More... | |
| struct | TuiPlaybackConfig |
| Autoplay configuration used by controller/runtime scheduling logic. More... | |
| struct | TuiCommand |
| Generic command payload accepted by TUI controller. More... | |
| struct | TuiProcessSnapshot |
| Immutable process row used by TUI views. More... | |
| struct | TuiSchedulerSnapshot |
| Immutable scheduler-focused snapshot consumed by TUI views. More... | |
| struct | TuiMemorySnapshot |
| Immutable memory-focused snapshot consumed by TUI views. More... | |
| struct | TuiSnapshot |
| Top-level immutable model snapshot consumed by TUI controller/views. More... | |
| struct | TuiHistoryEntry |
| Single history entry stored by the UI history buffer. More... | |
Typedefs | |
| using | ProcessId = std::uint32_t |
| Unique identifier for a process. | |
| using | MemoryAddress = std::uint32_t |
| Represents a memory address (physical or virtual). | |
| using | Tick = std::uint64_t |
| Simulation clock tick counter. | |
| using | RegisterValue = std::int32_t |
| Value stored in a CPU register. | |
| using | DeviceId = std::uint16_t |
| Unique identifier for an I/O device. | |
| using | SubscriptionId = std::uint64_t |
| Unique identifier for an event subscription. | |
| using | ResourceId = std::uint32_t |
| Unique identifier for a synchronization resource (mutex, semaphore, etc.). | |
| using | InodeId = std::uint32_t |
| Unique identifier for a filesystem inode. | |
| using | FrameId = std::uint32_t |
| Frame number in physical memory. | |
| using | DispatcherLanes = std::vector<std::reference_wrapper<IDispatcher>> |
| Alias for the dispatcher lanes controlled by a runtime. | |
| using | IoWakeCallback = std::function<void(ProcessId)> |
| Callback used to wake a blocked process when I/O becomes ready. | |
| using | SyscallHandlerFn |
| Function signature used for syscall registration. | |
| using | ThreadToken = std::uint64_t |
| Host-thread token used by thread-aware deadlock tracking. | |
Enumerations | |
| enum class | Instruction : std::uint8_t { Nop = 0 , Mov , Add , Sub , Mul , Div , And , Or , Xor , ShiftLeft , ShiftRight , Compare , JumpEqual , JumpNotEqual , JumpGreater , JumpLess , JumpGreaterEqual , JumpLessEqual , Push , Pop , Call , Return , ReadMemory , WriteMemory , Interrupt , Halt } |
| CPU instruction opcodes for the simulated architecture. More... | |
| enum class | Interrupt : std::int32_t { Ok = 0 , Error = -1 , DivByZero = 3 , SystemCall = 11 , PageFault = 14 , Exit = 16 , NetworkIO = 32 , Timer = 64 , DeviceIO = 254 } |
| Interrupt codes used by the CPU and kernel. More... | |
| enum class | Register : std::uint8_t { R0 = 0 , R1 = 1 , R2 = 2 , R3 = 3 , R4 = 4 , R5 = 5 , R6 = 6 , R7 = 7 , R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 , R12 = 12 , R13 = 13 , ProgramCounter = 14 , StackPointer = 15 } |
| CPU register identifiers. More... | |
| enum class | ErrorCode : std::int32_t { Ok = 0 , OutOfMemory , InvalidPid , InvalidAddress , DivisionByZero , InvalidInstruction , SegmentationFault , DeviceError , ProcessNotFound , PermissionDenied , Timeout , DeadlockDetected , InvalidState , InvalidArgument , ResourceBusy , NotFound , AlreadyExists , BufferFull , BufferEmpty , EndOfFile , NotImplemented } |
| Error codes returned by kernel subsystem operations. More... | |
| enum class | InodeType : std::uint8_t { File , Directory } |
| Type of filesystem node. More... | |
| enum class | StopReason : std::uint8_t { BudgetExhausted , ProcessExited , Error , Interrupted , Halted } |
| Reason why the execution engine returned control to the dispatcher. More... | |
| enum class | OpenMode : std::uint8_t { None = 0 , Read = 1U << 0 , Write = 1U << 1 , Create = 1U << 2 , Truncate = 1U << 3 , Append = 1U << 4 } |
| Open mode bit flags. More... | |
| enum class | IoResourceKind : std::uint8_t { File = 0 , LanFile = 1 , SocketStream = 2 , SocketMessage = 3 } |
| Resource kinds supported by the kernel I/O layer. More... | |
| enum class | PriorityLevel : std::int8_t { Realtime = 0 , High = 1 , AboveNormal = 2 , Normal = 3 , BelowNormal = 4 , Low = 5 , Idle = 6 } |
| Discrete priority levels, from highest (Realtime) to lowest (Idle). More... | |
| enum class | ProcessState : std::uint8_t { New , Ready , Running , Blocked , Suspended , Terminated } |
| All possible states in a process lifecycle. More... | |
| enum class | SyncLayer : std::uint8_t { KernelInternal , SimulatedResource } |
| Distinguishes simulated sync resources from kernel-internal locks. More... | |
| enum class | SyscallId : std::uint16_t { Exit = 0 , Write = 1 , Read = 2 , Fork = 3 , Exec = 4 , Wait = 5 , Open = 10 , Close = 11 , CreatePipe = 20 , SendMessage = 21 , ReceiveMessage = 22 , ShmCreate = 23 , ShmAttach = 24 , MutexLock = 30 , MutexUnlock = 31 , SemWait = 32 , SemSignal = 33 , GetPid = 40 , GetTime = 41 , Yield = 42 } |
| Numeric identifiers for system calls. More... | |
| enum class | TraceLevel : std::uint8_t { Debug = 0 , Info = 1 , Warn = 2 , Error = 3 } |
| Trace event severity. More... | |
| enum class | TuiControllerState : std::uint8_t { Idle , Playing , Paused } |
| Controller state for playback lifecycle. More... | |
| enum class | TuiCommandKind : std::uint8_t { Tick , AutoPlayStart , AutoPlayStop , Pause , SeekBackward , SeekForward } |
| Supported command kinds for TUI playback/navigation. More... | |
Functions | |
| constexpr std::string_view | instructionName (Instruction instr) noexcept |
| Returns the human-readable mnemonic for an instruction. | |
| constexpr std::string_view | interruptName (Interrupt intr) noexcept |
| Returns the human-readable name for an interrupt code. | |
| constexpr bool | isArithmetic (Instruction instr) noexcept |
| Returns true if the instruction is an arithmetic operation (Add, Sub, Mul, Div). | |
| constexpr bool | isLogic (Instruction instr) noexcept |
| Returns true if the instruction is a logic/bitwise operation (And, Or, Xor, Shift). | |
| constexpr bool | isJump (Instruction instr) noexcept |
| Returns true if the instruction is a conditional or unconditional jump. | |
| constexpr bool | isStackOp (Instruction instr) noexcept |
| Returns true if the instruction affects the stack (Push, Pop, Call, Return). | |
| constexpr bool | isMemoryOp (Instruction instr) noexcept |
| Returns true if the instruction involves memory access (ReadMemory, WriteMemory). | |
| constexpr bool | isHalt (Instruction instr) noexcept |
| Returns true if the instruction terminates execution flow (Halt, Interrupt with Exit). | |
| Block | movImm (std::uint8_t reg, RegisterValue value) noexcept |
| Loads an immediate value into a register. | |
| Block | movReg (std::uint8_t dst, std::uint8_t src) noexcept |
| Copies the value of one register into another. | |
| Block | addImm (std::uint8_t reg, RegisterValue value) noexcept |
| Adds an immediate value to a register (dst = dst + value). | |
| Block | addReg (std::uint8_t dst, std::uint8_t src) noexcept |
| Adds the value of one register to another (dst = dst + src). | |
| Block | subImm (std::uint8_t reg, RegisterValue value) noexcept |
| Subtracts an immediate value from a register (dst = dst - value). | |
| Block | subReg (std::uint8_t dst, std::uint8_t src) noexcept |
| Subtracts the value of one register from another (dst = dst - src). | |
| Block | mulImm (std::uint8_t reg, RegisterValue value) noexcept |
| Multiplies a register by an immediate value (dst = dst * value). | |
| Block | mulReg (std::uint8_t dst, std::uint8_t src) noexcept |
| Multiplies a register by the value of another register (dst = dst * src). | |
| Block | divImm (std::uint8_t reg, RegisterValue value) noexcept |
| Divides a register by an immediate value (dst = dst / value). | |
| Block | divReg (std::uint8_t dst, std::uint8_t src) noexcept |
| Divides a register by the value of another register (dst = dst / src). | |
| Block | readMem (std::uint8_t reg, MemoryAddress addr) noexcept |
| Reads a value from a physical memory address into a register. | |
| Block | writeMem (std::uint8_t reg, MemoryAddress addr) noexcept |
| Writes a register value to a physical memory address. | |
| Block | compareImm (std::uint8_t reg, RegisterValue value) noexcept |
| Compares a register against an immediate value and sets flags. | |
| Block | compareReg (std::uint8_t reg, std::uint8_t other) noexcept |
| Compares two registers and sets flags. | |
| Block | jumpEqual (RegisterValue target) noexcept |
Jumps to target if the last compare was equal. | |
| Block | jumpNotEqual (RegisterValue target) noexcept |
Jumps to target if the last compare was not equal. | |
| Block | jumpGreater (RegisterValue target) noexcept |
Jumps to target if the last compare was greater. | |
| Block | jumpLess (RegisterValue target) noexcept |
Jumps to target if the last compare was less. | |
| Block | jumpGreaterEqual (RegisterValue target) noexcept |
Jumps to target if the last compare was greater or equal. | |
| Block | jumpLessEqual (RegisterValue target) noexcept |
Jumps to target if the last compare was less or equal. | |
| Block | interrupt (Interrupt code) noexcept |
| Raises a software interrupt. | |
| Block | nop () noexcept |
| No-op — advances the program counter by one. | |
| Block | halt () noexcept |
| Halts the process unconditionally. | |
| constexpr std::string_view | registerName (Register reg) noexcept |
| Returns the human-readable name of a register (e.g., "R0", "PC", "SP"). | |
| constexpr std::string_view | errorCodeToString (ErrorCode code) noexcept |
| Returns a human-readable name for the given error code. | |
| constexpr OpenMode | operator| (OpenMode lhs, OpenMode rhs) noexcept |
| Returns bitwise OR combination of open-mode flags. | |
| constexpr OpenMode | operator& (OpenMode lhs, OpenMode rhs) noexcept |
| Returns bitwise AND combination of open-mode flags. | |
| constexpr bool | hasOpenMode (OpenMode value, OpenMode flag) noexcept |
| Returns whether the provided mode set contains a flag. | |
| Result< RegisterValue > | parseRegisterValue (std::string_view text) noexcept |
| Parses a decimal integer string into a RegisterValue. | |
| Result< RegisterValue > | readFileValue (IFileSystem &fs, const std::string &path) |
| Reads a RegisterValue stored as decimal text from a file. | |
| Result< void > | writeFileValue (IFileSystem &fs, const std::string &path, RegisterValue value) |
| Writes a RegisterValue as decimal text to a file, truncating first. | |
| constexpr std::string_view | priorityLevelName (PriorityLevel level) noexcept |
| Returns a human-readable name for the given priority level. | |
| constexpr bool | isValidTransition (ProcessState from, ProcessState to) noexcept |
| Validates whether a transition from one process state to another is legal. | |
| constexpr std::string_view | processStateName (ProcessState state) noexcept |
| Returns a human-readable name for the given process state. | |
| void | emitOpen (std::vector< Block > &code, RegisterValue resourceId, IoResourceKind kind, OpenMode mode) |
| Emits instructions to open a kernel I/O resource. | |
| void | emitRead (std::vector< Block > &code, std::uint8_t fdReg) |
| Emits instructions to read one value from a kernel I/O descriptor. | |
| 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. | |
| void | emitClose (std::vector< Block > &code, std::uint8_t fdReg) |
| Emits instructions to close a kernel I/O descriptor. | |
| TraceEvent | makeTraceEvent (Tick timestamp, std::string_view subsystem, std::string_view operation, std::string_view details, std::uint32_t depth, TraceLevel level=TraceLevel::Info) |
| Convenience helper for constructing a trace event. | |
| constexpr std::string_view | traceLevelToString (TraceLevel level) noexcept |
| Converts TraceLevel to a human-readable string. | |
| constexpr bool | commandRequiresStep (TuiCommandKind kind) noexcept |
| Returns true when command kind requires non-zero step value. | |
| constexpr bool | commandRequiresInterval (TuiCommandKind kind) noexcept |
| Returns true when command kind requires non-zero interval value. | |
| Result< void > | validatePlaybackConfig (const TuiPlaybackConfig &config) |
| Validates autoplay configuration. | |
| Result< void > | validateCommand (const TuiCommand &command) |
| Validates a TUI command payload. | |
| constexpr TuiPlaybackConfig | playbackConfigFromCommand (const TuiCommand &command) noexcept |
| Builds playback configuration from command payload values. | |
Variables | |
| constexpr std::uint8_t | INSTRUCTION_COUNT = 25 |
| Total number of defined instructions. | |
| constexpr ProcessId | INVALID_PID = 0 |
| Sentinel value indicating an invalid/unassigned process ID. | |
| constexpr MemoryAddress | NULL_ADDRESS = 0xFFFFFFFF |
| Sentinel value indicating an invalid/null memory address. | |
| constexpr FrameId | INVALID_FRAME = 0xFFFFFFFF |
| Sentinel value indicating an invalid frame. | |
| constexpr InodeId | INVALID_INODE_ID = 0 |
| Sentinel value indicating an invalid inode identifier. | |
| constexpr std::uint8_t | REGISTER_COUNT = 16 |
| Maximum number of CPU registers. | |
| constexpr Tick | DEFAULT_TIME_SLICE = 4 |
| Default time slice for Round Robin scheduling (in ticks). | |
| constexpr ProcessId | MAX_PROCESSES = 1024 |
| Maximum number of processes the kernel can manage. | |
| constexpr std::int32_t | NICE_MIN = -20 |
| Minimum nice value (highest boost). | |
| constexpr std::int32_t | NICE_MAX = 19 |
| Maximum nice value (lowest boost). | |
| constexpr std::int32_t | NICE_DEFAULT = 0 |
| Default nice value (no adjustment). | |
| constexpr std::uint8_t | SYSCALL_ID_REGISTER = static_cast<std::uint8_t>(Register::R0) |
| Register used to pass syscall id and receive return value. | |
| constexpr std::array< std::uint8_t, 4 > | SYSCALL_ARG_REGISTERS |
| Registers used to pass syscall arguments. | |
| constexpr std::uint8_t | SYSCALL_STATUS_REGISTER = static_cast<std::uint8_t>(Register::R7) |
| Register used to store syscall status/error code. | |
| using contur::DeviceId = std::uint16_t |
| using contur::DispatcherLanes = std::vector<std::reference_wrapper<IDispatcher>> |
Alias for the dispatcher lanes controlled by a runtime.
Definition at line 20 of file i_dispatch_runtime.h.
| using contur::FrameId = std::uint32_t |
| using contur::InodeId = std::uint32_t |
| using contur::IoWakeCallback = std::function<void(ProcessId)> |
Callback used to wake a blocked process when I/O becomes ready.
Definition at line 19 of file i_io_manager.h.
| using contur::MemoryAddress = std::uint32_t |
| using contur::ProcessId = std::uint32_t |
| using contur::RegisterValue = std::int32_t |
| using contur::ResourceId = std::uint32_t |
| using contur::SubscriptionId = std::uint64_t |
| using contur::SyscallHandlerFn |
Function signature used for syscall registration.
Definition at line 140 of file i_kernel.h.
| using contur::ThreadToken = std::uint64_t |
Host-thread token used by thread-aware deadlock tracking.
Definition at line 15 of file deadlock_detector.h.
| using contur::Tick = std::uint64_t |
|
strong |
Error codes returned by kernel subsystem operations.
|
strong |
|
strong |
CPU instruction opcodes for the simulated architecture.
Each instruction is a single byte, decoded by the CPU during the fetch-decode-execute cycle. The interpreter engine steps through these one at a time.
Definition at line 15 of file instruction.h.
|
strong |
Interrupt codes used by the CPU and kernel.
Positive values represent hardware/timer interrupts. Negative values indicate error conditions. The CPU generates these during execution; the dispatcher and kernel handle them to drive process state transitions.
Definition at line 16 of file interrupt.h.
|
strong |
Resource kinds supported by the kernel I/O layer.
| Enumerator | |
|---|---|
| File | |
| LanFile | |
| SocketStream | |
| SocketMessage | |
Definition at line 30 of file io_types.h.
|
strong |
Open mode bit flags.
| Enumerator | |
|---|---|
| None | |
| Read | |
| Write | |
| Create | |
| Truncate | |
| Append | |
Definition at line 39 of file file_descriptor.h.
|
strong |
Discrete priority levels, from highest (Realtime) to lowest (Idle).
Numerically lower values represent higher priority. This ordering allows natural comparison: Realtime < High < Normal < Low < Idle.
Definition at line 19 of file priority.h.
|
strong |
All possible states in a process lifecycle.
|
strong |
CPU register identifiers.
14 general-purpose registers (R0–R13) plus two special-purpose:
| Enumerator | |
|---|---|
| R0 | |
| R1 | |
| R2 | |
| R3 | |
| R4 | |
| R5 | |
| R6 | |
| R7 | |
| R8 | |
| R9 | |
| R10 | |
| R11 | |
| R12 | |
| R13 | |
| ProgramCounter | |
| StackPointer | |
Definition at line 25 of file register_file.h.
|
strong |
Reason why the execution engine returned control to the dispatcher.
| Enumerator | |
|---|---|
| BudgetExhausted | Tick budget ran out (preemption / time slice expired). |
| ProcessExited | Process executed Halt or Int Exit — normal termination. |
| Error | An unrecoverable error occurred (invalid instruction, segfault, etc.). |
| Interrupted | A software/hardware interrupt requires kernel attention (syscall, I/O, page fault). |
| Halted | Process was forcibly halted via halt(). |
Definition at line 19 of file execution_context.h.
|
strong |
Distinguishes simulated sync resources from kernel-internal locks.
| Enumerator | |
|---|---|
| KernelInternal | |
| SimulatedResource | |
Definition at line 15 of file i_sync_primitive.h.
|
strong |
Numeric identifiers for system calls.
Definition at line 11 of file syscall_ids.h.
|
strong |
|
strong |
Supported command kinds for TUI playback/navigation.
| Enumerator | |
|---|---|
| Tick | |
| AutoPlayStart | |
| AutoPlayStop | |
| Pause | |
| SeekBackward | |
| SeekForward | |
Definition at line 14 of file tui_commands.h.
|
strong |
Controller state for playback lifecycle.
| Enumerator | |
|---|---|
| Idle | |
| Playing | |
| Paused | |
Definition at line 20 of file i_tui_controller.h.
|
inlinenodiscardnoexcept |
Adds an immediate value to a register (dst = dst + value).
| reg | Destination register index. |
| value | Immediate operand. |
Definition at line 41 of file program_builder.h.
References Add.
|
inlinenodiscardnoexcept |
Adds the value of one register to another (dst = dst + src).
| dst | Destination register index. |
| src | Source register index. |
Definition at line 50 of file program_builder.h.
References Add.
|
nodiscardconstexprnoexcept |
Returns true when command kind requires non-zero interval value.
| kind | Command kind. |
Definition at line 59 of file tui_commands.h.
References AutoPlayStart.
Referenced by validateCommand().
|
nodiscardconstexprnoexcept |
Returns true when command kind requires non-zero step value.
| kind | Command kind. |
Definition at line 50 of file tui_commands.h.
References AutoPlayStart, SeekBackward, SeekForward, and Tick.
Referenced by validateCommand().
|
inlinenodiscardnoexcept |
Compares a register against an immediate value and sets flags.
| reg | Register to compare. |
| value | Immediate operand. |
Definition at line 131 of file program_builder.h.
References Compare.
|
inlinenodiscardnoexcept |
Compares two registers and sets flags.
| reg | First register index. |
| other | Second register index. |
Definition at line 140 of file program_builder.h.
References Compare.
|
inlinenodiscardnoexcept |
Divides a register by an immediate value (dst = dst / value).
| reg | Destination register index. |
| value | Immediate operand (must be non-zero at runtime). |
Definition at line 95 of file program_builder.h.
References Div.
|
inlinenodiscardnoexcept |
Divides a register by the value of another register (dst = dst / src).
| dst | Destination register index. |
| src | Source register index (must be non-zero at runtime). |
Definition at line 104 of file program_builder.h.
References Div.
|
inline |
Emits instructions to close a kernel I/O descriptor.
| code | Program buffer to append instructions to. |
| fdReg | Register index holding the open descriptor value at runtime. |
Definition at line 92 of file program_syscalls.h.
References Close, interrupt(), movImm(), movReg(), SYSCALL_ARG_REGISTERS, SYSCALL_ID_REGISTER, and SystemCall.
|
inline |
Emits instructions to open a kernel I/O resource.
Loads all arguments as immediates (resource id and flags are compile-time constants), then raises Interrupt::SystemCall. On return the assigned I/O descriptor value is available in SYSCALL_ID_REGISTER (R0).
| code | Program buffer to append instructions to. |
| resourceId | Numeric resource identifier registered with IIoManager. |
| kind | Resource kind (File, LanFile, SocketStream, etc.). |
| mode | Open mode flags. |
Definition at line 36 of file program_syscalls.h.
References interrupt(), movImm(), Open, SYSCALL_ARG_REGISTERS, SYSCALL_ID_REGISTER, and SystemCall.
|
inline |
Emits instructions to read one value from a kernel I/O descriptor.
The descriptor must be held in fdReg at runtime. On return the read value is available in SYSCALL_ID_REGISTER (R0).
| code | Program buffer to append instructions to. |
| fdReg | Register index holding the open descriptor value at runtime. |
Definition at line 59 of file program_syscalls.h.
References interrupt(), movImm(), movReg(), Read, SYSCALL_ARG_REGISTERS, SYSCALL_ID_REGISTER, and SystemCall.
|
inline |
Emits instructions to write one value to a kernel I/O descriptor.
Both the descriptor and the payload must be held in registers at runtime.
| code | Program buffer to append instructions to. |
| fdReg | Register index holding the open descriptor value at runtime. |
| valReg | Register index holding the value to write at runtime. |
Definition at line 76 of file program_syscalls.h.
References interrupt(), movImm(), movReg(), SYSCALL_ARG_REGISTERS, SYSCALL_ID_REGISTER, SystemCall, and Write.
|
nodiscardconstexprnoexcept |
Returns a human-readable name for the given error code.
Definition at line 46 of file error.h.
References AlreadyExists, BufferEmpty, BufferFull, DeadlockDetected, DeviceError, DivisionByZero, EndOfFile, InvalidAddress, InvalidArgument, InvalidInstruction, InvalidPid, InvalidState, NotFound, NotImplemented, Ok, OutOfMemory, PermissionDenied, ProcessNotFound, ResourceBusy, SegmentationFault, and Timeout.
|
inlinenodiscardnoexcept |
Halts the process unconditionally.
Definition at line 210 of file program_builder.h.
References Halt.
Returns whether the provided mode set contains a flag.
| value | Composite open mode. |
| flag | Single flag to test. |
Definition at line 65 of file file_descriptor.h.
|
nodiscardconstexprnoexcept |
Returns the human-readable mnemonic for an instruction.
Definition at line 22 of file isa.h.
References Add, And, Call, Compare, Div, Halt, Interrupt, JumpEqual, JumpGreater, JumpGreaterEqual, JumpLess, JumpLessEqual, JumpNotEqual, Mov, Mul, Nop, Or, Pop, Push, ReadMemory, Return, ShiftLeft, ShiftRight, Sub, WriteMemory, and Xor.
Raises a software interrupt.
| code | Interrupt kind (SystemCall, Exit, DeviceIO, etc.). |
Definition at line 196 of file program_builder.h.
References Interrupt.
Referenced by emitClose(), emitOpen(), emitRead(), and emitWrite().
|
nodiscardconstexprnoexcept |
|
nodiscardconstexprnoexcept |
|
nodiscardconstexprnoexcept |
|
nodiscardconstexprnoexcept |
Returns true if the instruction is a conditional or unconditional jump.
Definition at line 124 of file isa.h.
References JumpEqual, JumpGreater, JumpGreaterEqual, JumpLess, JumpLessEqual, and JumpNotEqual.
|
nodiscardconstexprnoexcept |
|
nodiscardconstexprnoexcept |
Returns true if the instruction involves memory access (ReadMemory, WriteMemory).
Definition at line 139 of file isa.h.
References ReadMemory, and WriteMemory.
|
nodiscardconstexprnoexcept |
|
nodiscardconstexprnoexcept |
Validates whether a transition from one process state to another is legal.
Legal transitions:
| from | Current state. |
| to | Target state. |
Definition at line 53 of file state.h.
References Blocked, New, Ready, Running, Suspended, and Terminated.
|
inlinenodiscardnoexcept |
Jumps to target if the last compare was equal.
| target | Instruction address to jump to. |
Definition at line 148 of file program_builder.h.
References JumpEqual.
|
inlinenodiscardnoexcept |
Jumps to target if the last compare was greater.
| target | Instruction address to jump to. |
Definition at line 164 of file program_builder.h.
References JumpGreater.
|
inlinenodiscardnoexcept |
Jumps to target if the last compare was greater or equal.
| target | Instruction address to jump to. |
Definition at line 180 of file program_builder.h.
References JumpGreaterEqual.
|
inlinenodiscardnoexcept |
Jumps to target if the last compare was less.
| target | Instruction address to jump to. |
Definition at line 172 of file program_builder.h.
References JumpLess.
|
inlinenodiscardnoexcept |
Jumps to target if the last compare was less or equal.
| target | Instruction address to jump to. |
Definition at line 188 of file program_builder.h.
References JumpLessEqual.
|
inlinenodiscardnoexcept |
Jumps to target if the last compare was not equal.
| target | Instruction address to jump to. |
Definition at line 156 of file program_builder.h.
References JumpNotEqual.
|
inlinenodiscard |
Convenience helper for constructing a trace event.
| timestamp | Event timestamp. |
| subsystem | Subsystem that emits the event. |
| operation | Operation name. |
| details | Optional details string. |
| depth | Current nesting depth. |
| level | Event severity. |
Definition at line 58 of file trace_event.h.
References Info, and contur::TraceEvent::timestamp.
|
inlinenodiscardnoexcept |
Loads an immediate value into a register.
| reg | Destination register index. |
| value | Immediate operand. |
Definition at line 23 of file program_builder.h.
References Mov.
Referenced by emitClose(), emitOpen(), emitRead(), and emitWrite().
|
inlinenodiscardnoexcept |
Copies the value of one register into another.
| dst | Destination register index. |
| src | Source register index. |
Definition at line 32 of file program_builder.h.
References Mov.
Referenced by emitClose(), emitRead(), and emitWrite().
|
inlinenodiscardnoexcept |
Multiplies a register by an immediate value (dst = dst * value).
| reg | Destination register index. |
| value | Immediate operand. |
Definition at line 77 of file program_builder.h.
References Mul.
|
inlinenodiscardnoexcept |
Multiplies a register by the value of another register (dst = dst * src).
| dst | Destination register index. |
| src | Source register index. |
Definition at line 86 of file program_builder.h.
References Mul.
|
inlinenodiscardnoexcept |
No-op — advances the program counter by one.
Definition at line 203 of file program_builder.h.
References Nop.
Returns bitwise AND combination of open-mode flags.
Definition at line 56 of file file_descriptor.h.
Returns bitwise OR combination of open-mode flags.
Definition at line 50 of file file_descriptor.h.
|
inlinenodiscardnoexcept |
Parses a decimal integer string into a RegisterValue.
| text | Input string (leading/trailing whitespace is ignored). |
Definition at line 30 of file fs_utils.h.
References contur::Result< T >::error(), InvalidState, and contur::Result< T >::ok().
Referenced by readFileValue().
|
nodiscardconstexprnoexcept |
Builds playback configuration from command payload values.
| command | Command payload. |
Definition at line 95 of file tui_commands.h.
|
nodiscardconstexprnoexcept |
Returns a human-readable name for the given priority level.
Definition at line 108 of file priority.h.
References AboveNormal, BelowNormal, High, Idle, Low, Normal, and Realtime.
|
nodiscardconstexprnoexcept |
|
inlinenodiscard |
Reads a RegisterValue stored as decimal text from a file.
Opens path for reading, reads up to 64 bytes, closes the descriptor, then parses the content as a decimal integer.
| fs | File system instance that owns the path. |
| path | Absolute path of the file to read. |
Definition at line 60 of file fs_utils.h.
References contur::IFileSystem::close(), EndOfFile, contur::Result< T >::error(), contur::IFileSystem::open(), parseRegisterValue(), Read, and contur::IFileSystem::read().
|
inlinenodiscardnoexcept |
Reads a value from a physical memory address into a register.
| reg | Destination register index. |
| addr | Physical memory address. |
Definition at line 113 of file program_builder.h.
References ReadMemory.
|
nodiscardconstexprnoexcept |
Returns the human-readable name of a register (e.g., "R0", "PC", "SP").
Definition at line 117 of file register_file.h.
References ProgramCounter, R0, R1, R10, R11, R12, R13, R2, R3, R4, R5, R6, R7, R8, R9, registerName(), and StackPointer.
Referenced by registerName().
|
inlinenodiscardnoexcept |
Subtracts an immediate value from a register (dst = dst - value).
| reg | Destination register index. |
| value | Immediate operand. |
Definition at line 59 of file program_builder.h.
References Sub.
|
inlinenodiscardnoexcept |
Subtracts the value of one register from another (dst = dst - src).
| dst | Destination register index. |
| src | Source register index. |
Definition at line 68 of file program_builder.h.
References Sub.
|
nodiscardconstexprnoexcept |
Converts TraceLevel to a human-readable string.
Definition at line 21 of file trace_level.h.
References Debug, Error, Info, and Warn.
Referenced by formatTraceEventLine().
|
inlinenodiscard |
Validates a TUI command payload.
| command | Command payload. |
Definition at line 79 of file tui_commands.h.
References commandRequiresInterval(), commandRequiresStep(), contur::Result< T >::error(), contur::TuiCommand::intervalMs, InvalidArgument, contur::TuiCommand::kind, contur::Result< T >::ok(), and contur::TuiCommand::step.
|
inlinenodiscard |
Validates autoplay configuration.
| config | Playback configuration to validate. |
Definition at line 67 of file tui_commands.h.
References contur::Result< T >::error(), contur::TuiPlaybackConfig::intervalMs, InvalidArgument, contur::Result< T >::ok(), and contur::TuiPlaybackConfig::step.
|
inlinenodiscard |
Writes a RegisterValue as decimal text to a file, truncating first.
Opens path with Create|Write|Truncate, serialises value with std::to_string, writes the bytes, then closes the descriptor.
| fs | File system instance that owns the path. |
| path | Absolute path of the file to write. |
| value | Value to serialise. |
Definition at line 94 of file fs_utils.h.
References contur::IFileSystem::close(), Create, contur::Result< T >::error(), contur::Result< T >::ok(), contur::IFileSystem::open(), Truncate, Write, and contur::IFileSystem::write().
|
inlinenodiscardnoexcept |
Writes a register value to a physical memory address.
| reg | Source register index. |
| addr | Physical memory address. |
Definition at line 122 of file program_builder.h.
References WriteMemory.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Default nice value (no adjustment).
Definition at line 37 of file priority.h.
Referenced by contur::Priority::Priority().
|
constexpr |
Maximum nice value (lowest boost).
Definition at line 34 of file priority.h.
Referenced by contur::Priority::clampNice().
|
constexpr |
Minimum nice value (highest boost).
Definition at line 31 of file priority.h.
Referenced by contur::Priority::clampNice().
|
constexpr |
|
constexpr |
Maximum number of CPU registers.
Definition at line 58 of file types.h.
Referenced by contur::RegisterFile::restore(), and contur::RegisterFile::snapshot().
|
constexpr |
Registers used to pass syscall arguments.
Definition at line 17 of file syscall_conventions.h.
Referenced by emitClose(), emitOpen(), emitRead(), and emitWrite().
|
constexpr |
Register used to pass syscall id and receive return value.
Definition at line 14 of file syscall_conventions.h.
Referenced by emitClose(), emitOpen(), emitRead(), and emitWrite().
|
constexpr |
Register used to store syscall status/error code.
Definition at line 25 of file syscall_conventions.h.