`xenora probe` and `xenora imports sync` defaulted to a folder named after
one commercial game. Give both one shared default, `diagnostics/probe`, and
ignore it in Git. Keep the old ignore rules so existing local reports stay
out of commits.
Closes#364
Signed-off-by: jelly013 <22855910+jelly013@users.noreply.github.com>
- Check the mapping budget before anything is mapped, and map the header
bytes straight from the file instead of copying them first.
- Refuse bytes that are not the PE32+ headers that were parsed: the
optional header magic and size, the section count, the preferred base
and SizeOfHeaders must agree before anything is patched.
- Write the load base into the mapped ImageBase field after relocations
are applied, so a DIR64 entry aimed at that field cannot move it twice.
- Describe the ImageBase rewrite as Xenora's policy, and document the
zero fill past SizeOfHeaders and the stricter page rule.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
* gpu: bind a texture and sampler to guest draws through descriptor tables (#303)
A guest command list had no way to bind a texture: GraphicsCommand stopped
at vertex and index buffers. This adds the smallest D3D12-shaped binding the
translated image_sample_lz pixel stage needs: shader-visible CBV_SRV_UAV and
sampler heaps, CreateShaderResourceView for one-level RGBA8 and BC1 2D
textures, a point/clamp CreateSampler, a root signature with one pixel-stage
SRV table and one sampler table, and SetDescriptorHeaps and
SetGraphicsRootDescriptorTable. Everything else fails explicitly before any
draw.
The native path hands the bound level to a textured backend.
NativeCompute::render_rgba8_sampled_bc1 binds a BC1 level natively to
fragment texture 0 and sampler 0. The software reference point-samples with
clamp addressing.
BC1 fixtures use only endpoint colours. Apple's hardware decoder gives
171/84 for the interpolated palette entries where the spec-exact decoder
gives 170/85.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* gpu: tighten guest texture binding after independent review (#303)
The independent review found binding rules that diverged from D3D12:
changing descriptor heaps kept tables bound in the old heaps, setting the
same root signature again cleared its tables, and unsupported draw shapes
were drawn as one triangle. Now heap changes and a different root signature
invalidate tables, while redundant sets keep them. Table bases are checked
against the bound heap of their type when bound. Textured draws other than
one instance of three vertices fail, and zero vertices or instances draw
nothing.
Descriptor handle offsets can no longer carry into another heap's ID. SRVs
of array or multi-level textures are rejected. A texture whose state
excludes pixel-shader reads is not sampled. Vertex buffer offsets are
overflow-checked. The tests now cover swapped root parameters, a second
sampler slot, off-centre and out-of-range coordinates, state transitions,
draw shapes and resource bounds.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* loader: format the guest texture test (#303)
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* gpu: close the review's remaining texture-binding gaps (#303)
The re-review found three partial fixes. The public software reference
could overflow on a huge viewport. A texture in a combined write and read
state could be sampled. The sampler-slot test used two identical filled
slots. The viewport is now bounded to 4096 pixels. A sampled texture must be
COMMON or a read-only state that includes PIXEL_SHADER_RESOURCE. The sampler
heap now leaves its middle slot empty. The docs now state the start-instance
rule and when table bases are checked.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
---------
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
Windows maps the first SizeOfHeaders bytes of an image read-only at its
base, and programs read them: the mingw-w64 C runtime walks its own
section table before main. The loader mapped sections only, so that read
faulted.
Map the headers in whole 4 KiB pages before the sections, with the
optional header's ImageBase field set to the base the image is loaded
at. Refuse the load with PeError::InvalidHeaderSize when SizeOfHeaders
ends before the section table, runs past the file, or its pages reach
into a section. The header pages count toward the mapping budget.
ParsedPe::parse is unchanged.
The hand-built image in pe_mapping_limits.rs wrote SizeOfHeaders as
zero; it now writes a valid value.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
Address review on the delay-import probe change:
- Read only descriptors inside the delay import directory's declared
size, and require that size to hold the terminating empty descriptor.
- Require each descriptor's DLL name, import address table and import
name table to be present and to start in section data, with a
diagnostic naming the missing field.
- Leave delayed rows out of the xenora imports sync backlog, so its
totals stay ordinary-only.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
Read the PE32+ delay-load directory (data directory 13) with a bounded
parser and list each delay-loaded import in imports.csv, marked by a new
import_table column. Ordinary totals and missing_imports.csv are
unchanged; the JSON report counts delayed slots and DLLs separately and
carries a diagnostic for truncated, out-of-range or unsupported tables.
Adds an original fixture with ordinary and delayed imports, generated by
fixtures/pe/delay-imports.py and cross-checked with llvm-readobj.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
Exit functions are guest code run through callback tasks in reverse
registration order. Table storage lives on the default guest heap.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
The guest sees a configurable simulated machine, kept separate from the
detected host hardware. Sleeping goes through the injectable clock.
Move the PE fixture harness into a shared test support module.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Add callback tasks to the import dispatcher. A task runs guest callbacks
on a reserved stack frame, checks the nonvolatile registers after each,
and returns to the original caller. Use it for qsort, qsort_s, bsearch,
bsearch_s, _initterm, _initterm_e, InitOnceExecuteOnce and FlsFree
cleanup callbacks.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Ownership is keyed by guest TEB. Operations that would block another
guest thread stop with the runtime-limit fault because no guest
scheduler exists. Also stop the import generator from overriding the
semaphore handlers with stubs, and check every generator standard
service against the loader registry.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Add gfx1030 decoding, semantic validation, Metal shader generation, and an independent CPU interpreter for three reproducible compute fixtures. Include native Metal tests, LLVM fixture verification, and the existing CI and Phase 01 handoff.
Verified formatting, all-features Clippy and tests, LLVM decoding, native ARM64 linkage, and all three demo fixtures with Metal API and shader validation enabled.
Signed-off-by: Ranveer Soni <git@ranveersoni.me>