Contur 2
Educational OS kernel simulator
Loading...
Searching...
No Matches
contur Namespace Reference

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< RegisterValueparseRegisterValue (std::string_view text) noexcept
 Parses a decimal integer string into a RegisterValue.
Result< RegisterValuereadFileValue (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.

Typedef Documentation

◆ DeviceId

using contur::DeviceId = std::uint16_t

Unique identifier for an I/O device.

Definition at line 24 of file types.h.

◆ DispatcherLanes

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.

◆ FrameId

using contur::FrameId = std::uint32_t

Frame number in physical memory.

Definition at line 43 of file types.h.

◆ InodeId

using contur::InodeId = std::uint32_t

Unique identifier for a filesystem inode.

Definition at line 33 of file types.h.

◆ IoWakeCallback

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.

◆ MemoryAddress

using contur::MemoryAddress = std::uint32_t

Represents a memory address (physical or virtual).

Definition at line 15 of file types.h.

◆ ProcessId

using contur::ProcessId = std::uint32_t

Unique identifier for a process.

Definition at line 12 of file types.h.

◆ RegisterValue

using contur::RegisterValue = std::int32_t

Value stored in a CPU register.

Definition at line 21 of file types.h.

◆ ResourceId

using contur::ResourceId = std::uint32_t

Unique identifier for a synchronization resource (mutex, semaphore, etc.).

Definition at line 30 of file types.h.

◆ SubscriptionId

using contur::SubscriptionId = std::uint64_t

Unique identifier for an event subscription.

Definition at line 27 of file types.h.

◆ SyscallHandlerFn

Initial value:
std::function<Result<RegisterValue>(std::span<const RegisterValue> args, ProcessImage &caller)>
Full in-memory representation of a process.

Function signature used for syscall registration.

Definition at line 140 of file i_kernel.h.

◆ ThreadToken

using contur::ThreadToken = std::uint64_t

Host-thread token used by thread-aware deadlock tracking.

Definition at line 15 of file deadlock_detector.h.

◆ Tick

using contur::Tick = std::uint64_t

Simulation clock tick counter.

Definition at line 18 of file types.h.

Enumeration Type Documentation

◆ ErrorCode

enum class contur::ErrorCode : std::int32_t
strong

Error codes returned by kernel subsystem operations.

Enumerator
Ok 
OutOfMemory 
InvalidPid 
InvalidAddress 
DivisionByZero 
InvalidInstruction 
SegmentationFault 
DeviceError 
ProcessNotFound 
PermissionDenied 
Timeout 
DeadlockDetected 
InvalidState 
InvalidArgument 
ResourceBusy 
NotFound 
AlreadyExists 
BufferFull 
BufferEmpty 
EndOfFile 
NotImplemented 

Definition at line 20 of file error.h.

◆ InodeType

enum class contur::InodeType : std::uint8_t
strong

Type of filesystem node.

Enumerator
File 
Directory 

Definition at line 36 of file types.h.

◆ Instruction

enum class contur::Instruction : std::uint8_t
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.

Enumerator
Nop 

No operation.

Mov 

Move immediate/register → register.

Add 

Add: dst = dst + src.

Sub 

Subtract: dst = dst - src.

Mul 

Multiply: dst = dst * src.

Div 

Divide: dst = dst / src (may raise DivByZero).

And 

Bitwise AND: dst = dst & src.

Or 

Bitwise OR: dst = dst | src.

Xor 

Bitwise XOR: dst = dst ^ src.

ShiftLeft 

Left shift: dst = dst << src.

ShiftRight 

Right shift: dst = dst >> src.

Compare 

Compare two registers (sets flags).

JumpEqual 

Jump if equal (ZF set).

JumpNotEqual 

Jump if not equal (ZF clear).

JumpGreater 

Jump if greater.

JumpLess 

Jump if less.

JumpGreaterEqual 

Jump if greater or equal.

JumpLessEqual 

Jump if less or equal.

Push 

Push register onto stack.

Pop 

Pop top of stack into register.

Call 

Call subroutine (push PC, jump).

Return 

Return from subroutine (pop PC).

ReadMemory 

Read value from memory address into register.

WriteMemory 

Write register value to memory address.

Interrupt 

Software interrupt (syscall, exit, etc.).

Halt 

Halt execution.

Definition at line 15 of file instruction.h.

◆ Interrupt

enum class contur::Interrupt : std::int32_t
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.

Enumerator
Ok 

No interrupt — normal execution.

Error 

Generic error.

DivByZero 

Division by zero fault.

SystemCall 

Software interrupt — syscall entry.

PageFault 

Page not present in physical memory.

Exit 

Process requests termination.

NetworkIO 

Network I/O event.

Timer 

Timer tick interrupt (preemption).

DeviceIO 

Generic device I/O interrupt.

Definition at line 16 of file interrupt.h.

◆ IoResourceKind

enum class contur::IoResourceKind : std::uint8_t
strong

Resource kinds supported by the kernel I/O layer.

Enumerator
File 
LanFile 
SocketStream 
SocketMessage 

Definition at line 30 of file io_types.h.

◆ OpenMode

enum class contur::OpenMode : std::uint8_t
strong

Open mode bit flags.

Enumerator
None 
Read 
Write 
Create 
Truncate 
Append 

Definition at line 39 of file file_descriptor.h.

◆ PriorityLevel

enum class contur::PriorityLevel : std::int8_t
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.

Enumerator
Realtime 

Highest — time-critical, preempts everything.

High 

Above-normal urgency.

AboveNormal 

Slightly above default.

Normal 

Default priority for user processes.

BelowNormal 

Slightly below default.

Low 

Background tasks.

Idle 

Lowest — runs only when nothing else is ready.

Definition at line 19 of file priority.h.

◆ ProcessState

enum class contur::ProcessState : std::uint8_t
strong

All possible states in a process lifecycle.

Enumerator
New 

Process has been created but not yet admitted to the ready queue.

Ready 

Process is waiting in the ready queue for CPU time.

Running 

Process is currently executing on the CPU.

Blocked 

Process is waiting for an event (I/O, sync primitive, etc.).

Suspended 

Process has been swapped out of main memory.

Terminated 

Process has finished execution (exit or error).

Definition at line 28 of file state.h.

◆ Register

enum class contur::Register : std::uint8_t
strong

CPU register identifiers.

14 general-purpose registers (R0–R13) plus two special-purpose:

  • ProgramCounter (R14): points to the next instruction to execute
  • StackPointer (R15): points to the top of the process stack
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.

◆ StopReason

enum class contur::StopReason : std::uint8_t
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.

◆ SyncLayer

enum class contur::SyncLayer : std::uint8_t
strong

Distinguishes simulated sync resources from kernel-internal locks.

Enumerator
KernelInternal 
SimulatedResource 

Definition at line 15 of file i_sync_primitive.h.

◆ SyscallId

enum class contur::SyscallId : std::uint16_t
strong

Numeric identifiers for system calls.

Enumerator
Exit 

Terminate current process.

Write 

Write bytes to a kernel-managed sink.

Read 

Read bytes from a kernel-managed source.

Fork 

Create child process.

Exec 

Replace process image.

Wait 

Wait for child process.

Open 

Open file/device.

Close 

Close file/device.

CreatePipe 

Create IPC pipe.

SendMessage 

Send message to message queue.

ReceiveMessage 

Receive message from message queue.

ShmCreate 

Create shared-memory region.

ShmAttach 

Attach to shared-memory region.

MutexLock 

Lock mutex.

MutexUnlock 

Unlock mutex.

SemWait 

Wait/decrement semaphore.

SemSignal 

Signal/increment semaphore.

GetPid 

Query current process id.

GetTime 

Query simulation time.

Yield 

Voluntarily yield CPU.

Definition at line 11 of file syscall_ids.h.

◆ TraceLevel

enum class contur::TraceLevel : std::uint8_t
strong

Trace event severity.

Enumerator
Debug 
Info 
Warn 
Error 

Definition at line 12 of file trace_level.h.

◆ TuiCommandKind

enum class contur::TuiCommandKind : std::uint8_t
strong

Supported command kinds for TUI playback/navigation.

Enumerator
Tick 
AutoPlayStart 
AutoPlayStop 
Pause 
SeekBackward 
SeekForward 

Definition at line 14 of file tui_commands.h.

◆ TuiControllerState

enum class contur::TuiControllerState : std::uint8_t
strong

Controller state for playback lifecycle.

Enumerator
Idle 
Playing 
Paused 

Definition at line 20 of file i_tui_controller.h.

Function Documentation

◆ addImm()

Block contur::addImm ( std::uint8_t reg,
RegisterValue value )
inlinenodiscardnoexcept

Adds an immediate value to a register (dst = dst + value).

Parameters
regDestination register index.
valueImmediate operand.
Returns
Block encoding the add-immediate instruction.

Definition at line 41 of file program_builder.h.

References Add.

◆ addReg()

Block contur::addReg ( std::uint8_t dst,
std::uint8_t src )
inlinenodiscardnoexcept

Adds the value of one register to another (dst = dst + src).

Parameters
dstDestination register index.
srcSource register index.
Returns
Block encoding the add-register instruction.

Definition at line 50 of file program_builder.h.

References Add.

◆ commandRequiresInterval()

bool contur::commandRequiresInterval ( TuiCommandKind kind)
nodiscardconstexprnoexcept

Returns true when command kind requires non-zero interval value.

Parameters
kindCommand kind.
Returns
True only for autoplay-start commands.

Definition at line 59 of file tui_commands.h.

References AutoPlayStart.

Referenced by validateCommand().

◆ commandRequiresStep()

bool contur::commandRequiresStep ( TuiCommandKind kind)
nodiscardconstexprnoexcept

Returns true when command kind requires non-zero step value.

Parameters
kindCommand kind.
Returns
True for step-based commands.

Definition at line 50 of file tui_commands.h.

References AutoPlayStart, SeekBackward, SeekForward, and Tick.

Referenced by validateCommand().

◆ compareImm()

Block contur::compareImm ( std::uint8_t reg,
RegisterValue value )
inlinenodiscardnoexcept

Compares a register against an immediate value and sets flags.

Parameters
regRegister to compare.
valueImmediate operand.
Returns
Block encoding the compare-immediate instruction.

Definition at line 131 of file program_builder.h.

References Compare.

◆ compareReg()

Block contur::compareReg ( std::uint8_t reg,
std::uint8_t other )
inlinenodiscardnoexcept

Compares two registers and sets flags.

Parameters
regFirst register index.
otherSecond register index.
Returns
Block encoding the compare-register instruction.

Definition at line 140 of file program_builder.h.

References Compare.

◆ divImm()

Block contur::divImm ( std::uint8_t reg,
RegisterValue value )
inlinenodiscardnoexcept

Divides a register by an immediate value (dst = dst / value).

Parameters
regDestination register index.
valueImmediate operand (must be non-zero at runtime).
Returns
Block encoding the divide-immediate instruction.

Definition at line 95 of file program_builder.h.

References Div.

◆ divReg()

Block contur::divReg ( std::uint8_t dst,
std::uint8_t src )
inlinenodiscardnoexcept

Divides a register by the value of another register (dst = dst / src).

Parameters
dstDestination register index.
srcSource register index (must be non-zero at runtime).
Returns
Block encoding the divide-register instruction.

Definition at line 104 of file program_builder.h.

References Div.

◆ emitClose()

void contur::emitClose ( std::vector< Block > & code,
std::uint8_t fdReg )
inline

Emits instructions to close a kernel I/O descriptor.

Parameters
codeProgram buffer to append instructions to.
fdRegRegister 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.

◆ emitOpen()

void contur::emitOpen ( std::vector< Block > & code,
RegisterValue resourceId,
IoResourceKind kind,
OpenMode mode )
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).

