mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-26 12:20:42 +00:00
Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0214a7bab5 | ||
|
|
7dd1329866 | ||
|
|
4b579af70d | ||
|
|
9dfdfd1134 | ||
|
|
8df13ae976 | ||
|
|
36c4fbd520 | ||
|
|
3c8b6bad97 | ||
|
|
d4c29cd7dd | ||
|
|
02eb8046a1 | ||
|
|
4a0b5d4ded | ||
|
|
00eb6971e9 | ||
|
|
c3b0025977 | ||
|
|
7c88e5d655 | ||
|
|
bb318ed2ba | ||
|
|
b1b57cf16a | ||
|
|
cdcc55c33e | ||
|
|
0730f4dbbf | ||
|
|
6f27da3ccc | ||
|
|
e5aca73c55 | ||
|
|
281d92bfb5 | ||
|
|
fec13fa27a | ||
|
|
c1cea65e17 | ||
|
|
3d19c756e2 | ||
|
|
823a5812a0 | ||
|
|
de92766b29 | ||
|
|
4d44765363 | ||
|
|
403a67747f |
No files matched your search
@@ -52,6 +52,8 @@ jobs:
|
||||
sh -n scripts/agent-queue.sh scripts/agent-sync.sh
|
||||
- name: Test pull request template check
|
||||
run: PYTHONPATH=scripts python3 -m unittest discover -s tests/pr_template
|
||||
- name: Test native audit JSON decoding
|
||||
run: python3 -m unittest discover -s tests/audit
|
||||
- name: Test semantic registry generator and coverage report
|
||||
run: |
|
||||
python3 -m unittest discover -s tests/semantics_generator
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
__pycache__/
|
||||
*.pyc
|
||||
/diagnostics/probe/
|
||||
/diagnostics/gta6-candidate-*/
|
||||
/diagnostics/gta6-check/
|
||||
|
||||
|
||||
@@ -10,8 +10,11 @@ Guest execution uses original, purpose-built test programs. Commercial Xbox game
|
||||
remains unsupported.
|
||||
|
||||
### Changed
|
||||
- Removed the temporary region-list allocation from each instruction-byte fetch while preserving lookup order, execute-permission checks and error behavior (part of #104).
|
||||
- Release and bench builds now use fat link-time optimization with one codegen unit (#116). On a local Apple M5, `dbt_bench` medians over five alternating runs dropped by about 6 % for the interpreter (903 to 845 µs) and about 9 % for cold DBT (1.155 to 1.046 ms), while warm DBT (cache hits) became about 2 % slower (21.83-22.08 to 22.29-22.54 µs over four further runs). The `xenora` binary shrank from 2.73 to 2.11 MB. A clean release build of the workspace takes about 14 s instead of 6 s. Debug and test builds are unchanged.
|
||||
- The ARM64 assembler loads 64-bit constants with the fewest MOVZ or MOVN plus MOVK instructions (#92). It no longer emits MOVK for zero halfwords and starts from MOVN when more halfwords are 0xFFFF than zero, so small negative values take one instruction instead of four. On Apple M5 the DBT benchmark emits 245,168 instead of 290,184 native bytes for its 626 blocks (-15.5%) and the 1,048 integer fixture instructions 128,724 instead of 145,732 (-11.7%); benchmark run times did not change measurably. New tests check the sequences against LLVM encodings and execute 1,056 of them on the host through the JIT.
|
||||
- Resolve the tiled BC1 mip and array layer once per linearization and copy contiguous block runs within each tile row. Partial edge blocks are retained and padding slots are skipped. Closes #349.
|
||||
- Changed the default report folder of `xenora probe` and `xenora imports sync` to `diagnostics/probe`, which Git ignores (#364). Anyone relying on the earlier default has to pass `--report`.
|
||||
- Relocation reports now build their type histogram once per image, avoiding a tree lookup for every entry. Target checks and fixup order are unchanged; synthetic regressions and an opt-in relocation timing test cover the change (#109).
|
||||
- Moved the six supported gfx1030 SOPP compute control forms into the semantic registry, preserving instruction decoding and shader lowering. Part of #215.
|
||||
- Moved gfx1030 `s_mov_b32` (SOP1) into the semantic registry, preserving its existing decode domain and shader output. The move operand rule retains explicit VCC and EXEC half destinations. Part of #215.
|
||||
@@ -19,10 +22,15 @@ remains unsupported.
|
||||
- Added non-blocking Metal compute submission through `submit_words` and `wait`, with completion-aware resource retirement and a sixteen-dispatch in-flight limit. Synchronous calls keep their existing behavior. The benchmark reports the host submission split and compares synchronous and pipelined batches.
|
||||
- Extended the read-only RDNA2 planning CLI (`python3 -m qa rdna2`) with family/status filters, compact summaries, Codex-ready manifests under `artifacts/`, active-claim exclusion (family claims exclude those families; path-only claims block overlapping permitted files), coverage reconcile against `semantic_coverage` without inflating counts, and inventory diffs. Covered by `tests/qa/test_rdna2_plan.py`; planning only, no GPU production edits.
|
||||
|
||||
### Fixed
|
||||
- Made the native semantic-review timeout in `scripts/test-gpu.sh` configurable with `XENORA_SEMANTIC_TIMEOUT` and raised its default from 120 to 300 seconds, so cold Apple Silicon runs do not fail while the expanded Metal known-answer suite is still progressing.
|
||||
|
||||
### Added
|
||||
- Added a documented independent acceptance rule for promoting AMD RDNA2 desktop GPU (gfx1030) forms from local CPU and Metal results to `fixture verified`, including clean-commit evidence, reviewer independence, raw-log location, review-log summary, failure handling and status regeneration (#302).
|
||||
- Added the VOP3A (`_e64`) encodings of eleven gfx1030 VOP2 integer forms (`v_mul_{i32_i24,hi_i32_i24,u32_u24,hi_u32_u24}`, `v_{min,max}_{i32,u32}`, `v_xnor_b32`, `v_sub_nc_u32`, `v_subrev_nc_u32`) and of the sixteen Wave32 integer compares (explicit SGPR mask destination, `s_cbranch_vccz` through `vcc_lo`, a translation error for reads of runtime-only SGPR results) as semantic-registry encoding variants, with VGPR sources only. New fixtures `vop3-integer` and `vop3-compare` with IR and MSL goldens, and an independent guide-derived oracle (`tests/validation/tests/vop3_{integer,compare}.rs`) that agrees on both reference interpreters and on native Metal. Part of #215.
|
||||
- Added guest texture binding through D3D12-style descriptor tables (#303): 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`/`SetGraphicsRootDescriptorTable` in `crates/loader/src/graphics.rs`, plus `NativeCompute::render_rgba8_sampled_bc1`. Verified locally on an Apple M5 Pro under Metal validation: a guest draw with the translated `image_sample_lz` pixel stage matches the software reference and hand-derived images on 16 of 16 pixels for two RGBA8 textures and 64 of 64 for an 8×8 BC1 texture. A wrong descriptor slot changes the image, off-centre and out-of-range coordinates point-sample with clamping, and a rejected binding, draw shape or resource state never reaches the backend. The software reference samples BC1 with the spec-exact decoder, while Apple's hardware rounds BC1's interpolated palette entries differently (171/84 against 170/85), so the BC1 fixtures use only endpoint colours. Not yet reachable from guest imports. Not yet independently accepted.
|
||||
- Added the accumulator short form of XCHG, opcodes 91 to 97 and 90 with REX.B, at 16, 32 and 64 bits (part of #118). Assemblers choose this form whenever one operand is the accumulator, and both engines used to stop on it with an illegal-instruction exit. A 16-bit exchange keeps the upper 48 bits of both registers, a 32-bit one clears both upper halves, and `49 90` exchanges RAX with R8 while plain `90` stays NOP. Both engines run the shared semantics; nothing is lowered to ARM64. Three SDM-derived cases already in `cpu_known_answers.rs` moved from refused to verified, and `tests/x86/integer.txt` gains 20 assembled instructions checked by the text-only reference in `x86_integer.rs`. F3 before this form, 16-bit PUSH and POP and LODSW stay rejected. Not compared with x86 hardware; awaiting independent review.
|
||||
- Added RCL and RCR, the rotates through the carry flag, for 8-, 16-, 32- and 64-bit register and memory operands with a count of one, CL or an immediate (part of #121). The count is masked to five bits (six for 64-bit operands) and then reduced modulo 9 or 17 for 8- and 16-bit operands; a masked count of zero changes nothing, CF receives the last bit rotated out, and OF is set only for a count of one. Both engines run the shared semantics; nothing is lowered to ARM64. Fourteen SDM-derived cases already in `cpu_known_answers.rs` moved from refused to verified, and its shift sweep now runs both instructions at every width, count and carry against its bit-loop model. `tests/x86/integer.txt` gains 80 assembled RCL and RCR instructions, checked by the single-step reference in `x86_integer.rs`. SHLD and SHRD stay rejected. Not compared with x86 hardware; awaiting independent review.
|
||||
- Added four Wave32 gfx1030 VOP2 select and carry forms through the semantic registry. Conditional select, add with carry and both subtract orders with borrow use a per-lane VCC bit and have a guide-derived oracle that passes on both CPU interpreters and on native Metal (local Apple M5, API and shader validation); independent acceptance is pending. Part of #215.
|
||||
- Added decoding and Metal shader translation for twelve Wave32 VOPC 16-bit integer compares (#215). The signed and unsigned forms compare the low 16 bits of each source and write the Wave32 VCC mask. CPU verification covers 1,572 compiler acceptance cases and 408 rejections from the guide-derived oracle, which also passes on native Metal (1,572 cases in 1,420 programs on a local Apple M5 under API and shader validation); acceptance is pending.
|
||||
- Added MOVS and STOS for 8- to 64-bit elements, with and without REP, and the direction flag with CLD and STD (#129). A REP form runs one element per step and stays on the instruction until RCX is zero, so every element counts against the step budget, a repeat can stop part-way and resume, a zero count touches nothing, and a fault keeps the elements already done with RSI, RDI and RCX at the one that faulted. An FS or GS override applies to the MOVS source only. Both engines run these on the shared semantics with no bulk-copy path, so large copies are slow. LODS, CMPS, SCAS, REPE, REPNE and the address-size override stay rejected. Fourteen SDM-derived cases already in `cpu_known_answers.rs` moved from refused to verified, and `tests/cpu_rep.rs` adds a byte-array model over every form, direction and count; not compared with x86 hardware and awaiting independent review.
|
||||
@@ -191,7 +199,10 @@ remains unsupported.
|
||||
native DBT.
|
||||
|
||||
### Fixed
|
||||
- Fixed the native dependency audit reading Cargo JSON and inspection-tool output in the process locale encoding; it now reads and reports UTF-8 paths and diagnostics under an ASCII locale (#363).
|
||||
- Made the static probe and the binder share one bounded import parser, after the truncated-name fix for #270. Truncated, unterminated, empty or non-ASCII names, reserved bits and endless tables are reported by the probe and refused by the binder.
|
||||
- Fixed the MXCSR flags of an unmasked floating-point overflow whose result is exact before the exponent is bounded, such as the largest binary32 value times two (#128). Only the overflow flag is set; the precision flag used to be set as well although nothing was rounded. A masked overflow still sets both flags and delivers infinity or the largest finite value, and an unmasked overflow that is also inexact still sets both. Five Intel SDM cases in `cpu_known_answers.rs` moved from open defect to verified on both engines, with three more for the other rounding modes, and the scalar and conversion sweeps now compare the precision flag in this case as well. Not compared with x86 hardware; awaiting independent review.
|
||||
- Fixed the decoder refusing an instruction whose REX prefix is followed by a legacy prefix (#69). Such a REX is ignored, as the Intel SDM (Vol. 2A, 2.2.1) specifies, so `48 66 01 D8` now runs as `add ax, bx`; it used to stop the guest with an illegal-instruction exit. The ignored byte still counts toward the instruction's length, and a REX that directly precedes the opcode behaves as before. The interpreter, the DBT and the static probe share the decoder. One SDM-derived case in `cpu_known_answers.rs` moved from refused to verified and three were added, for an ignored REX.B, an ignored REX.W before a segment prefix, and a later REX that does apply. Two REX bytes in a row and the address-size prefix stay rejected. Not compared with x86 hardware; awaiting independent review.
|
||||
- Fixed import binding writing some slots before finding an unresolved import, and service calls taking effect before an unreadable return address was noticed. A service that changes a nonvolatile register, including XMM6 to XMM15, now stops the guest (part of #201).
|
||||
- Fixed older import-generator templates that reported success for unimplemented wrappers, used a nonexistent exit reason, and read floating-point arguments from integer registers.
|
||||
- Fixed guest flags in the native DBT (#64, #70). They lived only in host NZCV, so they were lost across helper calls and block boundaries and register ADD, SUB and XOR set none. JB, JAE, JBE and JA used ARM carry polarity, which is inverted for subtraction. Flags are now stored in the guest state.
|
||||
|
||||
@@ -10,3 +10,10 @@ rust-version = "1.100"
|
||||
|
||||
[workspace.lints.rust]
|
||||
unsafe_op_in_unsafe_fn = "deny"
|
||||
|
||||
# Whole-program optimization for release and bench builds (#116). On an Apple M5 the
|
||||
# interpreter ran about 6 % and cold DBT about 9 % faster in `dbt_bench`, at the cost of
|
||||
# slower release builds. Debug and test builds are unaffected.
|
||||
[profile.release]
|
||||
lto = "fat"
|
||||
codegen-units = 1
|
||||
@@ -309,7 +309,7 @@ These require a Metal-capable Apple Silicon Mac.
|
||||
scripts/test-gpu.sh
|
||||
```
|
||||
|
||||
The native test suite enables Metal API and shader validation and tests the supported compute, rendering and texture paths.
|
||||
The native test suite enables Metal API and shader validation and tests the supported compute, rendering and texture paths. The full semantic-review batch defaults to a 300-second timeout; set `XENORA_SEMANTIC_TIMEOUT` to raise or lower it for a slower or faster host.
|
||||
|
||||
### Verify guest execution
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@ mod shaders;
|
||||
|
||||
use std::process::ExitCode;
|
||||
|
||||
/// Where `probe` writes and `imports sync` reads without `--report`.
|
||||
const DEFAULT_REPORT_DIR: &str = "diagnostics/probe";
|
||||
|
||||
fn main() -> ExitCode {
|
||||
match std::env::args().nth(1).as_deref() {
|
||||
Some("info") => {
|
||||
@@ -46,7 +49,7 @@ fn main() -> ExitCode {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
let mut pe_path: Option<String> = None;
|
||||
let mut mode = "static".to_string();
|
||||
let mut report_dir = "diagnostics/gta6-candidate-e95020b2".to_string();
|
||||
let mut report_dir = DEFAULT_REPORT_DIR.to_string();
|
||||
|
||||
let mut i = 2;
|
||||
while i < args.len() {
|
||||
@@ -373,7 +376,7 @@ fn run_imports_generate_cli(args: &[String]) -> ExitCode {
|
||||
}
|
||||
|
||||
fn run_imports_sync_cli(args: &[String]) -> ExitCode {
|
||||
let mut report_dir = "diagnostics/gta6-candidate-e95020b2".to_string();
|
||||
let mut report_dir = DEFAULT_REPORT_DIR.to_string();
|
||||
let mut check_mode = false;
|
||||
|
||||
let mut i = 0;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
//! Default report folder of `xenora probe` and `xenora imports sync`.
|
||||
|
||||
use std::process::Command;
|
||||
|
||||
#[test]
|
||||
fn probe_and_sync_use_the_same_default_folder() {
|
||||
let fixture = concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/../../fixtures/pe/delay-imports.exe"
|
||||
);
|
||||
let folder = std::env::temp_dir().join(format!("xenora-default-{}", std::process::id()));
|
||||
std::fs::create_dir(&folder).unwrap();
|
||||
for arguments in [&["probe", "--pe", fixture][..], &["imports", "sync"]] {
|
||||
let status = Command::new(env!("CARGO_BIN_EXE_xenora"))
|
||||
.args(arguments)
|
||||
.current_dir(&folder)
|
||||
.status()
|
||||
.unwrap();
|
||||
assert!(status.success(), "{arguments:?}");
|
||||
}
|
||||
let written = ["imports.csv", "import_backlog.md"]
|
||||
.map(|name| folder.join("diagnostics/probe").join(name).is_file());
|
||||
std::fs::remove_dir_all(folder).unwrap();
|
||||
assert_eq!(written, [true, true]);
|
||||
}
|
||||
@@ -2267,4 +2267,207 @@ mod tests {
|
||||
ExitReason::MemoryFault(MemoryError::UnmappedAddress(FS_BASE + 8))
|
||||
);
|
||||
}
|
||||
|
||||
/// Intel SDM Volume 1, section 3.4.3.1: for `SUB` and `CMP`, `CF` is the
|
||||
/// borrow out of the most significant bit. `JB` is `CF = 1`, `JAE` is
|
||||
/// `CF = 0`, `JBE` is `CF = 1 or ZF = 1` and `JA` is `CF = 0 and ZF = 0`.
|
||||
///
|
||||
/// ARM64 reports the inverse: `SUBS` sets `C` when the subtraction does
|
||||
/// *not* borrow, and its `HI`/`LS` conditions are defined on that same
|
||||
/// inverted carry. These four x86 conditions therefore cannot be taken
|
||||
/// from an ARM64 condition code without translating the borrow first,
|
||||
/// which makes them the ones to pin at the boundaries.
|
||||
/// One unsigned condition: the low nibble pair as encoded in the `0x70`
|
||||
/// block, and the rule that decides it from CF and ZF.
|
||||
type UnsignedCondition = (u8, fn(bool, bool) -> bool);
|
||||
|
||||
const UNSIGNED_CONDITIONS: [UnsignedCondition; 4] = [
|
||||
(0x72, |cf, _zf| cf), // JB, JC, JNAE
|
||||
(0x73, |cf, _zf| !cf), // JAE, JNB, JNC
|
||||
(0x76, |cf, zf| cf || zf), // JBE, JNA
|
||||
(0x77, |cf, zf| !cf && !zf), // JA, JNBE
|
||||
];
|
||||
|
||||
/// Build `<op> eax, ebx` (or `rax, rbx`) followed by the short or near form
|
||||
/// of `condition`. The not-taken path writes 1 to `ECX` and halts, the
|
||||
/// taken path writes 2. A near branch targets offset 140, which a `disp8`
|
||||
/// cannot reach, so the two encodings are exercised separately.
|
||||
fn unsigned_branch_program(op: [u8; 2], condition: u8, wide: bool, near: bool) -> Vec<u8> {
|
||||
let mut code = Vec::new();
|
||||
if wide {
|
||||
code.push(0x48); // REX.W
|
||||
}
|
||||
code.extend_from_slice(&op); // cmp/sub eax, ebx
|
||||
let jcc = code.len();
|
||||
if near {
|
||||
// The near form is `0F 8x`, where x is the low nibble of the
|
||||
// short form's opcode.
|
||||
code.extend_from_slice(&[0x0F, 0x80 | (condition & 0x0F), 0, 0, 0, 0]);
|
||||
} else {
|
||||
code.extend_from_slice(&[condition, 0]);
|
||||
}
|
||||
code.extend_from_slice(&[0xB9, 1, 0, 0, 0]); // mov ecx, 1
|
||||
code.push(0xF4); // hlt
|
||||
let target = if near { 140 } else { code.len() };
|
||||
while code.len() < target {
|
||||
code.push(0x90); // nop
|
||||
}
|
||||
code.extend_from_slice(&[0xB9, 2, 0, 0, 0]); // mov ecx, 2
|
||||
code.push(0xF4); // hlt
|
||||
let next = jcc + if near { 6 } else { 2 };
|
||||
let displacement = target as i64 - next as i64;
|
||||
if near {
|
||||
code[jcc + 2..jcc + 6].copy_from_slice(&(displacement as i32).to_le_bytes());
|
||||
} else {
|
||||
code[jcc + 1] = displacement as i8 as u8;
|
||||
}
|
||||
code
|
||||
}
|
||||
|
||||
/// Run one branch program and return `(ecx, cf, zf)`.
|
||||
fn run_unsigned_branch(code: &[u8], left: u64, right: u64) -> (u64, bool, bool) {
|
||||
let (mut engine, mut cpu, mut memory) = fixture(code);
|
||||
cpu.set(Register::Rax, left);
|
||||
cpu.set(Register::Rbx, right);
|
||||
let result = engine.run(&mut cpu, &mut memory, 32);
|
||||
assert_eq!(result.exit_reason, ExitReason::Halt);
|
||||
// Either the two-instruction taken path or the two-instruction
|
||||
// not-taken path runs after the compare and the branch.
|
||||
assert_eq!(result.instructions_executed, 4);
|
||||
// The compare, the branch and the halting move all run as translated
|
||||
// ARM64, not through the shared interpreter.
|
||||
assert_eq!(engine.metrics.interpreter_fallbacks, 0);
|
||||
(cpu.get(Register::Rcx), cpu.flags.cf, cpu.flags.zf)
|
||||
}
|
||||
|
||||
/// The four unsigned conditions, at both ends of the 32-bit and 64-bit
|
||||
/// ranges, in the short and the near encoding. Expected flags and
|
||||
/// outcomes come from the SDM rules above, not from the lowering.
|
||||
#[test]
|
||||
fn unsigned_branch_conditions_follow_the_borrow_at_every_boundary() {
|
||||
const CMP: [u8; 2] = [0x39, 0xD8];
|
||||
let cases: &[(bool, u64, u64)] = &[
|
||||
// 32-bit: zero, one, equal operands, both ends of the range, and
|
||||
// the pair where the sign bit flips but the unsigned order holds.
|
||||
(false, 0, 0),
|
||||
(false, 0, 1),
|
||||
(false, 1, 0),
|
||||
(false, 0xFFFF_FFFF, 0xFFFF_FFFF),
|
||||
(false, 0xFFFF_FFFF, 0),
|
||||
(false, 0, 0xFFFF_FFFF),
|
||||
(false, 0x7FFF_FFFF, 0x8000_0000),
|
||||
(false, 0x8000_0000, 0x7FFF_FFFF),
|
||||
// The same boundaries at 64 bits, plus a subtraction that clears
|
||||
// the sign bit without borrowing.
|
||||
(true, 0, 0),
|
||||
(true, 0, 1),
|
||||
(true, 1, 0),
|
||||
(true, u64::MAX, u64::MAX),
|
||||
(true, u64::MAX, 0),
|
||||
(true, 0, u64::MAX),
|
||||
(true, 0x7FFF_FFFF_FFFF_FFFF, 0x8000_0000_0000_0000),
|
||||
(true, 0x8000_0000_0000_0000, 0x7FFF_FFFF_FFFF_FFFF),
|
||||
(true, 0x8000_0000_0000_0000, 1),
|
||||
];
|
||||
|
||||
for &(wide, left, right) in cases {
|
||||
let mask = if wide { u64::MAX } else { u64::from(u32::MAX) };
|
||||
let (left, right) = (left & mask, right & mask);
|
||||
// SDM: CF is the borrow out of the most significant bit, ZF is a
|
||||
// zero result. Both follow from the operands alone.
|
||||
let (cf, zf) = (left < right, left == right);
|
||||
for &(condition, holds) in &UNSIGNED_CONDITIONS {
|
||||
let taken = holds(cf, zf);
|
||||
for &near in &[false, true] {
|
||||
let code = unsigned_branch_program(CMP, condition, wide, near);
|
||||
let (ecx, got_cf, got_zf) = run_unsigned_branch(&code, left, right);
|
||||
let case = format!(
|
||||
"{condition:#04x} {:#x} {:#x} {}",
|
||||
left,
|
||||
right,
|
||||
if near { "near" } else { "short" }
|
||||
);
|
||||
assert_eq!(got_cf, cf, "{case}: CF");
|
||||
assert_eq!(got_zf, zf, "{case}: ZF");
|
||||
assert_eq!(ecx, if taken { 2 } else { 1 }, "{case}: branch outcome");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// `SUB` is the other producer of the carry these conditions read, and the
|
||||
/// one where the ARM64 carry is inverted: `0 - 1` borrows, while
|
||||
/// `0x8000_0000_0000_0000 - 1` does not borrow even though it clears the
|
||||
/// sign bit.
|
||||
#[test]
|
||||
fn subtract_borrow_into_and_out_of_the_high_bit_feeds_the_unsigned_branches() {
|
||||
const SUB: [u8; 2] = [0x29, 0xD8];
|
||||
let cases: &[(bool, u64, u64)] = &[
|
||||
(false, 0, 1),
|
||||
(false, 0x8000_0000, 1),
|
||||
(true, 0, 1),
|
||||
(true, 0x8000_0000_0000_0000, 1),
|
||||
];
|
||||
|
||||
for &(wide, left, right) in cases {
|
||||
let mask = if wide { u64::MAX } else { u64::from(u32::MAX) };
|
||||
let (left, right) = (left & mask, right & mask);
|
||||
let (cf, zf) = (left < right, left == right);
|
||||
for &(condition, holds) in &UNSIGNED_CONDITIONS {
|
||||
let taken = holds(cf, zf);
|
||||
for &near in &[false, true] {
|
||||
let code = unsigned_branch_program(SUB, condition, wide, near);
|
||||
let (ecx, got_cf, got_zf) = run_unsigned_branch(&code, left, right);
|
||||
let case = format!(
|
||||
"{condition:#04x} {:#x} {:#x} {}",
|
||||
left,
|
||||
right,
|
||||
if near { "near" } else { "short" }
|
||||
);
|
||||
assert_eq!(got_cf, cf, "{case}: CF");
|
||||
assert_eq!(got_zf, zf, "{case}: ZF");
|
||||
assert_eq!(ecx, if taken { 2 } else { 1 }, "{case}: branch outcome");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The carry these conditions read is produced in one translated block and
|
||||
/// consumed in the next. A lowering that left it in the host's condition
|
||||
/// flags would pass the single-block cases above and fail here.
|
||||
#[test]
|
||||
fn unsigned_branch_reads_flags_stored_by_a_previous_block() {
|
||||
const CMP: [u8; 2] = [0x39, 0xD8];
|
||||
let cases: &[(bool, u64, u64)] = &[
|
||||
(false, 0, 0), // CF = 0, ZF = 1
|
||||
(false, 0, 1), // CF = 1, ZF = 0
|
||||
(false, 0xFFFF_FFFF, 0), // CF = 0, ZF = 0
|
||||
(true, 0x8000_0000_0000_0000, 1), // CF = 0 although the sign bit clears
|
||||
];
|
||||
|
||||
for &(wide, left, right) in cases {
|
||||
let (cf, zf) = (left < right, left == right);
|
||||
for &(condition, holds) in &UNSIGNED_CONDITIONS {
|
||||
let taken = holds(cf, zf);
|
||||
let code = unsigned_branch_program(CMP, condition, wide, false);
|
||||
let (mut engine, mut cpu, mut memory) = fixture(&code);
|
||||
cpu.set(Register::Rax, left);
|
||||
cpu.set(Register::Rbx, right);
|
||||
|
||||
// One instruction per run: the compare is translated as a
|
||||
// one-instruction block, so the branch is compiled separately
|
||||
// and can only read the flags the first block stored.
|
||||
let first = engine.run(&mut cpu, &mut memory, 1);
|
||||
assert_eq!(first.exit_reason, ExitReason::StepLimitExceeded);
|
||||
assert_eq!(cpu.rip, ENTRY + if wide { 3 } else { 2 });
|
||||
assert_eq!((cpu.flags.cf, cpu.flags.zf), (cf, zf));
|
||||
|
||||
let second = engine.run(&mut cpu, &mut memory, 8);
|
||||
assert_eq!(second.exit_reason, ExitReason::Halt);
|
||||
assert_eq!(second.instructions_executed, 3);
|
||||
assert_eq!(cpu.get(Register::Rcx), if taken { 2 } else { 1 });
|
||||
assert_eq!(engine.metrics.interpreter_fallbacks, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+221
-3
@@ -506,9 +506,20 @@ impl GuestMemory {
|
||||
|
||||
/// Read an instruction byte from guest memory, verifying execute permission.
|
||||
pub fn fetch_instruction_byte(&self, address: u64) -> Result<u8, MemoryError> {
|
||||
let mut buf = [0u8; 1];
|
||||
self.read_checked(address, &mut buf, Some("execute"))?;
|
||||
Ok(buf[0])
|
||||
address.checked_add(1).ok_or(MemoryError::Overflow)?;
|
||||
let region = self
|
||||
.regions
|
||||
.iter()
|
||||
.find(|region| region.base + region.data.len() as u64 > address)
|
||||
.filter(|region| region.base <= address)
|
||||
.ok_or(MemoryError::UnmappedAddress(address))?;
|
||||
if !region.permissions.execute {
|
||||
return Err(MemoryError::PermissionViolation {
|
||||
address,
|
||||
required: "execute",
|
||||
});
|
||||
}
|
||||
Ok(region.data[(address - region.base) as usize])
|
||||
}
|
||||
|
||||
/// Read a 64-bit integer (little endian) from guest memory.
|
||||
@@ -627,3 +638,210 @@ mod tests {
|
||||
assert_eq!(memory.heap_allocation_size(PROCESS_HEAP, moved), Some(1));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod instruction_fetch_tests {
|
||||
use super::{MemoryPermissions as P, *};
|
||||
|
||||
fn denied(address: u64) -> Result<u8, MemoryError> {
|
||||
Err(MemoryError::PermissionViolation {
|
||||
address,
|
||||
required: "execute",
|
||||
})
|
||||
}
|
||||
fn missing(address: u64) -> Result<u8, MemoryError> {
|
||||
Err(MemoryError::UnmappedAddress(address))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fetch_reports_overflow_before_lookup() {
|
||||
let m = GuestMemory::new();
|
||||
for at in [0, 1, 0x1000, u64::MAX - 1] {
|
||||
assert_eq!(m.fetch_instruction_byte(at), missing(at));
|
||||
}
|
||||
assert_eq!(
|
||||
m.fetch_instruction_byte(u64::MAX),
|
||||
Err(MemoryError::Overflow)
|
||||
);
|
||||
let mut m = GuestMemory::new();
|
||||
m.map_region(u64::MAX, 0, P::NO_ACCESS).unwrap();
|
||||
assert_eq!(
|
||||
m.fetch_instruction_byte(u64::MAX),
|
||||
Err(MemoryError::Overflow)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fetch_checks_execute_permission_for_every_byte_value() {
|
||||
let bytes: Vec<u8> = (0..=255).collect();
|
||||
for flags in 0..8 {
|
||||
let permission = P {
|
||||
read: flags & 1 != 0,
|
||||
write: flags & 2 != 0,
|
||||
execute: flags & 4 != 0,
|
||||
};
|
||||
let mut m = GuestMemory::new();
|
||||
m.map_region_with_data(0x1000, bytes.len(), permission, &bytes)
|
||||
.unwrap();
|
||||
for (offset, byte) in bytes.iter().enumerate() {
|
||||
let at = 0x1000 + offset as u64;
|
||||
assert_eq!(
|
||||
m.fetch_instruction_byte(at),
|
||||
if flags & 4 != 0 {
|
||||
Ok(*byte)
|
||||
} else {
|
||||
denied(at)
|
||||
},
|
||||
"flags={flags}, at={at:x}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fetch_handles_sparse_and_out_of_order_mappings() {
|
||||
let mut m = GuestMemory::new();
|
||||
m.map_region_with_data(0x3000, 2, P::READ_EXECUTE, &[0xc1, 0xc2])
|
||||
.unwrap();
|
||||
m.map_region_with_data(0, 2, P::READ_EXECUTE, &[0x01, 0x02])
|
||||
.unwrap();
|
||||
m.map_region_with_data(0x2000, 1, P::READ_ONLY, &[0xb1])
|
||||
.unwrap();
|
||||
m.map_region_with_data(0x1000, 2, P::READ_EXECUTE, &[0xa1, 0xa2])
|
||||
.unwrap();
|
||||
for (at, byte) in [
|
||||
(0, 1),
|
||||
(1, 2),
|
||||
(0x1000, 0xa1),
|
||||
(0x1001, 0xa2),
|
||||
(0x3000, 0xc1),
|
||||
(0x3001, 0xc2),
|
||||
] {
|
||||
assert_eq!(m.fetch_instruction_byte(at), Ok(byte));
|
||||
}
|
||||
assert_eq!(m.fetch_instruction_byte(0x2000), denied(0x2000));
|
||||
for at in [2, 0xfff, 0x1002, 0x2001, 0x2fff, 0x3002] {
|
||||
assert_eq!(m.fetch_instruction_byte(at), missing(at));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fetch_ignores_empty_mappings_at_shared_boundaries() {
|
||||
for zero_first in [false, true] {
|
||||
for execute in [false, true] {
|
||||
let mut m = GuestMemory::new();
|
||||
let permission = P {
|
||||
read: false,
|
||||
write: false,
|
||||
execute,
|
||||
};
|
||||
if zero_first {
|
||||
for _ in 0..7 {
|
||||
m.map_region(0x1000, 0, P::READ_WRITE_EXECUTE).unwrap();
|
||||
}
|
||||
}
|
||||
m.map_region_with_data(0x1000, 2, permission, &[0x34, 0x56])
|
||||
.unwrap();
|
||||
for _ in 0..7 {
|
||||
m.map_region(0x1000, 0, P::NO_ACCESS).unwrap();
|
||||
}
|
||||
for _ in 0..7 {
|
||||
m.map_region(0x1002, 0, P::READ_WRITE_EXECUTE).unwrap();
|
||||
}
|
||||
for (at, byte) in [(0x1000, 0x34), (0x1001, 0x56)] {
|
||||
assert_eq!(
|
||||
m.fetch_instruction_byte(at),
|
||||
if execute { Ok(byte) } else { denied(at) }
|
||||
);
|
||||
}
|
||||
assert_eq!(m.fetch_instruction_byte(0x1002), missing(0x1002));
|
||||
}
|
||||
}
|
||||
let mut m = GuestMemory::new();
|
||||
for at in [1, 1, 2, 0x1000] {
|
||||
m.map_region(at, 0, P::READ_WRITE_EXECUTE).unwrap();
|
||||
}
|
||||
for at in [0, 1, 2, 3, 0x1000] {
|
||||
assert_eq!(m.fetch_instruction_byte(at), missing(at));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fetch_checks_adjacent_mapping_permissions() {
|
||||
let mut m = GuestMemory::new();
|
||||
m.map_region_with_data(0x1000, 1, P::READ_EXECUTE, &[0xa5])
|
||||
.unwrap();
|
||||
m.map_region_with_data(0x1001, 1, P::READ_WRITE, &[0x5a])
|
||||
.unwrap();
|
||||
m.map_region(0x1001, 0, P::READ_EXECUTE).unwrap();
|
||||
m.map_region_with_data(0x1002, 1, P::READ_EXECUTE, &[0xc3])
|
||||
.unwrap();
|
||||
assert_eq!(m.fetch_instruction_byte(0x1000), Ok(0xa5));
|
||||
assert_eq!(m.fetch_instruction_byte(0x1001), denied(0x1001));
|
||||
assert_eq!(m.fetch_instruction_byte(0x1002), Ok(0xc3));
|
||||
assert_eq!(m.fetch_instruction_byte(0x1003), missing(0x1003));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fetch_handles_the_highest_region_end() {
|
||||
let mut m = GuestMemory::new();
|
||||
m.map_region_with_data(u64::MAX - 2, 2, P::READ_EXECUTE, &[0x12, 0x34])
|
||||
.unwrap();
|
||||
m.map_region(u64::MAX, 0, P::READ_EXECUTE).unwrap();
|
||||
assert_eq!(
|
||||
m.fetch_instruction_byte(u64::MAX - 3),
|
||||
missing(u64::MAX - 3)
|
||||
);
|
||||
assert_eq!(m.fetch_instruction_byte(u64::MAX - 2), Ok(0x12));
|
||||
assert_eq!(m.fetch_instruction_byte(u64::MAX - 1), Ok(0x34));
|
||||
assert_eq!(
|
||||
m.fetch_instruction_byte(u64::MAX),
|
||||
Err(MemoryError::Overflow)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fetch_observes_writes_clones_and_mapping_changes() {
|
||||
let mut m = GuestMemory::new();
|
||||
m.map_region_with_data(0x1000, 1, P::READ_WRITE_EXECUTE, &[0x11])
|
||||
.unwrap();
|
||||
let mut clone = m.clone();
|
||||
m.write_u8(0x1000, 0x22).unwrap();
|
||||
clone.write_u8(0x1000, 0x33).unwrap();
|
||||
assert_eq!(m.fetch_instruction_byte(0x1000), Ok(0x22));
|
||||
assert_eq!(clone.fetch_instruction_byte(0x1000), Ok(0x33));
|
||||
let base = m
|
||||
.map_virtual_allocation(0x4000, 1, P::READ_WRITE_EXECUTE)
|
||||
.unwrap();
|
||||
m.write_u8(base, 0x44).unwrap();
|
||||
assert_eq!(m.fetch_instruction_byte(base), Ok(0x44));
|
||||
assert!(m.release_virtual_allocation(base));
|
||||
assert_eq!(m.fetch_instruction_byte(base), missing(base));
|
||||
m.map_region_with_data(base, 1, P::READ_ONLY, &[0x55])
|
||||
.unwrap();
|
||||
assert_eq!(m.fetch_instruction_byte(base), denied(base));
|
||||
assert_eq!(clone.fetch_instruction_byte(base), missing(base));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fetch_keeps_first_mapping_priority_after_empty_heap_growth() {
|
||||
// Existing private allocation methods can grow a zero allocation onto an
|
||||
// earlier mapping at its base. The fetch-only patch must preserve the
|
||||
// original mapping's priority even for this already-representable state.
|
||||
let mut m = GuestMemory::new();
|
||||
m.map_region_with_data(0x1000, 1, P::READ_EXECUTE, &[0x90])
|
||||
.unwrap();
|
||||
const BASE: u64 = 0x0000_0003_0000_0000;
|
||||
m.map_region_with_data(BASE, 4, P::READ_EXECUTE, &[0x11, 0x22, 0x33, 0x44])
|
||||
.unwrap();
|
||||
let empty = m.map_heap_allocation(PROCESS_HEAP, 0).unwrap();
|
||||
assert_eq!(empty, BASE);
|
||||
assert_eq!(
|
||||
m.resize_heap_allocation(PROCESS_HEAP, empty, 2, true),
|
||||
Ok(BASE)
|
||||
);
|
||||
assert_eq!(m.fetch_instruction_byte(BASE), Ok(0x11));
|
||||
assert_eq!(m.fetch_instruction_byte(BASE + 1), Ok(0x22));
|
||||
assert_eq!(m.fetch_instruction_byte(BASE + 3), Ok(0x44));
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ pub struct Control {
|
||||
pub rounding: Rounding,
|
||||
pub denormals_are_zero: bool,
|
||||
pub flush_to_zero: bool,
|
||||
pub overflow_masked: bool,
|
||||
pub underflow_masked: bool,
|
||||
}
|
||||
|
||||
@@ -49,6 +50,7 @@ impl Control {
|
||||
},
|
||||
denormals_are_zero: mxcsr & 1 << 6 != 0,
|
||||
flush_to_zero: mxcsr & 1 << 15 != 0,
|
||||
overflow_masked: mxcsr & 1 << 10 != 0,
|
||||
underflow_masked: mxcsr & 1 << 11 != 0,
|
||||
}
|
||||
}
|
||||
@@ -263,6 +265,14 @@ fn round(
|
||||
flags |= PRECISION;
|
||||
}
|
||||
if leading > format.bias() {
|
||||
if !control.overflow_masked {
|
||||
// No result is delivered. Precision is reported only if rounding
|
||||
// with an unbounded exponent was inexact.
|
||||
return Outcome {
|
||||
bits: 0,
|
||||
flags: OVERFLOW | if inexact { PRECISION } else { 0 },
|
||||
};
|
||||
}
|
||||
let to_infinity = match control.rounding {
|
||||
Rounding::Nearest => true,
|
||||
Rounding::Down => sign,
|
||||
|
||||
@@ -237,6 +237,15 @@ impl<E, F: FnMut(u64) -> Result<u8, E>> Cursor<F> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether `byte` is a legacy prefix: an operand-size, address-size, segment,
|
||||
/// LOCK or repeat prefix (Intel SDM Vol. 2A, 2.1.1).
|
||||
fn is_legacy_prefix(byte: u8) -> bool {
|
||||
matches!(
|
||||
byte,
|
||||
0x26 | 0x2E | 0x36 | 0x3E | 0x64 | 0x65 | 0x66 | 0x67 | 0xF0 | 0xF2 | 0xF3
|
||||
)
|
||||
}
|
||||
|
||||
/// Decode one instruction at `rip`. `fetch` supplies the byte at an address and
|
||||
/// is called only for bytes that belong to the instruction, in order.
|
||||
///
|
||||
@@ -258,9 +267,22 @@ pub fn decode<E>(
|
||||
let mut repne = false;
|
||||
let mut lock = false;
|
||||
let mut segment = None;
|
||||
let mut rex = 0;
|
||||
let mut byte = cursor.u8()?;
|
||||
loop {
|
||||
let selected = match byte {
|
||||
// REX applies only immediately before the opcode. One that is
|
||||
// followed by a legacy prefix is ignored (Intel SDM Vol. 2A, 2.2.1).
|
||||
0x40..=0x4F => {
|
||||
let next = cursor.u8()?;
|
||||
if !is_legacy_prefix(next) {
|
||||
rex = byte;
|
||||
byte = next;
|
||||
break;
|
||||
}
|
||||
byte = next;
|
||||
continue;
|
||||
}
|
||||
0x64 => Segment::Fs,
|
||||
0x65 => Segment::Gs,
|
||||
0x66 => {
|
||||
@@ -299,10 +321,6 @@ pub fn decode<E>(
|
||||
byte = cursor.u8()?;
|
||||
}
|
||||
|
||||
let rex = if byte & 0xF0 == 0x40 { byte } else { 0 };
|
||||
if rex != 0 {
|
||||
byte = cursor.u8()?;
|
||||
}
|
||||
let (rex_w, rex_r, rex_x, rex_b) =
|
||||
(rex & 8 != 0, (rex & 4) << 1, (rex & 2) << 2, (rex & 1) << 3);
|
||||
|
||||
@@ -345,9 +363,24 @@ pub fn decode<E>(
|
||||
GROUPS[usize::from(index)][usize::from((modrm >> 3) & 7)]
|
||||
}
|
||||
};
|
||||
let form = FORMS
|
||||
let mut form = FORMS
|
||||
.get(usize::from(form_index))
|
||||
.ok_or(DecodeError::Unsupported(opcode))?;
|
||||
let mut form_index = form_index;
|
||||
if form.no_rex_b && rex_b != 0 {
|
||||
// 90 is NOP only without REX.B. With it the byte exchanges r8 with the
|
||||
// accumulator, as the first register of the 91..97 row would (Intel
|
||||
// SDM Vol. 2B, "NOP" and "XCHG").
|
||||
match ONE_BYTE[slot + 1] {
|
||||
Entry::Form(index)
|
||||
if !two_byte && !rep && FORMS[usize::from(index)].encoding == Encoding::OpReg =>
|
||||
{
|
||||
form_index = index;
|
||||
form = &FORMS[usize::from(index)];
|
||||
}
|
||||
_ => return Err(DecodeError::Unsupported(opcode)),
|
||||
}
|
||||
}
|
||||
if form.has_modrm && matches!(entry, Entry::Form(_)) {
|
||||
modrm = cursor.u8()?;
|
||||
}
|
||||
@@ -368,10 +401,6 @@ pub fn decode<E>(
|
||||
if operand_size && !takes_operand_size && !overridden {
|
||||
return Err(DecodeError::Unsupported(0x66));
|
||||
}
|
||||
if form.no_rex_b && rex_b != 0 {
|
||||
return Err(DecodeError::Unsupported(opcode));
|
||||
}
|
||||
|
||||
let rm_size = if form.source != 0 { form.source } else { size };
|
||||
let register = |field: u8, extension: u8, width: u8| {
|
||||
if width == 1 && rex == 0 && field >= 4 {
|
||||
|
||||
@@ -241,6 +241,25 @@ fn shift(op: Op, value: u64, count: u64, size: u8, old: RFlags) -> Option<(u64,
|
||||
flags.cf = signed >> (count - 1) & 1 != 0;
|
||||
(signed >> count) as u64
|
||||
}
|
||||
Op::Rcl | Op::Rcr => {
|
||||
// The carry flag is one more bit above the operand, so the rotation
|
||||
// is over `bits + 1` positions and the count is reduced modulo that.
|
||||
let width = bits + 1;
|
||||
let ring = wide | u128::from(old.cf) << bits;
|
||||
let by = count % width;
|
||||
let left = if op == Op::Rcl {
|
||||
by
|
||||
} else {
|
||||
(width - by) % width
|
||||
};
|
||||
let rotated = if left == 0 {
|
||||
ring
|
||||
} else {
|
||||
ring << left | ring >> (width - left)
|
||||
};
|
||||
flags.cf = rotated >> bits & 1 != 0;
|
||||
rotated as u64
|
||||
}
|
||||
_ => {
|
||||
let by = count % bits;
|
||||
let left = if op == Op::Rol {
|
||||
@@ -268,7 +287,7 @@ fn shift(op: Op, value: u64, count: u64, size: u8, old: RFlags) -> Option<(u64,
|
||||
// OF is defined only for a count of one.
|
||||
if count == 1 {
|
||||
flags.of = match op {
|
||||
Op::Shl | Op::Rol => (result & top != 0) != flags.cf,
|
||||
Op::Shl | Op::Rol | Op::Rcl => (result & top != 0) != flags.cf,
|
||||
Op::Shr => value & top != 0,
|
||||
Op::Sar => false,
|
||||
_ => (result & top != 0) != (result & (top >> 1) != 0),
|
||||
@@ -367,6 +386,14 @@ pub fn execute(
|
||||
write_reg(cpu, insn.reg, size, offset(cpu, &operand));
|
||||
}
|
||||
}
|
||||
Op::Xchg if insn.encoding == Encoding::OpReg => {
|
||||
// The accumulator with the register in the opcode, never itself:
|
||||
// 90 without REX.B is NOP.
|
||||
let rax = accumulator(RAX);
|
||||
let (a, b) = (read_reg(cpu, rax, size), read_reg(cpu, insn.reg, size));
|
||||
write_reg(cpu, rax, size, b);
|
||||
write_reg(cpu, insn.reg, size, a);
|
||||
}
|
||||
Op::Xchg => {
|
||||
let (a, b) = operands(cpu, memory, insn)?;
|
||||
write_rm(cpu, memory, insn, b)?;
|
||||
@@ -419,7 +446,7 @@ pub fn execute(
|
||||
if negative { mask(size) } else { 0 },
|
||||
);
|
||||
}
|
||||
Op::Rol | Op::Ror | Op::Shl | Op::Shr | Op::Sar => {
|
||||
Op::Rol | Op::Ror | Op::Rcl | Op::Rcr | Op::Shl | Op::Shr | Op::Sar => {
|
||||
let (a, count) = operands(cpu, memory, insn)?;
|
||||
match shift(insn.op, a, count, size, cpu.flags) {
|
||||
Some((value, flags)) => {
|
||||
|
||||
+162
-125
@@ -34,6 +34,8 @@ pub enum Op {
|
||||
Cdq,
|
||||
Rol,
|
||||
Ror,
|
||||
Rcl,
|
||||
Rcr,
|
||||
Shl,
|
||||
Shr,
|
||||
Sar,
|
||||
@@ -209,7 +211,7 @@ pub enum Op {
|
||||
}
|
||||
|
||||
impl Op {
|
||||
pub const ALL: &[Op] = &[Op::Add, Op::Or, Op::Adc, Op::Sbb, Op::And, Op::Sub, Op::Xor, Op::Cmp, Op::Test, Op::Inc, Op::Dec, Op::Neg, Op::Not, Op::Mov, Op::Movzx, Op::Movsx, Op::Movsxd, Op::Lea, Op::Xchg, Op::Xadd, Op::Cmpxchg, Op::Bswap, Op::Cwde, Op::Cdq, Op::Rol, Op::Ror, Op::Shl, Op::Shr, Op::Sar, Op::Mul, Op::Imul, Op::Imul2, Op::Div, Op::Idiv, Op::Cmov, Op::Setcc, Op::Bt, Op::Bts, Op::Btr, Op::Btc, Op::Bsf, Op::Bsr, Op::Popcnt, Op::Tzcnt, Op::Lzcnt, Op::Push, Op::Pop, Op::Leave, Op::Call, Op::Jmp, Op::Jcc, Op::Ret, Op::Nop, Op::Hlt, Op::Syscall, Op::Clc, Op::Stc, Op::Cmc, Op::Cpuid, Op::Cld, Op::Std, Op::Movs, Op::Stos, Op::Movaps, Op::Movups, Op::Movdqa, Op::Movdqu, Op::Movntdq, Op::Movntps, Op::Movss, Op::Movsd, Op::Movq, Op::Movd, Op::Movlps, Op::Movhps, Op::Movmskps, Op::Movmskpd, Op::Pmovmskb, Op::Pand, Op::Pandn, Op::Por, Op::Pxor, Op::Punpcklbw, Op::Punpcklwd, Op::Punpckldq, Op::Packsswb, Op::Pcmpgtb, Op::Pcmpgtw, Op::Pcmpgtd, Op::Packuswb, Op::Punpckhbw, Op::Punpckhwd, Op::Punpckhdq, Op::Packssdw, Op::Punpcklqdq, Op::Punpckhqdq, Op::Pcmpeqb, Op::Pcmpeqw, Op::Pcmpeqd, Op::Paddq, Op::Pmullw, Op::Psubusb, Op::Psubusw, Op::Pminub, Op::Paddusb, Op::Paddusw, Op::Pmaxub, Op::Pavgb, Op::Pavgw, Op::Pmulhuw, Op::Pmulhw, Op::Psubsb, Op::Psubsw, Op::Pminsw, Op::Paddsb, Op::Paddsw, Op::Pmaxsw, Op::Pmuludq, Op::Pmaddwd, Op::Psadbw, Op::Psubb, Op::Psubw, Op::Psubd, Op::Psubq, Op::Paddb, Op::Paddw, Op::Paddd, Op::Psrlw, Op::Psraw, Op::Psllw, Op::Psrld, Op::Psrad, Op::Pslld, Op::Psrlq, Op::Psllq, Op::Psrldq, Op::Pslldq, Op::Pshufd, Op::Pshufhw, Op::Pshuflw, Op::Shufps, Op::Shufpd, Op::Pinsrw, Op::Pextrw, Op::Ldmxcsr, Op::Stmxcsr, Op::Sqrtps, Op::Sqrtpd, Op::Sqrtss, Op::Sqrtsd, Op::Addps, Op::Addpd, Op::Addss, Op::Addsd, Op::Mulps, Op::Mulpd, Op::Mulss, Op::Mulsd, Op::Subps, Op::Subpd, Op::Subss, Op::Subsd, Op::Minps, Op::Minpd, Op::Minss, Op::Minsd, Op::Divps, Op::Divpd, Op::Divss, Op::Divsd, Op::Maxps, Op::Maxpd, Op::Maxss, Op::Maxsd, Op::Cmpps, Op::Cmppd, Op::Cmpss, Op::Cmpsd, Op::Ucomiss, Op::Comiss, Op::Ucomisd, Op::Comisd, Op::Cvtps2pd, Op::Cvtpd2ps, Op::Cvtss2sd, Op::Cvtsd2ss, Op::Cvtdq2ps, Op::Cvtps2dq, Op::Cvttps2dq, Op::Cvttpd2dq, Op::Cvtdq2pd, Op::Cvtpd2dq, Op::Cvtsi2ss, Op::Cvttss2si, Op::Cvtss2si, Op::Cvtsi2sd, Op::Cvttsd2si, Op::Cvtsd2si];
|
||||
pub const ALL: &[Op] = &[Op::Add, Op::Or, Op::Adc, Op::Sbb, Op::And, Op::Sub, Op::Xor, Op::Cmp, Op::Test, Op::Inc, Op::Dec, Op::Neg, Op::Not, Op::Mov, Op::Movzx, Op::Movsx, Op::Movsxd, Op::Lea, Op::Xchg, Op::Xadd, Op::Cmpxchg, Op::Bswap, Op::Cwde, Op::Cdq, Op::Rol, Op::Ror, Op::Rcl, Op::Rcr, Op::Shl, Op::Shr, Op::Sar, Op::Mul, Op::Imul, Op::Imul2, Op::Div, Op::Idiv, Op::Cmov, Op::Setcc, Op::Bt, Op::Bts, Op::Btr, Op::Btc, Op::Bsf, Op::Bsr, Op::Popcnt, Op::Tzcnt, Op::Lzcnt, Op::Push, Op::Pop, Op::Leave, Op::Call, Op::Jmp, Op::Jcc, Op::Ret, Op::Nop, Op::Hlt, Op::Syscall, Op::Clc, Op::Stc, Op::Cmc, Op::Cpuid, Op::Cld, Op::Std, Op::Movs, Op::Stos, Op::Movaps, Op::Movups, Op::Movdqa, Op::Movdqu, Op::Movntdq, Op::Movntps, Op::Movss, Op::Movsd, Op::Movq, Op::Movd, Op::Movlps, Op::Movhps, Op::Movmskps, Op::Movmskpd, Op::Pmovmskb, Op::Pand, Op::Pandn, Op::Por, Op::Pxor, Op::Punpcklbw, Op::Punpcklwd, Op::Punpckldq, Op::Packsswb, Op::Pcmpgtb, Op::Pcmpgtw, Op::Pcmpgtd, Op::Packuswb, Op::Punpckhbw, Op::Punpckhwd, Op::Punpckhdq, Op::Packssdw, Op::Punpcklqdq, Op::Punpckhqdq, Op::Pcmpeqb, Op::Pcmpeqw, Op::Pcmpeqd, Op::Paddq, Op::Pmullw, Op::Psubusb, Op::Psubusw, Op::Pminub, Op::Paddusb, Op::Paddusw, Op::Pmaxub, Op::Pavgb, Op::Pavgw, Op::Pmulhuw, Op::Pmulhw, Op::Psubsb, Op::Psubsw, Op::Pminsw, Op::Paddsb, Op::Paddsw, Op::Pmaxsw, Op::Pmuludq, Op::Pmaddwd, Op::Psadbw, Op::Psubb, Op::Psubw, Op::Psubd, Op::Psubq, Op::Paddb, Op::Paddw, Op::Paddd, Op::Psrlw, Op::Psraw, Op::Psllw, Op::Psrld, Op::Psrad, Op::Pslld, Op::Psrlq, Op::Psllq, Op::Psrldq, Op::Pslldq, Op::Pshufd, Op::Pshufhw, Op::Pshuflw, Op::Shufps, Op::Shufpd, Op::Pinsrw, Op::Pextrw, Op::Ldmxcsr, Op::Stmxcsr, Op::Sqrtps, Op::Sqrtpd, Op::Sqrtss, Op::Sqrtsd, Op::Addps, Op::Addpd, Op::Addss, Op::Addsd, Op::Mulps, Op::Mulpd, Op::Mulss, Op::Mulsd, Op::Subps, Op::Subpd, Op::Subss, Op::Subsd, Op::Minps, Op::Minpd, Op::Minss, Op::Minsd, Op::Divps, Op::Divpd, Op::Divss, Op::Divsd, Op::Maxps, Op::Maxpd, Op::Maxss, Op::Maxsd, Op::Cmpps, Op::Cmppd, Op::Cmpss, Op::Cmpsd, Op::Ucomiss, Op::Comiss, Op::Ucomisd, Op::Comisd, Op::Cvtps2pd, Op::Cvtpd2ps, Op::Cvtss2sd, Op::Cvtsd2ss, Op::Cvtdq2ps, Op::Cvtps2dq, Op::Cvttps2dq, Op::Cvttpd2dq, Op::Cvtdq2pd, Op::Cvtpd2dq, Op::Cvtsi2ss, Op::Cvttss2si, Op::Cvtss2si, Op::Cvtsi2sd, Op::Cvttsd2si, Op::Cvtsd2si];
|
||||
|
||||
/// Lower-case mnemonic stem.
|
||||
pub const fn name(self) -> &'static str {
|
||||
@@ -240,6 +242,8 @@ impl Op {
|
||||
Op::Cdq => "cdq",
|
||||
Op::Rol => "rol",
|
||||
Op::Ror => "ror",
|
||||
Op::Rcl => "rcl",
|
||||
Op::Rcr => "rcr",
|
||||
Op::Shl => "shl",
|
||||
Op::Shr => "shr",
|
||||
Op::Sar => "sar",
|
||||
@@ -444,6 +448,8 @@ impl Op {
|
||||
Op::Cdq => 0,
|
||||
Op::Rol => 0,
|
||||
Op::Ror => 0,
|
||||
Op::Rcl => 1,
|
||||
Op::Rcr => 1,
|
||||
Op::Shl => 0,
|
||||
Op::Shr => 0,
|
||||
Op::Sar => 0,
|
||||
@@ -648,6 +654,8 @@ impl Op {
|
||||
Op::Cdq => 0,
|
||||
Op::Rol => 0,
|
||||
Op::Ror => 0,
|
||||
Op::Rcl => 0,
|
||||
Op::Rcr => 0,
|
||||
Op::Shl => 0,
|
||||
Op::Shr => 0,
|
||||
Op::Sar => 0,
|
||||
@@ -852,6 +860,8 @@ impl Op {
|
||||
Op::Cdq => 0,
|
||||
Op::Rol => 9,
|
||||
Op::Ror => 9,
|
||||
Op::Rcl => 9,
|
||||
Op::Rcr => 9,
|
||||
Op::Shl => 31,
|
||||
Op::Shr => 31,
|
||||
Op::Sar => 31,
|
||||
@@ -1056,6 +1066,8 @@ impl Op {
|
||||
Op::Cdq => 0,
|
||||
Op::Rol => 0,
|
||||
Op::Ror => 0,
|
||||
Op::Rcl => 0,
|
||||
Op::Rcr => 0,
|
||||
Op::Shl => 32,
|
||||
Op::Shr => 32,
|
||||
Op::Sar => 32,
|
||||
@@ -1260,6 +1272,8 @@ impl Op {
|
||||
Op::Cdq => false,
|
||||
Op::Rol => false,
|
||||
Op::Ror => false,
|
||||
Op::Rcl => false,
|
||||
Op::Rcr => false,
|
||||
Op::Shl => false,
|
||||
Op::Shr => false,
|
||||
Op::Sar => false,
|
||||
@@ -1464,6 +1478,8 @@ impl Op {
|
||||
Op::Cdq => false,
|
||||
Op::Rol => false,
|
||||
Op::Ror => false,
|
||||
Op::Rcl => false,
|
||||
Op::Rcr => false,
|
||||
Op::Shl => false,
|
||||
Op::Shr => false,
|
||||
Op::Sar => false,
|
||||
@@ -1668,6 +1684,8 @@ impl Op {
|
||||
Op::Cdq => false,
|
||||
Op::Rol => false,
|
||||
Op::Ror => false,
|
||||
Op::Rcl => false,
|
||||
Op::Rcr => false,
|
||||
Op::Shl => false,
|
||||
Op::Shr => false,
|
||||
Op::Sar => false,
|
||||
@@ -1844,7 +1862,7 @@ impl Op {
|
||||
}
|
||||
}
|
||||
|
||||
pub static FORMS: [Form; 369] = [
|
||||
pub static FORMS: [Form; 388] = [
|
||||
Form { op: Op::Movsxd, encoding: Encoding::RegRm, size: OperandSize::Wide, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Push, encoding: Encoding::OpReg, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Pop, encoding: Encoding::OpReg, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
@@ -1867,6 +1885,13 @@ pub static FORMS: [Form; 369] = [
|
||||
Form { op: Op::Test, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Xchg, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Xchg, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Xchg, encoding: Encoding::OpReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Xchg, encoding: Encoding::OpReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Xchg, encoding: Encoding::OpReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Xchg, encoding: Encoding::OpReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Xchg, encoding: Encoding::OpReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Xchg, encoding: Encoding::OpReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Xchg, encoding: Encoding::OpReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Mov, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Mov, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Mov, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
@@ -2186,31 +2211,43 @@ pub static FORMS: [Form; 369] = [
|
||||
Form { op: Op::Dec, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rol, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Ror, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rcl, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rcr, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Shl, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Shr, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Sar, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rol, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Ror, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rcl, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rcr, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Shl, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Shr, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Sar, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rol, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Ror, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rcl, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rcr, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Shl, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Shr, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Sar, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rol, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Ror, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rcl, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rcr, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Shl, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Shr, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Sar, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rol, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Ror, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rcl, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rcr, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Shl, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Shr, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Sar, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rol, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Ror, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rcl, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Rcr, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Shl, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Shr, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Sar, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
|
||||
@@ -2218,47 +2255,47 @@ pub static FORMS: [Form; 369] = [
|
||||
|
||||
/// Form per ModRM digit; 65535 marks an unsupported digit.
|
||||
pub static GROUPS: [[u16; 8]; 22] = [
|
||||
[253, 262, 271, 280, 289, 298, 307, 316],
|
||||
[254, 263, 272, 281, 290, 299, 308, 317],
|
||||
[255, 264, 273, 282, 291, 300, 309, 318],
|
||||
[260, 269, 278, 287, 296, 305, 314, 323],
|
||||
[261, 270, 279, 288, 297, 306, 315, 324],
|
||||
[262, 271, 280, 289, 298, 307, 316, 325],
|
||||
[6, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[339, 340, 65535, 65535, 341, 342, 65535, 343],
|
||||
[344, 345, 65535, 65535, 346, 347, 65535, 348],
|
||||
[33, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[34, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[349, 350, 65535, 65535, 351, 352, 65535, 353],
|
||||
[354, 355, 65535, 65535, 356, 357, 65535, 358],
|
||||
[359, 360, 65535, 65535, 361, 362, 65535, 363],
|
||||
[364, 365, 65535, 65535, 366, 367, 65535, 368],
|
||||
[18, 65535, 323, 324, 325, 326, 327, 328],
|
||||
[19, 65535, 329, 330, 331, 332, 333, 334],
|
||||
[335, 336, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[337, 338, 41, 65535, 42, 65535, 5, 65535],
|
||||
[28, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[65535, 65535, 193, 194, 65535, 65535, 65535, 65535],
|
||||
[65535, 65535, 65535, 65535, 319, 320, 321, 322],
|
||||
[65535, 65535, 165, 65535, 167, 65535, 169, 65535],
|
||||
[65535, 65535, 171, 65535, 173, 65535, 175, 65535],
|
||||
[65535, 65535, 177, 180, 65535, 65535, 179, 181],
|
||||
[346, 347, 348, 349, 350, 351, 65535, 352],
|
||||
[353, 354, 355, 356, 357, 358, 65535, 359],
|
||||
[40, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[41, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[360, 361, 362, 363, 364, 365, 65535, 366],
|
||||
[367, 368, 369, 370, 371, 372, 65535, 373],
|
||||
[374, 375, 376, 377, 378, 379, 65535, 380],
|
||||
[381, 382, 383, 384, 385, 386, 65535, 387],
|
||||
[18, 65535, 330, 331, 332, 333, 334, 335],
|
||||
[19, 65535, 336, 337, 338, 339, 340, 341],
|
||||
[342, 343, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[344, 345, 48, 65535, 49, 65535, 5, 65535],
|
||||
[35, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[65535, 65535, 200, 201, 65535, 65535, 65535, 65535],
|
||||
[65535, 65535, 65535, 65535, 326, 327, 328, 329],
|
||||
[65535, 65535, 172, 65535, 174, 65535, 176, 65535],
|
||||
[65535, 65535, 178, 65535, 180, 65535, 182, 65535],
|
||||
[65535, 65535, 184, 187, 65535, 65535, 186, 188],
|
||||
];
|
||||
|
||||
pub static ONE_BYTE: [Entry; 256] = [
|
||||
Entry::Form(247), Entry::Form(248), Entry::Form(249), Entry::Form(250),
|
||||
Entry::Form(251), Entry::Form(252), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(256), Entry::Form(257), Entry::Form(258), Entry::Form(259),
|
||||
Entry::Form(260), Entry::Form(261), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(265), Entry::Form(266), Entry::Form(267), Entry::Form(268),
|
||||
Entry::Form(269), Entry::Form(270), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(274), Entry::Form(275), Entry::Form(276), Entry::Form(277),
|
||||
Entry::Form(278), Entry::Form(279), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(283), Entry::Form(284), Entry::Form(285), Entry::Form(286),
|
||||
Entry::Form(287), Entry::Form(288), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(292), Entry::Form(293), Entry::Form(294), Entry::Form(295),
|
||||
Entry::Form(296), Entry::Form(297), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(301), Entry::Form(302), Entry::Form(303), Entry::Form(304),
|
||||
Entry::Form(305), Entry::Form(306), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(310), Entry::Form(311), Entry::Form(312), Entry::Form(313),
|
||||
Entry::Form(314), Entry::Form(315), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(254), Entry::Form(255), Entry::Form(256), Entry::Form(257),
|
||||
Entry::Form(258), Entry::Form(259), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(263), Entry::Form(264), Entry::Form(265), Entry::Form(266),
|
||||
Entry::Form(267), Entry::Form(268), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(272), Entry::Form(273), Entry::Form(274), Entry::Form(275),
|
||||
Entry::Form(276), Entry::Form(277), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(281), Entry::Form(282), Entry::Form(283), Entry::Form(284),
|
||||
Entry::Form(285), Entry::Form(286), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(290), Entry::Form(291), Entry::Form(292), Entry::Form(293),
|
||||
Entry::Form(294), Entry::Form(295), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(299), Entry::Form(300), Entry::Form(301), Entry::Form(302),
|
||||
Entry::Form(303), Entry::Form(304), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(308), Entry::Form(309), Entry::Form(310), Entry::Form(311),
|
||||
Entry::Form(312), Entry::Form(313), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(317), Entry::Form(318), Entry::Form(319), Entry::Form(320),
|
||||
Entry::Form(321), Entry::Form(322), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2277,23 +2314,23 @@ pub static ONE_BYTE: [Entry; 256] = [
|
||||
Entry::Form(10), Entry::Form(10), Entry::Form(10), Entry::Form(10),
|
||||
Entry::Group(0), Entry::Group(1), Entry::Unsupported, Entry::Group(2),
|
||||
Entry::Form(14), Entry::Form(15), Entry::Form(20), Entry::Form(21),
|
||||
Entry::Form(22), Entry::Form(23), Entry::Form(24), Entry::Form(25),
|
||||
Entry::Unsupported, Entry::Form(26), Entry::Unsupported, Entry::Group(3),
|
||||
Entry::Form(27), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(29), Entry::Form(30), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(29), Entry::Form(30), Entry::Form(31), Entry::Form(32),
|
||||
Entry::Unsupported, Entry::Form(33), Entry::Unsupported, Entry::Group(3),
|
||||
Entry::Form(34), Entry::Form(22), Entry::Form(23), Entry::Form(24),
|
||||
Entry::Form(25), Entry::Form(26), Entry::Form(27), Entry::Form(28),
|
||||
Entry::Form(36), Entry::Form(37), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(49), Entry::Form(50), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(16), Entry::Form(17), Entry::Form(51), Entry::Form(52),
|
||||
Entry::Form(56), Entry::Form(57), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(16), Entry::Form(17), Entry::Form(58), Entry::Form(59),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(31), Entry::Form(31), Entry::Form(31), Entry::Form(31),
|
||||
Entry::Form(31), Entry::Form(31), Entry::Form(31), Entry::Form(31),
|
||||
Entry::Form(32), Entry::Form(32), Entry::Form(32), Entry::Form(32),
|
||||
Entry::Form(32), Entry::Form(32), Entry::Form(32), Entry::Form(32),
|
||||
Entry::Group(4), Entry::Group(5), Entry::Form(35), Entry::Form(36),
|
||||
Entry::Form(38), Entry::Form(38), Entry::Form(38), Entry::Form(38),
|
||||
Entry::Form(38), Entry::Form(38), Entry::Form(38), Entry::Form(38),
|
||||
Entry::Form(39), Entry::Form(39), Entry::Form(39), Entry::Form(39),
|
||||
Entry::Form(39), Entry::Form(39), Entry::Form(39), Entry::Form(39),
|
||||
Entry::Group(4), Entry::Group(5), Entry::Form(42), Entry::Form(43),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Group(6), Entry::Group(7),
|
||||
Entry::Unsupported, Entry::Form(37), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(44), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Group(8), Entry::Group(9), Entry::Group(10), Entry::Group(11),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2301,27 +2338,27 @@ pub static ONE_BYTE: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(38), Entry::Form(39), Entry::Unsupported, Entry::Form(40),
|
||||
Entry::Form(45), Entry::Form(46), Entry::Unsupported, Entry::Form(47),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(43), Entry::Form(44), Entry::Group(12), Entry::Group(13),
|
||||
Entry::Form(45), Entry::Form(46), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(53), Entry::Form(54), Entry::Group(14), Entry::Group(15),
|
||||
Entry::Form(50), Entry::Form(51), Entry::Group(12), Entry::Group(13),
|
||||
Entry::Form(52), Entry::Form(53), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(60), Entry::Form(61), Entry::Group(14), Entry::Group(15),
|
||||
];
|
||||
|
||||
pub static TWO_BYTE: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(47), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(54), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(77), Entry::Form(78), Entry::Form(96), Entry::Form(98),
|
||||
Entry::Form(187), Entry::Form(189), Entry::Form(100), Entry::Form(102),
|
||||
Entry::Form(84), Entry::Form(85), Entry::Form(103), Entry::Form(105),
|
||||
Entry::Form(194), Entry::Form(196), Entry::Form(107), Entry::Form(109),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Group(16),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(73), Entry::Form(74), Entry::Unsupported, Entry::Form(86),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(227), Entry::Form(228),
|
||||
Entry::Form(80), Entry::Form(81), Entry::Unsupported, Entry::Form(93),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(234), Entry::Form(235),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2330,10 +2367,10 @@ pub static TWO_BYTE: [Entry; 256] = [
|
||||
Entry::Form(12), Entry::Form(12), Entry::Form(12), Entry::Form(12),
|
||||
Entry::Form(12), Entry::Form(12), Entry::Form(12), Entry::Form(12),
|
||||
Entry::Form(12), Entry::Form(12), Entry::Form(12), Entry::Form(12),
|
||||
Entry::Form(104), Entry::Form(195), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(108), Entry::Form(111), Entry::Form(114), Entry::Form(117),
|
||||
Entry::Form(199), Entry::Form(203), Entry::Form(231), Entry::Form(235),
|
||||
Entry::Form(207), Entry::Form(211), Entry::Form(215), Entry::Form(219),
|
||||
Entry::Form(111), Entry::Form(202), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(115), Entry::Form(118), Entry::Form(121), Entry::Form(124),
|
||||
Entry::Form(206), Entry::Form(210), Entry::Form(238), Entry::Form(242),
|
||||
Entry::Form(214), Entry::Form(218), Entry::Form(222), Entry::Form(226),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2350,18 +2387,18 @@ pub static TWO_BYTE: [Entry; 256] = [
|
||||
Entry::Form(13), Entry::Form(13), Entry::Form(13), Entry::Form(13),
|
||||
Entry::Form(13), Entry::Form(13), Entry::Form(13), Entry::Form(13),
|
||||
Entry::Form(13), Entry::Form(13), Entry::Form(13), Entry::Form(13),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(48), Entry::Form(65),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(55), Entry::Form(72),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(66),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(73),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Group(17), Entry::Form(9),
|
||||
Entry::Form(69), Entry::Form(70), Entry::Unsupported, Entry::Form(67),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(55), Entry::Form(56),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Group(18), Entry::Form(68),
|
||||
Entry::Form(60), Entry::Form(61), Entry::Form(57), Entry::Form(58),
|
||||
Entry::Form(71), Entry::Form(72), Entry::Form(223), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(185), Entry::Unsupported,
|
||||
Entry::Form(59), Entry::Form(59), Entry::Form(59), Entry::Form(59),
|
||||
Entry::Form(59), Entry::Form(59), Entry::Form(59), Entry::Form(59),
|
||||
Entry::Form(76), Entry::Form(77), Entry::Unsupported, Entry::Form(74),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(62), Entry::Form(63),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Group(18), Entry::Form(75),
|
||||
Entry::Form(67), Entry::Form(68), Entry::Form(64), Entry::Form(65),
|
||||
Entry::Form(78), Entry::Form(79), Entry::Form(230), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(192), Entry::Unsupported,
|
||||
Entry::Form(66), Entry::Form(66), Entry::Form(66), Entry::Form(66),
|
||||
Entry::Form(66), Entry::Form(66), Entry::Form(66), Entry::Form(66),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2381,14 +2418,14 @@ pub static TWO_BYTE_66: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(79), Entry::Form(80), Entry::Form(97), Entry::Form(99),
|
||||
Entry::Form(188), Entry::Form(190), Entry::Form(101), Entry::Form(103),
|
||||
Entry::Form(86), Entry::Form(87), Entry::Form(104), Entry::Form(106),
|
||||
Entry::Form(195), Entry::Form(197), Entry::Form(108), Entry::Form(110),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(75), Entry::Form(76), Entry::Unsupported, Entry::Form(87),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(229), Entry::Form(230),
|
||||
Entry::Form(82), Entry::Form(83), Entry::Unsupported, Entry::Form(94),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(236), Entry::Form(237),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2397,18 +2434,18 @@ pub static TWO_BYTE_66: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(105), Entry::Form(196), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(109), Entry::Form(112), Entry::Form(115), Entry::Form(118),
|
||||
Entry::Form(200), Entry::Form(204), Entry::Form(232), Entry::Form(236),
|
||||
Entry::Form(208), Entry::Form(212), Entry::Form(216), Entry::Form(220),
|
||||
Entry::Form(119), Entry::Form(120), Entry::Form(121), Entry::Form(122),
|
||||
Entry::Form(123), Entry::Form(124), Entry::Form(125), Entry::Form(126),
|
||||
Entry::Form(127), Entry::Form(128), Entry::Form(129), Entry::Form(130),
|
||||
Entry::Form(131), Entry::Form(132), Entry::Form(94), Entry::Form(81),
|
||||
Entry::Form(182), Entry::Group(19), Entry::Group(20), Entry::Group(21),
|
||||
Entry::Form(133), Entry::Form(134), Entry::Form(135), Entry::Unsupported,
|
||||
Entry::Form(112), Entry::Form(203), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(116), Entry::Form(119), Entry::Form(122), Entry::Form(125),
|
||||
Entry::Form(207), Entry::Form(211), Entry::Form(239), Entry::Form(243),
|
||||
Entry::Form(215), Entry::Form(219), Entry::Form(223), Entry::Form(227),
|
||||
Entry::Form(126), Entry::Form(127), Entry::Form(128), Entry::Form(129),
|
||||
Entry::Form(130), Entry::Form(131), Entry::Form(132), Entry::Form(133),
|
||||
Entry::Form(134), Entry::Form(135), Entry::Form(136), Entry::Form(137),
|
||||
Entry::Form(138), Entry::Form(139), Entry::Form(101), Entry::Form(88),
|
||||
Entry::Form(189), Entry::Group(19), Entry::Group(20), Entry::Group(21),
|
||||
Entry::Form(140), Entry::Form(141), Entry::Form(142), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(95), Entry::Form(82),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(102), Entry::Form(89),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2425,22 +2462,22 @@ pub static TWO_BYTE_66: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(224), Entry::Unsupported,
|
||||
Entry::Form(191), Entry::Form(192), Entry::Form(186), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(231), Entry::Unsupported,
|
||||
Entry::Form(198), Entry::Form(199), Entry::Form(193), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(164), Entry::Form(170), Entry::Form(176),
|
||||
Entry::Form(136), Entry::Form(137), Entry::Form(93), Entry::Form(106),
|
||||
Entry::Form(138), Entry::Form(139), Entry::Form(140), Entry::Form(107),
|
||||
Entry::Form(141), Entry::Form(142), Entry::Form(143), Entry::Form(110),
|
||||
Entry::Form(144), Entry::Form(166), Entry::Form(172), Entry::Form(145),
|
||||
Entry::Form(146), Entry::Form(147), Entry::Form(238), Entry::Form(85),
|
||||
Entry::Form(148), Entry::Form(149), Entry::Form(150), Entry::Form(113),
|
||||
Entry::Form(151), Entry::Form(152), Entry::Form(153), Entry::Form(116),
|
||||
Entry::Unsupported, Entry::Form(168), Entry::Form(174), Entry::Form(178),
|
||||
Entry::Form(154), Entry::Form(155), Entry::Form(156), Entry::Unsupported,
|
||||
Entry::Form(157), Entry::Form(158), Entry::Form(159), Entry::Form(160),
|
||||
Entry::Unsupported, Entry::Form(171), Entry::Form(177), Entry::Form(183),
|
||||
Entry::Form(143), Entry::Form(144), Entry::Form(100), Entry::Form(113),
|
||||
Entry::Form(145), Entry::Form(146), Entry::Form(147), Entry::Form(114),
|
||||
Entry::Form(148), Entry::Form(149), Entry::Form(150), Entry::Form(117),
|
||||
Entry::Form(151), Entry::Form(173), Entry::Form(179), Entry::Form(152),
|
||||
Entry::Form(153), Entry::Form(154), Entry::Form(245), Entry::Form(92),
|
||||
Entry::Form(155), Entry::Form(156), Entry::Form(157), Entry::Form(120),
|
||||
Entry::Form(158), Entry::Form(159), Entry::Form(160), Entry::Form(123),
|
||||
Entry::Unsupported, Entry::Form(175), Entry::Form(181), Entry::Form(185),
|
||||
Entry::Form(161), Entry::Form(162), Entry::Form(163), Entry::Unsupported,
|
||||
Entry::Form(164), Entry::Form(165), Entry::Form(166), Entry::Form(167),
|
||||
Entry::Form(168), Entry::Form(169), Entry::Form(170), Entry::Unsupported,
|
||||
];
|
||||
|
||||
pub static TWO_BYTE_F3: [Entry; 256] = [
|
||||
@@ -2448,14 +2485,14 @@ pub static TWO_BYTE_F3: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(88), Entry::Form(89), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(95), Entry::Form(96), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(241), Entry::Unsupported,
|
||||
Entry::Form(242), Entry::Form(243), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(248), Entry::Unsupported,
|
||||
Entry::Form(249), Entry::Form(250), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2464,18 +2501,18 @@ pub static TWO_BYTE_F3: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(197), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(204), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(201), Entry::Form(205), Entry::Form(233), Entry::Form(237),
|
||||
Entry::Form(209), Entry::Form(213), Entry::Form(217), Entry::Form(221),
|
||||
Entry::Form(208), Entry::Form(212), Entry::Form(240), Entry::Form(244),
|
||||
Entry::Form(216), Entry::Form(220), Entry::Form(224), Entry::Form(228),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(83),
|
||||
Entry::Form(183), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(90),
|
||||
Entry::Form(190), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(92), Entry::Form(84),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(99), Entry::Form(91),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2490,9 +2527,9 @@ pub static TWO_BYTE_F3: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(62), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(63), Entry::Form(64), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(225), Entry::Unsupported,
|
||||
Entry::Form(69), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(70), Entry::Form(71), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(232), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2501,7 +2538,7 @@ pub static TWO_BYTE_F3: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(239), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(246), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2515,14 +2552,14 @@ pub static TWO_BYTE_F2: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(90), Entry::Form(91), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(97), Entry::Form(98), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(244), Entry::Unsupported,
|
||||
Entry::Form(245), Entry::Form(246), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(251), Entry::Unsupported,
|
||||
Entry::Form(252), Entry::Form(253), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2531,15 +2568,15 @@ pub static TWO_BYTE_F2: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(198), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(205), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(202), Entry::Form(206), Entry::Form(234), Entry::Unsupported,
|
||||
Entry::Form(210), Entry::Form(214), Entry::Form(218), Entry::Form(222),
|
||||
Entry::Form(209), Entry::Form(213), Entry::Form(241), Entry::Unsupported,
|
||||
Entry::Form(217), Entry::Form(221), Entry::Form(225), Entry::Form(229),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(184), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(191), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2559,7 +2596,7 @@ pub static TWO_BYTE_F2: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(226), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(233), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2568,7 +2605,7 @@ pub static TWO_BYTE_F2: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(240), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(247), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
|
||||
@@ -1307,6 +1307,18 @@ addr32_sum_wraps_at_32_bits: rbx=ffff0000 rcx=10000+D rax=0 m0=44332211 => rax=1
|
||||
486601d8
|
||||
SDM 2A 2.2.1
|
||||
rex_not_adjacent_to_opcode_is_ignored: rax=112233445566ffff rbx=1 => rax=1122334455660000 f=CPAZso
|
||||
@ .byte 0x41,0x66,0x01,0xd8
|
||||
416601d8
|
||||
SDM 2A 2.2.1
|
||||
ignored_rex_b_does_not_select_r8: rax=112233445566ffff rbx=1 r8=5 => rax=1122334455660000 f=CPAZso
|
||||
@ .byte 0x48,0x64,0x8b,0x03
|
||||
48648b03
|
||||
SDM 2A 2.2.1; 1 3.4.1.1
|
||||
ignored_rex_w_before_segment_prefix_loads_32_bits: rax=ffffffffffffffff rbx=8 fs8=1122334455667788 => rax=44332211 f=*
|
||||
@ .byte 0x41,0x66,0x41,0x01,0xd8
|
||||
41664101d8
|
||||
SDM 2A 2.2.1
|
||||
rex_after_ignored_rex_applies: rax=7 rbx=1 r8=112233445566ffff => r8=1122334455660000 f=CPAZso
|
||||
@ .byte 0x66,0x48,0x01,0xd8
|
||||
664801d8
|
||||
SDM 2A 2.2.1.2
|
||||
@@ -2596,12 +2608,15 @@ add_memory_crosses_contiguous_pages: rdi=D+1000 mffd=ffffffffffffffff => mffd=00
|
||||
push_pop_cross_contiguous_pages: rsp=D+1004 rax=1122334455667788 => rbx=1122334455667788 mffc=8877665544332211 f=*
|
||||
";
|
||||
|
||||
const DEFECT_EXACT_UNMASKED_OVERFLOW: &str = r"
|
||||
const EXACT_UNMASKED_OVERFLOW: &str = r"
|
||||
@ mulss xmm1, xmm2
|
||||
!f30f59ca
|
||||
SDM 1 D.4.2.3 Table D-16 (PE only if inexact); APM 1 4.10.2.8
|
||||
unmasked_overflow_exact_sets_only_oe: x1=s:7f7fffff x2=s:40000000 mx=1b80 => mx=1b88 f=* ! XM
|
||||
unmasked_negative_overflow_exact_sets_only_oe: x1=s:ff7fffff x2=s:40000000 mx=1b80 => mx=1b88 f=* ! XM
|
||||
unmasked_overflow_exact_sets_only_oe_down: x1=s:7f7fffff x2=s:40000000 mx=3b80 => mx=3b88 f=* ! XM
|
||||
unmasked_overflow_exact_sets_only_oe_up: x1=s:7f7fffff x2=s:40000000 mx=5b80 => mx=5b88 f=* ! XM
|
||||
unmasked_overflow_exact_sets_only_oe_zero: x1=s:7f7fffff x2=s:40000000 mx=7b80 => mx=7b88 f=* ! XM
|
||||
@ addsd xmm1, xmm2
|
||||
!f20f58ca
|
||||
SDM 1 D.4.2.3 Table D-16 (PE only if inexact); APM 1 4.10.2.8
|
||||
@@ -2649,10 +2664,7 @@ const GROUPS: &[(&str, &str)] = &[
|
||||
("fp_mxcsr_and_unmasked", FP_MXCSR_AND_UNMASKED),
|
||||
("fp_beyond_sse2", FP_BEYOND_SSE2),
|
||||
("defect_overlong_instruction", DEFECT_OVERLONG_INSTRUCTION),
|
||||
(
|
||||
"defect_exact_unmasked_overflow",
|
||||
DEFECT_EXACT_UNMASKED_OVERFLOW,
|
||||
),
|
||||
("exact_unmasked_overflow", EXACT_UNMASKED_OVERFLOW),
|
||||
("page_crossing", PAGE_CROSSING),
|
||||
];
|
||||
|
||||
@@ -2720,22 +2732,9 @@ const UNSUPPORTED: &[(&str, usize)] = &[
|
||||
("ptest_flags", 0),
|
||||
("push16_moves_rsp_by_two", 0),
|
||||
("pushfq_popfq_status_round_trip", 0),
|
||||
("rcl16_by16", 0),
|
||||
("rcl16_by17_is_identity", 0),
|
||||
("rcl32_by31", 0),
|
||||
("rcl32_cl32_affects_nothing_but_extension", 0),
|
||||
("rcl64_by63", 0),
|
||||
("rcl8_by1_clear_carry_in", 0),
|
||||
("rcl8_by1_set_carry_in_preserves_szap", 0),
|
||||
("rcl8_by8", 0),
|
||||
("rcl8_by9_is_identity", 0),
|
||||
("rcpps_special_values", 0),
|
||||
("rcpss_relative_error_bound", 0),
|
||||
("rcpss_rsqrtss_signal_nothing", 0),
|
||||
("rcr64_by1", 0),
|
||||
("rcr8_by10_is_by_one_mod_9", 0),
|
||||
("rcr8_by1_clear_carry_in", 0),
|
||||
("rcr8_by1_set_carry_in", 0),
|
||||
("rep_lodsb_source_fault", 1),
|
||||
("rep_movsb_addr32_uses_32bit_registers", 1),
|
||||
("repe_cmpsb_fault_restores_flags", 1),
|
||||
@@ -2746,7 +2745,6 @@ const UNSUPPORTED: &[(&str, usize)] = &[
|
||||
("repne_scasb_finds_byte", 1),
|
||||
("repne_scasb_finds_byte_df_clear", 0),
|
||||
("repne_scasd_exhausts_count", 1),
|
||||
("rex_not_adjacent_to_opcode_is_ignored", 0),
|
||||
("roundps_uses_mxcsr_rc", 0),
|
||||
("roundsd_suppress_precision", 0),
|
||||
("roundss_imm_modes", 0),
|
||||
@@ -2757,13 +2755,9 @@ const UNSUPPORTED: &[(&str, usize)] = &[
|
||||
("shld32_by4", 0),
|
||||
("shld32_cl32_is_count_zero", 0),
|
||||
("shld64_by63", 0),
|
||||
("shr_rcr_128bit_right_shift", 1),
|
||||
("shrd32_by8", 0),
|
||||
("shrd64_by1_sign_change", 0),
|
||||
("shrd64_cl64_is_count_zero", 0),
|
||||
("xchg_ax_r9w_preserves_both_uppers", 0),
|
||||
("xchg_eax_ebx_clears_both_uppers", 0),
|
||||
("xchg_rax_r8_is_not_nop", 0),
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -3513,9 +3507,8 @@ fn defect_overlong_instruction() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "known defect (#155): an exact unmasked overflow sets PE as well as OE"]
|
||||
fn defect_exact_unmasked_overflow() {
|
||||
check_group(DEFECT_EXACT_UNMASKED_OVERFLOW);
|
||||
fn exact_unmasked_overflow() {
|
||||
check_group(EXACT_UNMASKED_OVERFLOW);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -4044,11 +4037,7 @@ fn shift_and_rotate_sweep_matches_operation_pseudocode() {
|
||||
runs += bench.runs;
|
||||
}
|
||||
}
|
||||
let wanted: Vec<String> = ["rcl", "rcr"]
|
||||
.iter()
|
||||
.flat_map(|op| WIDTHS.map(|bits| format!("{op}{bits}")))
|
||||
.collect();
|
||||
assert_eq!(refused, wanted, "unsupported shift forms changed");
|
||||
assert_eq!(refused, Vec::<String>::new(), "a shift form is refused");
|
||||
println!("{runs} engine runs");
|
||||
}
|
||||
|
||||
@@ -4738,12 +4727,7 @@ fn deliver(
|
||||
}
|
||||
if lowest + precision - 1 > format.max_exponent() {
|
||||
if mxcsr & OM == 0 {
|
||||
// PE of an exact overflow is `defect_exact_unmasked_overflow`; this
|
||||
// sweep compares every other bit.
|
||||
return Outcome {
|
||||
open: if unbounded_exact { PE } else { 0 },
|
||||
..outcome(0, OE | unbounded_inexact)
|
||||
};
|
||||
return outcome(0, OE | unbounded_inexact);
|
||||
}
|
||||
let to_infinity = match mode {
|
||||
0 => true,
|
||||
|
||||
@@ -54,7 +54,7 @@ def cases():
|
||||
for bits in (8, 16, 32, 64):
|
||||
out += [f"{op} {reg(1, bits)}", f"{op} {reg(9, bits)}", f"{op} {mem(bits)}"]
|
||||
out.append(f"{op} ch")
|
||||
for op in "rol ror shl shr sar".split():
|
||||
for op in "rol ror rcl rcr shl shr sar".split():
|
||||
for bits in (8, 16, 32, 64):
|
||||
for count in ("1", "3", "7", "cl"):
|
||||
out += [f"{op} {reg(3, bits)}, {count}", f"{op} {mem(bits)}, {count}"]
|
||||
@@ -98,6 +98,11 @@ def cases():
|
||||
"cbw", "cwde", "cdqe", "cwd", "cdq", "cqo", "clc", "stc", "cmc", "nop", "cpuid",
|
||||
"nop dword ptr [rax + 8]", "pause", "push r9", "push rbx", "push -5", "push 0x12345678",
|
||||
f"push {mem(64)}", "pop rbx", "pop r12", f"pop {mem(64)}", "leave"]
|
||||
# The accumulator short form of XCHG: 91..97, and 90 with REX.B.
|
||||
for index in range(1, 16):
|
||||
bits = (16, 32, 64)[index % 3]
|
||||
out.append(f"xchg {reg(0, bits)}, {reg(index, bits)}")
|
||||
out += ["xchg r8w, ax", "xchg r8, rax", "xchg r8d, eax", "xchg ecx, eax", "xchg r15w, ax"]
|
||||
return list(dict.fromkeys(out))
|
||||
|
||||
|
||||
|
||||
@@ -547,6 +547,86 @@ d3 4c be 10 | ror dword ptr [rsi + 4*rdi + 16], cl
|
||||
48 d3 4c be 10 | ror qword ptr [rsi + 4*rdi + 16], cl
|
||||
49 c1 cd 3f | ror r13, 63
|
||||
49 c1 cd 00 | ror r13, 0
|
||||
d0 d3 | rcl bl, 1
|
||||
d0 54 be 10 | rcl byte ptr [rsi + 4*rdi + 16], 1
|
||||
c0 d3 03 | rcl bl, 3
|
||||
c0 54 be 10 03 | rcl byte ptr [rsi + 4*rdi + 16], 3
|
||||
c0 d3 07 | rcl bl, 7
|
||||
c0 54 be 10 07 | rcl byte ptr [rsi + 4*rdi + 16], 7
|
||||
d2 d3 | rcl bl, cl
|
||||
d2 54 be 10 | rcl byte ptr [rsi + 4*rdi + 16], cl
|
||||
41 c0 d5 07 | rcl r13b, 7
|
||||
41 c0 d5 00 | rcl r13b, 0
|
||||
66 d1 d3 | rcl bx, 1
|
||||
66 d1 54 be 10 | rcl word ptr [rsi + 4*rdi + 16], 1
|
||||
66 c1 d3 03 | rcl bx, 3
|
||||
66 c1 54 be 10 03 | rcl word ptr [rsi + 4*rdi + 16], 3
|
||||
66 c1 d3 07 | rcl bx, 7
|
||||
66 c1 54 be 10 07 | rcl word ptr [rsi + 4*rdi + 16], 7
|
||||
66 d3 d3 | rcl bx, cl
|
||||
66 d3 54 be 10 | rcl word ptr [rsi + 4*rdi + 16], cl
|
||||
66 41 c1 d5 0f | rcl r13w, 15
|
||||
66 41 c1 d5 00 | rcl r13w, 0
|
||||
d1 d3 | rcl ebx, 1
|
||||
d1 54 be 10 | rcl dword ptr [rsi + 4*rdi + 16], 1
|
||||
c1 d3 03 | rcl ebx, 3
|
||||
c1 54 be 10 03 | rcl dword ptr [rsi + 4*rdi + 16], 3
|
||||
c1 d3 07 | rcl ebx, 7
|
||||
c1 54 be 10 07 | rcl dword ptr [rsi + 4*rdi + 16], 7
|
||||
d3 d3 | rcl ebx, cl
|
||||
d3 54 be 10 | rcl dword ptr [rsi + 4*rdi + 16], cl
|
||||
41 c1 d5 1f | rcl r13d, 31
|
||||
41 c1 d5 00 | rcl r13d, 0
|
||||
48 d1 d3 | rcl rbx, 1
|
||||
48 d1 54 be 10 | rcl qword ptr [rsi + 4*rdi + 16], 1
|
||||
48 c1 d3 03 | rcl rbx, 3
|
||||
48 c1 54 be 10 03 | rcl qword ptr [rsi + 4*rdi + 16], 3
|
||||
48 c1 d3 07 | rcl rbx, 7
|
||||
48 c1 54 be 10 07 | rcl qword ptr [rsi + 4*rdi + 16], 7
|
||||
48 d3 d3 | rcl rbx, cl
|
||||
48 d3 54 be 10 | rcl qword ptr [rsi + 4*rdi + 16], cl
|
||||
49 c1 d5 3f | rcl r13, 63
|
||||
49 c1 d5 00 | rcl r13, 0
|
||||
d0 db | rcr bl, 1
|
||||
d0 5c be 10 | rcr byte ptr [rsi + 4*rdi + 16], 1
|
||||
c0 db 03 | rcr bl, 3
|
||||
c0 5c be 10 03 | rcr byte ptr [rsi + 4*rdi + 16], 3
|
||||
c0 db 07 | rcr bl, 7
|
||||
c0 5c be 10 07 | rcr byte ptr [rsi + 4*rdi + 16], 7
|
||||
d2 db | rcr bl, cl
|
||||
d2 5c be 10 | rcr byte ptr [rsi + 4*rdi + 16], cl
|
||||
41 c0 dd 07 | rcr r13b, 7
|
||||
41 c0 dd 00 | rcr r13b, 0
|
||||
66 d1 db | rcr bx, 1
|
||||
66 d1 5c be 10 | rcr word ptr [rsi + 4*rdi + 16], 1
|
||||
66 c1 db 03 | rcr bx, 3
|
||||
66 c1 5c be 10 03 | rcr word ptr [rsi + 4*rdi + 16], 3
|
||||
66 c1 db 07 | rcr bx, 7
|
||||
66 c1 5c be 10 07 | rcr word ptr [rsi + 4*rdi + 16], 7
|
||||
66 d3 db | rcr bx, cl
|
||||
66 d3 5c be 10 | rcr word ptr [rsi + 4*rdi + 16], cl
|
||||
66 41 c1 dd 0f | rcr r13w, 15
|
||||
66 41 c1 dd 00 | rcr r13w, 0
|
||||
d1 db | rcr ebx, 1
|
||||
d1 5c be 10 | rcr dword ptr [rsi + 4*rdi + 16], 1
|
||||
c1 db 03 | rcr ebx, 3
|
||||
c1 5c be 10 03 | rcr dword ptr [rsi + 4*rdi + 16], 3
|
||||
c1 db 07 | rcr ebx, 7
|
||||
c1 5c be 10 07 | rcr dword ptr [rsi + 4*rdi + 16], 7
|
||||
d3 db | rcr ebx, cl
|
||||
d3 5c be 10 | rcr dword ptr [rsi + 4*rdi + 16], cl
|
||||
41 c1 dd 1f | rcr r13d, 31
|
||||
41 c1 dd 00 | rcr r13d, 0
|
||||
48 d1 db | rcr rbx, 1
|
||||
48 d1 5c be 10 | rcr qword ptr [rsi + 4*rdi + 16], 1
|
||||
48 c1 db 03 | rcr rbx, 3
|
||||
48 c1 5c be 10 03 | rcr qword ptr [rsi + 4*rdi + 16], 3
|
||||
48 c1 db 07 | rcr rbx, 7
|
||||
48 c1 5c be 10 07 | rcr qword ptr [rsi + 4*rdi + 16], 7
|
||||
48 d3 db | rcr rbx, cl
|
||||
48 d3 5c be 10 | rcr qword ptr [rsi + 4*rdi + 16], cl
|
||||
49 c1 dd 3f | rcr r13, 63
|
||||
49 c1 dd 00 | rcr r13, 0
|
||||
d0 e3 | shl bl, 1
|
||||
d0 64 be 10 | shl byte ptr [rsi + 4*rdi + 16], 1
|
||||
c0 e3 03 | shl bl, 3
|
||||
@@ -1046,3 +1126,23 @@ ff 74 be 10 | push qword ptr [rsi + 4*rdi + 16]
|
||||
41 5c | pop r12
|
||||
8f 44 be 10 | pop qword ptr [rsi + 4*rdi + 16]
|
||||
c9 | leave
|
||||
91 | xchg eax, ecx
|
||||
48 92 | xchg rax, rdx
|
||||
66 93 | xchg ax, bx
|
||||
94 | xchg eax, esp
|
||||
48 95 | xchg rax, rbp
|
||||
66 96 | xchg ax, si
|
||||
97 | xchg eax, edi
|
||||
49 90 | xchg rax, r8
|
||||
66 41 91 | xchg ax, r9w
|
||||
41 92 | xchg eax, r10d
|
||||
49 93 | xchg rax, r11
|
||||
66 41 94 | xchg ax, r12w
|
||||
41 95 | xchg eax, r13d
|
||||
49 96 | xchg rax, r14
|
||||
66 41 97 | xchg ax, r15w
|
||||
66 41 90 | xchg r8w, ax
|
||||
49 90 | xchg r8, rax
|
||||
41 90 | xchg r8d, eax
|
||||
91 | xchg ecx, eax
|
||||
66 41 97 | xchg r15w, ax
|
||||
@@ -397,7 +397,7 @@ fn reference(m: &mut Machine, text: &str) -> Outcome {
|
||||
write(m, places[0], (1u128 << bits) - 1 - a);
|
||||
Outcome::Done(none)
|
||||
}
|
||||
"shl" | "shr" | "sar" | "rol" | "ror" => {
|
||||
"shl" | "shr" | "sar" | "rol" | "ror" | "rcl" | "rcr" => {
|
||||
let count = match rest.split(", ").nth(1) {
|
||||
Some("cl") => u32::from(m.gpr[1] as u8),
|
||||
_ => read(m, places[1], 8) as u32,
|
||||
@@ -405,13 +405,22 @@ fn reference(m: &mut Machine, text: &str) -> Outcome {
|
||||
let start = read(m, places[0], bits);
|
||||
let mut value = start;
|
||||
let top = 1u128 << (bits - 1);
|
||||
let mut carry = m.flags.cf;
|
||||
for _ in 0..count {
|
||||
let carry_in = m.flags.cf;
|
||||
let mut carry = carry_in;
|
||||
// RCL and RCR rotate through CF, so `bits + 1` steps come round again.
|
||||
let steps = if matches!(name, "rcl" | "rcr") {
|
||||
count % (bits + 1)
|
||||
} else {
|
||||
count
|
||||
};
|
||||
for _ in 0..steps {
|
||||
// One step at a time, as the SDM loop does.
|
||||
let (high, low) = (bit(value, bits - 1), bit(value, 0));
|
||||
(value, carry) = match name {
|
||||
"shl" => (truncate(value * 2, bits), high),
|
||||
"rol" => (truncate(value * 2, bits) + u128::from(high), high),
|
||||
"rcl" => (truncate(value * 2, bits) + u128::from(carry), high),
|
||||
"rcr" => (value / 2 + if carry { top } else { 0 }, low),
|
||||
"shr" => (value / 2, low),
|
||||
"sar" => (value / 2 + if high { top } else { 0 }, low),
|
||||
_ => (value / 2 + if low { top } else { 0 }, low),
|
||||
@@ -424,7 +433,8 @@ fn reference(m: &mut Machine, text: &str) -> Outcome {
|
||||
let (msb, next) = (bit(value, bits - 1), bit(value, bits - 2));
|
||||
if count == 1 {
|
||||
m.flags.of = match name {
|
||||
"shl" | "rol" => msb != carry,
|
||||
"shl" | "rol" | "rcl" => msb != carry,
|
||||
"rcr" => bit(start, bits - 1) != carry_in,
|
||||
"shr" => bit(start, bits - 1),
|
||||
"sar" => false,
|
||||
_ => msb != next,
|
||||
@@ -1222,10 +1232,9 @@ fn undeclared_and_ambiguous_encodings_are_rejected() {
|
||||
&[0x66, 0xE8, 0, 0], // call rel16
|
||||
&[0x66, 0x0F, 0xC9], // bswap cx (undefined)
|
||||
&[0x66, 0x63, 0xC1], // 16-bit movsxd
|
||||
&[0x41, 0x90], // xchg r8, rax
|
||||
&[0xF3, 0x41, 0x90], // F3 on xchg r8, rax
|
||||
&[0x8D, 0xC0], // lea with a register operand
|
||||
&[0x0F, 0xA3, 0x06], // bt [rsi], eax
|
||||
&[0xC0, 0xD0, 0x01], // rcl al, 1
|
||||
&[0xC6, 0xC8, 0x01], // C6 /1
|
||||
&[0xFF, 0xF8], // FF /7
|
||||
&[0xFE, 0xD0], // FE /2
|
||||
|
||||
@@ -61,6 +61,8 @@ cwde = { ref = "sdm CBW/CWDE/CDQE" }
|
||||
cdq = { ref = "sdm CWD/CDQ/CQO" }
|
||||
rol = { writes = "cf of", conditional = true, ref = "sdm RCL/RCR/ROL/ROR" }
|
||||
ror = { writes = "cf of", conditional = true, ref = "sdm RCL/RCR/ROL/ROR" }
|
||||
rcl = { reads = "cf", writes = "cf of", conditional = true, ref = "sdm RCL/RCR/ROL/ROR" }
|
||||
rcr = { reads = "cf", writes = "cf of", conditional = true, ref = "sdm RCL/RCR/ROL/ROR" }
|
||||
shl = { writes = "cf zf sf of pf", undefined = "af", conditional = true, ref = "sdm SAL/SAR/SHL/SHR" }
|
||||
shr = { writes = "cf zf sf of pf", undefined = "af", conditional = true, ref = "sdm SAL/SAR/SHL/SHR" }
|
||||
sar = { writes = "cf zf sf of pf", undefined = "af", conditional = true, ref = "sdm SAL/SAR/SHL/SHR" }
|
||||
@@ -401,6 +403,51 @@ opcode = 0x87
|
||||
enc = "rm_reg"
|
||||
size = "v"
|
||||
|
||||
# The accumulator with the register in the opcode. Opcode 0x90 is NOP; with
|
||||
# REX.B the decoder reads it as 0x91 with register 0, which is then r8. A row
|
||||
# of eight would have to start at 0x90, so each opcode is its own form.
|
||||
[[form]]
|
||||
op = "xchg"
|
||||
opcode = 0x91
|
||||
enc = "op_reg"
|
||||
size = "v"
|
||||
|
||||
[[form]]
|
||||
op = "xchg"
|
||||
opcode = 0x92
|
||||
enc = "op_reg"
|
||||
size = "v"
|
||||
|
||||
[[form]]
|
||||
op = "xchg"
|
||||
opcode = 0x93
|
||||
enc = "op_reg"
|
||||
size = "v"
|
||||
|
||||
[[form]]
|
||||
op = "xchg"
|
||||
opcode = 0x94
|
||||
enc = "op_reg"
|
||||
size = "v"
|
||||
|
||||
[[form]]
|
||||
op = "xchg"
|
||||
opcode = 0x95
|
||||
enc = "op_reg"
|
||||
size = "v"
|
||||
|
||||
[[form]]
|
||||
op = "xchg"
|
||||
opcode = 0x96
|
||||
enc = "op_reg"
|
||||
size = "v"
|
||||
|
||||
[[form]]
|
||||
op = "xchg"
|
||||
opcode = 0x97
|
||||
enc = "op_reg"
|
||||
size = "v"
|
||||
|
||||
[[form]]
|
||||
op = "mov"
|
||||
opcode = 0x88
|
||||
@@ -779,7 +826,7 @@ digits = { 0 = "inc", 1 = "dec" }
|
||||
|
||||
[[group]]
|
||||
opcodes = [[0xC0, "b", "ib", "rm_imm"], [0xC1, "v", "ib", "rm_imm"], [0xD0, "b", "", "rm_one"], [0xD1, "v", "", "rm_one"], [0xD2, "b", "", "rm_cl"], [0xD3, "v", "", "rm_cl"]]
|
||||
digits = { 0 = "rol", 1 = "ror", 4 = "shl", 5 = "shr", 7 = "sar" }
|
||||
digits = { 0 = "rol", 1 = "ror", 2 = "rcl", 3 = "rcr", 4 = "shl", 5 = "shr", 7 = "sar" }
|
||||
|
||||
# SSE and SSE2 moves and packed integer forms.
|
||||
|
||||
|
||||
@@ -40,8 +40,9 @@ XMM registers live in `CpuState::xmm`, lane 0 in the low bits, and MXCSR in `Cpu
|
||||
|
||||
- a denormal dividend over zero raises divide-by-zero only, not also denormal-operand;
|
||||
- flush-to-zero also flushes a tiny result that is exact, raising underflow and precision;
|
||||
- DAZ applies before conversion to an integer;
|
||||
- an unmasked overflow also records precision.
|
||||
- DAZ applies before conversion to an integer.
|
||||
|
||||
An unmasked overflow records precision only when rounding with an unbounded exponent is inexact (Intel SDM Vol. 1, D.4.2.3, Table D-16). The known-answer cases in `tests/cpu_known_answers.rs` assert this.
|
||||
|
||||
None of it has been compared with x86 hardware.
|
||||
|
||||
@@ -95,4 +96,4 @@ A feature bit is set only when every instruction of that feature is implemented.
|
||||
|
||||
## Rejected on purpose
|
||||
|
||||
LOCK except as described above, F2 or F3 where it is neither PAUSE nor part of a declared form, F2 combined with F3, address-size overrides, an ignored segment override after FS or GS, 16-bit stack and branch forms, 16-bit BSWAP and MOVSXD, bit tests of memory by a register index, RCL, RCR, SHLD, SHRD, LODS, CMPS, SCAS, REPE and REPNE, MMX, the RCP and RSQRT approximations, SSE3 and later, VEX, CMPXCHG8B, CMPXCHG16B and fences. The DBT also refuses raw SYSCALL.
|
||||
LOCK except as described above, F2 or F3 where it is neither PAUSE nor part of a declared form, F2 combined with F3, address-size overrides, an ignored segment override after FS or GS, 16-bit stack and branch forms, 16-bit BSWAP and MOVSXD, bit tests of memory by a register index, SHLD, SHRD, LODS, CMPS, SCAS, REPE and REPNE, MMX, the RCP and RSQRT approximations, SSE3 and later, VEX, CMPXCHG8B, CMPXCHG16B and fences. The DBT also refuses raw SYSCALL.
|
||||
+2
-1
@@ -70,7 +70,8 @@ uses a Win64-aligned stack and terminates with HLT. The result includes the load
|
||||
guest memory and the entry execution outcome.
|
||||
|
||||
`xenora probe --mode static` inventories ordinary and delay-loaded PE imports
|
||||
without guest execution. `missing_imports.csv` lists unresolved ordinary keys
|
||||
without guest execution. Without `--report` it writes to `diagnostics/probe`,
|
||||
where `xenora imports sync` also looks. `missing_imports.csv` lists unresolved ordinary keys
|
||||
with their import address table relative virtual addresses. The full inventory,
|
||||
`imports.csv`, marks each entry `ordinary` or `delayed` in its `import_table`
|
||||
column and records whether each key is registered, its implementation
|
||||
|
||||
@@ -17,10 +17,13 @@ python3 - <<'PY'
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding="utf-8")
|
||||
|
||||
executables = set()
|
||||
for filename in ("native-build.jsonl", "native-tests.jsonl"):
|
||||
for line in (Path("artifacts") / filename).read_text().splitlines():
|
||||
for line in (Path("artifacts") / filename).read_text(encoding="utf-8").splitlines():
|
||||
entry = json.loads(line)
|
||||
if entry.get("executable"):
|
||||
executables.add(entry["executable"])
|
||||
@@ -32,11 +35,11 @@ if not executables:
|
||||
raise SystemExit("No Cargo executable or loadable dependency artifacts found.")
|
||||
for path in sorted(executables):
|
||||
subprocess.run(["file", path], check=True)
|
||||
archs = subprocess.check_output(["lipo", "-archs", path], text=True).strip()
|
||||
archs = subprocess.check_output(["lipo", "-archs", path], encoding="utf-8").strip()
|
||||
print(archs, flush=True)
|
||||
if archs != "arm64":
|
||||
raise SystemExit(f"Non-ARM64 build artifact: {path}")
|
||||
linkage = subprocess.check_output(["otool", "-L", path], text=True)
|
||||
linkage = subprocess.check_output(["otool", "-L", path], encoding="utf-8")
|
||||
print(linkage, end="", flush=True)
|
||||
if any(name in linkage.casefold() for name in ("vulkan", "moltenvk")):
|
||||
raise SystemExit(f"Unexpected graphics linkage: {path}")
|
||||
|
||||
+5
-1
@@ -8,6 +8,10 @@ export MTL_SHADER_VALIDATION=1
|
||||
export MTL_SHADER_VALIDATION_REPORT_TO_STDERR=1
|
||||
export MTL_SHADER_VALIDATION_ABORT_ON_FAULT=1
|
||||
export CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS:-4}
|
||||
# The full semantic-review batch is much larger than the individual GPU tests.
|
||||
# Cold Apple Silicon runs can exceed two minutes; keep the default bounded but
|
||||
# allow slower hosts to raise it without editing the script.
|
||||
export XENORA_SEMANTIC_TIMEOUT=${XENORA_SEMANTIC_TIMEOUT:-300s}
|
||||
|
||||
cargo test --locked -p xenora-metal --features gpu-tests --test native_compute --no-run
|
||||
timeout 30s cargo test --locked -p xenora-metal --features gpu-tests --test native_compute -- \
|
||||
@@ -58,4 +62,4 @@ timeout 30s cargo test --locked -p xenora-ffi --features gpu-tests --test audio_
|
||||
# Native Metal known answers of the independent semantic review, including SOP2 scalar ALU
|
||||
# and VOPC compares.
|
||||
cargo test --locked -p xenora-semantic-review --no-run
|
||||
timeout 120s cargo test --locked -p xenora-semantic-review -- --ignored --nocapture --test-threads=1
|
||||
timeout "$XENORA_SEMANTIC_TIMEOUT" cargo test --locked -p xenora-semantic-review -- --ignored --nocapture --test-threads=1
|
||||
@@ -0,0 +1,112 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Exercise native audit JSON decoding and inspection under an ASCII locale."""
|
||||
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
SCRIPT = (ROOT / "scripts/audit/native.sh").read_text(encoding="utf-8")
|
||||
AUDIT = SCRIPT.split("python3 - <<'PY'\n", 1)[1].rsplit("\nPY", 1)[0]
|
||||
# Reader-only cases stop before the native executable inspection.
|
||||
READER = AUDIT.split("\nif not executables:", 1)[0]
|
||||
|
||||
|
||||
class NativeJsonTests(unittest.TestCase):
|
||||
def run_audit(self, streams, code=READER):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
artifacts = Path(directory) / "artifacts"
|
||||
artifacts.mkdir()
|
||||
for name, payload in zip(
|
||||
("native-build.jsonl", "native-tests.jsonl"), streams, strict=True
|
||||
):
|
||||
(artifacts / name).write_bytes(payload)
|
||||
return subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"-c",
|
||||
"import locale\n"
|
||||
"assert locale.getencoding().lower() in ('ascii', 'us-ascii')\n"
|
||||
+ code
|
||||
+ "\nprint(json.dumps(sorted(executables)))\n",
|
||||
],
|
||||
cwd=directory,
|
||||
env={
|
||||
**os.environ,
|
||||
"LC_ALL": "C",
|
||||
"PYTHONCOERCECLOCALE": "0",
|
||||
"PYTHONUTF8": "0",
|
||||
},
|
||||
capture_output=True,
|
||||
encoding="utf-8",
|
||||
check=False,
|
||||
)
|
||||
|
||||
def test_utf8_in_each_cargo_stream(self):
|
||||
for stream in (0, 1):
|
||||
with self.subTest(stream=stream):
|
||||
entry = {
|
||||
"executable": "/synthetic/caf\u00e9/bin",
|
||||
"filenames": ["/synthetic/caf\u00e9/lib.dylib"],
|
||||
"message": {"rendered": "synthetic diagnostic: \u03bb"},
|
||||
}
|
||||
streams = [b'{}\n', b'{}\n']
|
||||
streams[stream] = (json.dumps(entry, ensure_ascii=False) + "\n").encode(
|
||||
"utf-8"
|
||||
)
|
||||
result = self.run_audit(streams)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertEqual(
|
||||
json.loads(result.stdout),
|
||||
["/synthetic/caf\u00e9/bin", "/synthetic/caf\u00e9/lib.dylib"],
|
||||
)
|
||||
|
||||
def test_ascii_streams_keep_deduplicated_artifacts(self):
|
||||
entry = b'{"executable":"/synthetic/bin","filenames":["/synthetic/lib.so","/synthetic/lib.rlib"]}\n'
|
||||
result = self.run_audit([entry, entry])
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertEqual(
|
||||
json.loads(result.stdout), ["/synthetic/bin", "/synthetic/lib.so"]
|
||||
)
|
||||
|
||||
def test_invalid_utf8_is_rejected(self):
|
||||
result = self.run_audit([b'{"executable":"\xff"}\n', b'{}\n'])
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("UnicodeDecodeError", result.stderr)
|
||||
|
||||
@unittest.skipUnless(
|
||||
sys.platform == "darwin" and platform.machine() == "arm64",
|
||||
"requires native ARM64 macOS inspection tools",
|
||||
)
|
||||
def test_native_inspection_of_unicode_path_under_ascii_locale(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
source = root / "fixture.c"
|
||||
source.write_text("int main(void) { return 0; }\n", encoding="utf-8")
|
||||
binary = root / "caf\u00e9"
|
||||
subprocess.run(
|
||||
["/usr/bin/clang", "-arch", "arm64", str(source), "-o", str(binary)],
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
entry = (
|
||||
json.dumps({"executable": str(binary)}, ensure_ascii=False) + "\n"
|
||||
).encode("utf-8")
|
||||
for stream in (0, 1):
|
||||
with self.subTest(stream=stream):
|
||||
streams = [b'{}\n', b'{}\n']
|
||||
streams[stream] = entry
|
||||
result = self.run_audit(streams, code=AUDIT)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertIn(str(binary), result.stdout)
|
||||
self.assertIn("Checked 1 native executables", result.stdout)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user