Files
betterxen/crates/loader/src/lib.rs
T
jelly013 84866956b9 runtime: add a deterministic guest thread scheduler
Run guest threads on one host thread with independent CPU contexts, guarded
stacks and TEBs, in first-in, first-out order with bounded turns that end at
translated-block boundaries. Add CreateThread, ExitThread, TerminateThread,
GetExitCodeThread, SuspendThread, ResumeThread and SwitchToThread, and let
waits on threads, events, semaphores and mutexes block only the caller.
Report deadlocks, abandoned mutexes and per-thread faults.

Reclaim per-thread state at thread end without passing held locks to a thread
that reuses the TEB address, and bound pending one-time initializations.
Guest threads never run concurrently. Critical sections, SRW locks,
condition variables and Sleep do not block per thread yet.

Verify with C programs compiled for x86-64 Windows and run as translated
guest code at several quanta.

Refs #323

Signed-off-by: jelly013 <22855910+jelly013@users.noreply.github.com>
2026-11-24 17:47:01 +01:00

60 lines
1.9 KiB
Rust

// SPDX-License-Identifier: GPL-3.0-or-later
//! Xenora Loader crate.
//!
//! Provides PE32+ parsing, isolated guest virtual memory, bounded x86-64 CPU
//! execution bootstrap, and read-only binary triage.
pub mod arm64;
pub mod cpu;
pub mod dbt;
pub mod graphics;
pub mod import_table;
pub mod imports;
pub mod jit;
pub mod memory;
pub mod pe;
pub mod probe;
pub mod reloc;
pub mod runtime;
#[rustfmt::skip]
pub mod runtime_table;
pub mod scheduler;
pub mod services;
pub mod softfloat;
pub mod startup;
pub mod tasks;
pub mod tls;
pub mod triage;
pub mod x86_decode;
pub mod x86_exec;
pub mod x86_float;
pub mod x86_simd;
#[rustfmt::skip]
pub mod x86_table;
pub use arm64::Arm64Assembler;
pub use cpu::{CpuState, ExecutionResult, ExitReason, Interpreter, RFlags, Register};
pub use dbt::{DbtEngine, DbtMetrics};
pub use graphics::{
BackendRenderer, CommandListType, ExecutionOutcome, FramePresentation, GraphicsBackendId,
GraphicsCommand, GraphicsCommandAllocator, GraphicsCommandList, GraphicsCommandQueue,
GraphicsContext, GraphicsError, GraphicsHandle, GraphicsResource, ResourceDesc,
ResourceDimension, ResourceStates,
};
pub use imports::{ImportError, ImportRegistry, ServiceDescriptor, ServiceHandler, Win64Args};
pub use jit::{JitError, JitMemory};
pub use memory::{GuestMemory, MemoryError, MemoryPermissions};
pub use pe::{LoadedImage, ParsedPe, PeError, PeSection};
pub use probe::{
ImportedSymbol, InstructionRecord, ProbeConfig, ProbeReport, RelocationCensus, TlsCensus,
probe_pe_bytes, run_probe_and_export,
};
pub use reloc::{
IMAGE_REL_BASED_ABSOLUTE, IMAGE_REL_BASED_DIR64, RelocationError, RelocationReport,
apply_relocations,
};
pub use services::{Clock, MockClock, ServicesState, SystemClock, register_standard_services};
pub use tls::{TlsDirectory, TlsError, execute_tls_callbacks, parse_tls_directory, setup_tls};
pub use triage::{TriageReport, triage_bytes, triage_file};