Parameters
codeProgram buffer to append instructions to.
resourceIdNumeric resource identifier registered with IIoManager.
kindResource kind (File, LanFile, SocketStream, etc.).
modeOpen mode flags.

Definition at line 36 of file program_syscalls.h.

References interrupt(), movImm(), Open, SYSCALL_ARG_REGISTERS, SYSCALL_ID_REGISTER, and SystemCall.

◆ emitRead()

void contur::emitRead ( std::vector< Block > & code,
std::uint8_t fdReg )
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).

Parameters
codeProgram buffer to append instructions to.
fdRegRegister 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.

◆ emitWrite()

void contur::emitWrite ( std::vector< Block > & code,
std::uint8_t fdReg,
std::uint8_t valReg )
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.

Parameters
codeProgram buffer to append instructions to.
fdRegRegister index holding the open descriptor value at runtime.
valRegRegister 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.

◆ errorCodeToString()

std::string_view contur::errorCodeToString ( ErrorCode code)
nodiscardconstexprnoexcept

◆ halt()

Block contur::halt ( )
inlinenodiscardnoexcept

Halts the process unconditionally.

Returns
Block encoding the halt instruction.

Definition at line 210 of file program_builder.h.

References Halt.

◆ hasOpenMode()

bool contur::hasOpenMode ( OpenMode value,
OpenMode flag )
nodiscardconstexprnoexcept

