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>
main keeps the last error per TEB since #310. This adds the missing
retirement step, so a reused TEB address starts at zero, and two
conformance tests: a successful call keeps a nonzero error, and one
thread's failure does not reach another.
Signed-off-by: LanaCodes-Boop <139008131+LanaCodes-Boop@users.noreply.github.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>
Pin MXCSR for a flushed exact tiny result, PE for unmasked overflow and
underflow, and run the sweeps with each exception unmasked alone. Require a
refused form to stop at its exact instruction with all state unchanged,
assert the cached DBT run hits the cache, and check the fallback counter for
every straight-line case. Add a faulting zero-count memory shift.
The tighter checks expose one more defect, kept as an ignored test: an exact
unmasked overflow sets PE as well as OE.
Correct the chronology: 700 table cases were written before the CPU source
was read, and the other cases and the sweeps afterwards. The message of
1c5c320 says otherwise.
Signed-off-by: jelly013 <22855910+jelly013@users.noreply.github.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 727 cases and definition-based sweeps for the guest CPU, derived from
the Intel SDM (revision 093) before the CPU code was read. The interpreter
and the DBT run the same cases.
588 cases are verified, 133 use forms both engines refuse, and four ignored
tests state open defects: stale DBT blocks after the guest rewrites code,
the address of a page-crossing fault, and the fault class of a
non-canonical address and of an instruction over 15 bytes.
Signed-off-by: jelly013 <22855910+jelly013@users.noreply.github.com>
BSF, BSR and BT were decoded and executed by the interpreter, but every
occurrence of them in a translated block fell back to the shared semantics,
because `is_native` did not list them. The static probe therefore counted
them among the instructions the ARM64 DBT does not support.
Lower them to ARM64:
- BSF writes the index of the lowest set bit of the source and BSR the index
of the highest set bit. The lowest set bit is the highest set bit of the
reversed value, so BSF is `RBIT` followed by `CLZ`, and BSR is 63 minus the
leading zero count.
- A zero source sets the zero flag and leaves the destination undefined, so
the destination keeps its value. The interpreter and the independent
reference apply the same rule, and the reference marks the destination as
undefined so it is not compared.
- BT sets the carry flag from the tested bit, with the bit index masked to
the operand width. The bit string is not modified.
Only the `0F A3` form of BT is lowered. The `0F BA` group form takes an
immediate index and may write memory, so it stays on the shared semantics and
is not advertised as natively supported.
The new encodings of RBIT, CLZ and LSLV were cross-checked against LLVM 23.1.6
`llvm-mc -show-encoding`.
The BSF, BSR and BT fixtures in `tests/x86/integer.txt` already cover the
16-bit, 32-bit and 64-bit forms with register and memory sources, and the
fixture test asserts that a native form never reaches the shared-semantics
helper, so those fixtures now exercise the new native path against the
independent reference. A new test pins the zero source, the highest bit, the
operand widths, the flag results and the masked bit index.
Closes#196
Signed-off-by: Swastick Chowdhury <28708247+Swastickc@users.noreply.github.com>
Restore the six #280 regression tests that the merge resolving #280's
conflict with #283 removed. Add FS and GS RIP-relative loads and stores
with positive and negative displacements, a differential run comparing
the native DBT and interpreter registers and memory bytes, and
RIP-relative faults reporting the segment-adjusted address. Make the
existing differential test compare both paths' memory.
Signed-off-by: Swastick Chowdhury <28708247+Swastickc@users.noreply.github.com>