Returns whether the provided mode set contains a flag.

Parameters
valueComposite open mode.
flagSingle flag to test.
Returns
True when flag exists in value.

Definition at line 65 of file file_descriptor.h.

◆ instructionName()

std::string_view contur::instructionName ( Instruction instr)
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.

◆ interrupt()

Block contur::interrupt ( Interrupt code)
inlinenodiscardnoexcept

Raises a software interrupt.

Parameters
codeInterrupt kind (SystemCall, Exit, DeviceIO, etc.).
Returns
Block encoding the interrupt instruction.

Definition at line 196 of file program_builder.h.

References Interrupt.

Referenced by emitClose(), emitOpen(), emitRead(), and emitWrite().

◆ interruptName()

std::string_view contur::interruptName ( Interrupt intr)
nodiscardconstexprnoexcept

Returns the human-readable name for an interrupt code.

Definition at line 83 of file isa.h.

References DeviceIO, DivByZero, Error, Exit, NetworkIO, Ok, PageFault, SystemCall, and Timer.

◆ isArithmetic()

bool contur::isArithmetic ( Instruction instr)
nodiscardconstexprnoexcept

Returns true if the instruction is an arithmetic operation (Add, Sub, Mul, Div).

Definition at line 110 of file isa.h.

References Add, Div, Mul, and Sub.

◆ isHalt()

bool contur::isHalt ( Instruction instr)
nodiscardconstexprnoexcept

Returns true if the instruction terminates execution flow (Halt, Interrupt with Exit).

Definition at line 145 of file isa.h.

References Halt.

◆ isJump()

bool contur::isJump ( Instruction instr)
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.

◆ isLogic()

bool contur::isLogic ( Instruction instr)
nodiscardconstexprnoexcept

Returns true if the instruction is a logic/bitwise operation (And, Or, Xor, Shift).

Definition at line 117 of file isa.h.

References And, Or, ShiftLeft, ShiftRight, and Xor.

◆ isMemoryOp()

bool contur::isMemoryOp ( Instruction instr)
nodiscardconstexprnoexcept

Returns true if the instruction involves memory access (ReadMemory, WriteMemory).

Definition at line 139 of file isa.h.

References ReadMemory, and WriteMemory.

◆ isStackOp()

bool contur::isStackOp ( Instruction instr)
nodiscardconstexprnoexcept

Returns true if the instruction affects the stack (Push, Pop, Call, Return).

Definition at line 132 of file isa.h.

References Call, Pop, Push, and Return.

◆ isValidTransition()

bool contur::isValidTransition ( ProcessState from,
ProcessState to )
nodiscardconstexprnoexcept

Validates whether a transition from one process state to another is legal.

Legal transitions:

  • New → Ready
  • Ready → Running, Suspended
  • Running → Ready (preempted / time slice expired)
  • Running → Blocked (waiting for I/O or sync)
  • Running → Terminated (exit or fatal error)
  • Blocked → Ready (event completed)
  • Blocked → Suspended (swapped out while blocked)
  • Suspended → Ready (swapped back in)
Parameters
fromCurrent state.
toTarget state.
Returns
true if the transition is valid, false otherwise.

Definition at line 53 of file state.h.

References Blocked, New, Ready, Running, Suspended, and Terminated.

◆ jumpEqual()

Block contur::jumpEqual ( RegisterValue target)
inlinenodiscardnoexcept

Jumps to target if the last compare was equal.

Parameters
targetInstruction address to jump to.
Returns
Block encoding the jump-equal instruction.

Definition at line 148 of file program_builder.h.

References JumpEqual.

◆ jumpGreater()

Block contur::jumpGreater ( RegisterValue target)
inlinenodiscardnoexcept

Jumps to target if the last compare was greater.

Parameters
targetInstruction address to jump to.
Returns
Block encoding the jump-greater instruction.

Definition at line 164 of file program_builder.h.

References JumpGreater.

◆ jumpGreaterEqual()

Block contur::jumpGreaterEqual ( RegisterValue target)
inlinenodiscardnoexcept

Jumps to target if the last compare was greater or equal.

Parameters
targetInstruction address to jump to.
Returns
Block encoding the jump-greater-or-equal instruction.

Definition at line 180 of file program_builder.h.

References JumpGreaterEqual.

◆ jumpLess()

Block contur::jumpLess ( RegisterValue target)
inlinenodiscardnoexcept

Jumps to target if the last compare was less.

Parameters
targetInstruction address to jump to.
Returns
Block encoding the jump-less instruction.

Definition at line 172 of file program_builder.h.

References JumpLess.

◆ jumpLessEqual()

Block contur::jumpLessEqual ( RegisterValue target)
inlinenodiscardnoexcept

Jumps to target if the last compare was less or equal.

Parameters
targetInstruction address to jump to.
Returns
Block encoding the jump-less-or-equal instruction.

Definition at line 188 of file program_builder.h.

References JumpLessEqual.

◆ jumpNotEqual()

Block contur::jumpNotEqual ( RegisterValue target)
inlinenodiscardnoexcept

Jumps to target if the last compare was not equal.

Parameters
targetInstruction address to jump to.
Returns
Block encoding the jump-not-equal instruction.

Definition at line 156 of file program_builder.h.

References JumpNotEqual.

◆ makeTraceEvent()

TraceEvent contur::makeTraceEvent ( Tick timestamp,
std::string_view subsystem,
std::string_view operation,
std::string_view details,
std::uint32_t depth,
TraceLevel level = TraceLevel::Info )
inlinenodiscard

Convenience helper for constructing a trace event.

Parameters
timestampEvent timestamp.
subsystemSubsystem that emits the event.
operationOperation name.
detailsOptional details string.
depthCurrent nesting depth.
levelEvent severity.
Returns
Fully initialized TraceEvent value.

Definition at line 58 of file trace_event.h.

References Info, and contur::TraceEvent::timestamp.

◆ movImm()

Block contur::movImm ( std::uint8_t reg,
RegisterValue value )
inlinenodiscardnoexcept

Loads an immediate value into a register.

Parameters
regDestination register index.
valueImmediate operand.
Returns
Block encoding the move-immediate instruction.

Definition at line 23 of file program_builder.h.

References Mov.

Referenced by emitClose(), emitOpen(), emitRead(), and emitWrite().

◆ movReg()

Block contur::movReg ( std::uint8_t dst,
std::uint8_t src )
inlinenodiscardnoexcept

Copies the value of one register into another.

Parameters
dstDestination register index.
srcSource register index.
Returns
Block encoding the move-register instruction.

Definition at line 32 of file program_builder.h.

References Mov.

Referenced by emitClose(), emitRead(), and emitWrite().

◆ mulImm()

Block contur::mulImm ( std::uint8_t reg,
RegisterValue value )
inlinenodiscardnoexcept

Multiplies a register by an immediate value (dst = dst * value).

Parameters
regDestination register index.
valueImmediate operand.
Returns
Block encoding the multiply-immediate instruction.

Definition at line 77 of file program_builder.h.

References Mul.

◆ mulReg()

Block contur::mulReg ( std::uint8_t dst,
std::uint8_t src )
inlinenodiscardnoexcept

Multiplies a register by the value of another register (dst = dst * src).

Parameters
dstDestination register index.
srcSource register index.
Returns
Block encoding the multiply-register instruction.

Definition at line 86 of file program_builder.h.

References Mul.

◆ nop()

Block contur::nop ( )
inlinenodiscardnoexcept

No-op — advances the program counter by one.

Returns
Block encoding the nop instruction.

Definition at line 203 of file program_builder.h.

References Nop.

◆ operator&()

OpenMode contur::operator& ( OpenMode lhs,
OpenMode rhs )
nodiscardconstexprnoexcept

Returns bitwise AND combination of open-mode flags.

Definition at line 56 of file file_descriptor.h.

◆ operator|()

OpenMode contur::operator| ( OpenMode lhs,
OpenMode rhs )
nodiscardconstexprnoexcept

Returns bitwise OR combination of open-mode flags.

Definition at line 50 of file file_descriptor.h.

◆ parseRegisterValue()

Result< RegisterValue > contur::parseRegisterValue ( std::string_view text)
inlinenodiscardnoexcept

Parses a decimal integer string into a RegisterValue.

Parameters
textInput string (leading/trailing whitespace is ignored).
Returns
Parsed value on success; InvalidState if the string is not a valid integer.

Definition at line 30 of file fs_utils.h.

References contur::Result< T >::error(), InvalidState, and contur::Result< T >::ok().

Referenced by readFileValue().

◆ playbackConfigFromCommand()

TuiPlaybackConfig contur::playbackConfigFromCommand ( const TuiCommand & command)
nodiscardconstexprnoexcept

Builds playback configuration from command payload values.

Parameters
commandCommand payload.
Returns
Playback configuration using command interval/step values.

Definition at line 95 of file tui_commands.h.

◆ priorityLevelName()

std::string_view contur::priorityLevelName ( PriorityLevel level)
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.

◆ processStateName()

std::string_view contur::processStateName ( ProcessState state)
nodiscardconstexprnoexcept

Returns a human-readable name for the given process state.

Definition at line 79 of file state.h.

References Blocked, New, Ready, Running, Suspended, and Terminated.

◆ readFileValue()

Result< RegisterValue > contur::readFileValue ( IFileSystem & fs,
const std::string & path )
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.

Parameters
fsFile system instance that owns the path.
pathAbsolute path of the file to read.
Returns
Parsed value on success; NotFound/EndOfFile/InvalidState on failure.

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().

◆ readMem()

Block contur::readMem ( std::uint8_t reg,
MemoryAddress addr )
inlinenodiscardnoexcept

Reads a value from a physical memory address into a register.

Parameters
regDestination register index.
addrPhysical memory address.
Returns
Block encoding the read-memory instruction.

Definition at line 113 of file program_builder.h.

References ReadMemory.

◆ registerName()

std::string_view contur::registerName ( Register reg)
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().

◆ subImm()

Block contur::subImm ( std::uint8_t reg,
RegisterValue value )
inlinenodiscardnoexcept

Subtracts an immediate value from a register (dst = dst - value).

Parameters
regDestination register index.
valueImmediate operand.
Returns
Block encoding the subtract-immediate instruction.

Definition at line 59 of file program_builder.h.

References Sub.

◆ subReg()

Block contur::subReg ( std::uint8_t dst,
std::uint8_t src )
inlinenodiscardnoexcept

Subtracts the value of one register from another (dst = dst - src).

Parameters
dstDestination register index.
srcSource register index.
Returns
Block encoding the subtract-register instruction.

Definition at line 68 of file program_builder.h.

References Sub.

◆ traceLevelToString()

std::string_view contur::traceLevelToString ( TraceLevel level)
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().

◆ validateCommand()

Result< void > contur::validateCommand ( const TuiCommand & command)
inlinenodiscard

Validates a TUI command payload.

Parameters
commandCommand payload.
Returns
Ok for valid command fields or InvalidArgument.

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.

◆ validatePlaybackConfig()

Result< void > contur::validatePlaybackConfig ( const TuiPlaybackConfig & config)
inlinenodiscard

Validates autoplay configuration.

Parameters
configPlayback configuration to validate.
Returns
Ok for valid config or InvalidArgument on invalid fields.

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.

◆ writeFileValue()

Result< void > contur::writeFileValue ( IFileSystem & fs,
const std::string & path,
RegisterValue value )
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.

Parameters
fsFile system instance that owns the path.
pathAbsolute path of the file to write.
valueValue to serialise.
Returns
Ok on success; error code on open/write/close failure.

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().

◆ writeMem()

Block contur::writeMem ( std::uint8_t reg,
MemoryAddress addr )
inlinenodiscardnoexcept

Writes a register value to a physical memory address.

Parameters
regSource register index.
addrPhysical memory address.
Returns
Block encoding the write-memory instruction.

Definition at line 122 of file program_builder.h.

References WriteMemory.

Variable Documentation

◆ DEFAULT_TIME_SLICE

Tick contur::DEFAULT_TIME_SLICE = 4
constexpr

Default time slice for Round Robin scheduling (in ticks).

Definition at line 61 of file types.h.

◆ INSTRUCTION_COUNT

std::uint8_t contur::INSTRUCTION_COUNT = 25
constexpr

Total number of defined instructions.

Definition at line 19 of file isa.h.

◆ INVALID_FRAME

FrameId contur::INVALID_FRAME = 0xFFFFFFFF
constexpr

Sentinel value indicating an invalid frame.

Definition at line 52 of file types.h.

◆ INVALID_INODE_ID

InodeId contur::INVALID_INODE_ID = 0
constexpr

Sentinel value indicating an invalid inode identifier.

Definition at line 55 of file types.h.

◆ INVALID_PID

ProcessId contur::INVALID_PID = 0
constexpr

Sentinel value indicating an invalid/unassigned process ID.

Definition at line 46 of file types.h.

◆ MAX_PROCESSES

ProcessId contur::MAX_PROCESSES = 1024
constexpr

Maximum number of processes the kernel can manage.

Definition at line 64 of file types.h.

◆ NICE_DEFAULT

std::int32_t contur::NICE_DEFAULT = 0
constexpr

Default nice value (no adjustment).

Definition at line 37 of file priority.h.

Referenced by contur::Priority::Priority().

◆ NICE_MAX

std::int32_t contur::NICE_MAX = 19
constexpr

Maximum nice value (lowest boost).

Definition at line 34 of file priority.h.

Referenced by contur::Priority::clampNice().

◆ NICE_MIN

std::int32_t contur::NICE_MIN = -20
constexpr

Minimum nice value (highest boost).

Definition at line 31 of file priority.h.

Referenced by contur::Priority::clampNice().

◆ NULL_ADDRESS

MemoryAddress contur::NULL_ADDRESS = 0xFFFFFFFF
constexpr

Sentinel value indicating an invalid/null memory address.

Definition at line 49 of file types.h.

◆ REGISTER_COUNT

std::uint8_t contur::REGISTER_COUNT = 16
constexpr

Maximum number of CPU registers.

Definition at line 58 of file types.h.

Referenced by contur::RegisterFile::restore(), and contur::RegisterFile::snapshot().

◆ SYSCALL_ARG_REGISTERS

std::array<std::uint8_t, 4> contur::SYSCALL_ARG_REGISTERS
constexpr
Initial value:
= {
static_cast<std::uint8_t>(Register::R1),
static_cast<std::uint8_t>(Register::R2),
static_cast<std::uint8_t>(Register::R3),
static_cast<std::uint8_t>(Register::R4),
}

Registers used to pass syscall arguments.

Definition at line 17 of file syscall_conventions.h.

Referenced by emitClose(), emitOpen(), emitRead(), and emitWrite().

◆ SYSCALL_ID_REGISTER

std::uint8_t contur::SYSCALL_ID_REGISTER = static_cast<std::uint8_t>(Register::R0)
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().

◆ SYSCALL_STATUS_REGISTER

std::uint8_t contur::SYSCALL_STATUS_REGISTER = static_cast<std::uint8_t>(Register::R7)
constexpr

Register used to store syscall status/error code.

Definition at line 25 of file syscall_conventions.h.