mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-26 11:40:43 +00:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf4010ba94 | ||
|
|
e755ee94ed | ||
|
|
e289318132 | ||
|
|
f685b54e32 | ||
|
|
0690a3ecb4 | ||
|
|
7286989296 |
No files matched your search
@@ -50,8 +50,6 @@ remains unsupported.
|
||||
- Added 35 known-answer cases for MOV with an immediate operand, opcodes C6 /0 and C7 /0 (#194), to `cpu_known_answers.rs`: byte, word, dword and qword stores through base, SIB, R12, R13, RSP and RBP addressing with 8-bit and 32-bit displacements; the imm32 sign extension of the 64-bit form; the register forms, including AH and a REX-selected SIL; unmapped and read-only store faults at each width; and #UD for reg field 1. Expected values come from the Intel SDM and were worked out by hand. The interpreter and the DBT already agreed with all of them, so this is new coverage and fixes no defect. The 16-bit forms covered are those that already run, and #118 stays open. Not compared with x86 hardware; awaiting independent review.
|
||||
- Added Win64 service-call ABI tests in `crates/loader/tests/runtime_services.rs` for #201. A dispatch-level test and a DBT guest-call test verify 16-byte-aligned call entry (`RSP % 16 == 8`), caller-owned 32-byte shadow space accessibility/integrity, return-value/stack/RIP return state, and preservation of RBX/RBP/RDI/RSI/R12-R15 and XMM6-XMM15 across registered service calls. Expected values are derived from the Microsoft x64 calling convention, not from current implementation behavior.
|
||||
- `dbt_bench` can compare two of its JSON documents when `XENORA_DBT_BENCH_COMPARE=<baseline.json>,<candidate.json>` is set (#114). It prints each median with its change and whether the change exceeds the larger recorded IQR, and lists changed DBT counters. It refuses, with exit status 1 and the differing field named, to compare runs from different CPUs, operating systems or architectures, with unknown host fields, or with different workloads, sample counts, debug assertions or build labels. A new optional `XENORA_DBT_BENCH_BUILD_LABEL` records build settings the benchmark cannot see, such as LTO. No benchmark runs in this mode.
|
||||
- LAHF and SAHF run in both engines, and guest CPUID reports them in leaf `8000_0001h`, ECX bit 0 (#387; Intel SDM Vol. 2A LAHF, Vol. 2B SAHF). The DBT runs them through the shared semantics. The four known answers from #155 that both engines refused are now verified, with twelve more cases, and the independent reference in `tests/x86_integer.rs` covers both instructions.
|
||||
- LOOP, LOOPE, LOOPNE and JRCXZ run in both engines (#396; Intel SDM Vol. 2A, LOOP/LOOPcc and Jcc). The count is RCX; the address-size prefix stays rejected, so JECXZ and the ECX-counted forms are still refused. The DBT runs them through the shared semantics and ends its block at each. The three known answers from #155 that both engines refused are now verified, with eleven more cases, and `tests/cpu_loop.rs` checks a loop that spans translated blocks against a step-by-step model for every count, ZF match point and step budget.
|
||||
- `dbt_bench` can also write its results as one JSON document when `XENORA_DBT_BENCH_JSON=<path>` is set (#112). The document records the host CPU, OS and architecture, the git revision and whether the tree had local changes, debug assertions, the workload and sample counts, the median, minimum, maximum, p95, p99, IQR and MIPS for the interpreter and for cold and warm DBT, and the cold DBT counters. Anything the benchmark cannot determine is `null`. The text output and the timed work are unchanged.
|
||||
- Added synthetic guest handle-lifetime regression tests (#205) for capacity reuse, stale handles, duplicate rights and lifetime, wrong object types, thread pseudo handles and failed-output nonmutation. Runtime behavior is unchanged; independent acceptance is pending.
|
||||
- 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).
|
||||
|
||||
@@ -164,8 +164,6 @@ impl CpuState {
|
||||
pub const CPUID_CMOV: u32 = 1 << 15;
|
||||
/// CPUID leaf 1, ECX: POPCNT.
|
||||
pub const CPUID_POPCNT: u32 = 1 << 23;
|
||||
/// CPUID leaf 0x8000_0001, ECX: LAHF and SAHF in 64-bit mode.
|
||||
pub const CPUID_LAHF_SAHF: u32 = 1;
|
||||
/// CPUID leaf 0x8000_0001, ECX: LZCNT.
|
||||
pub const CPUID_LZCNT: u32 = 1 << 5;
|
||||
/// CPUID leaf 0x8000_0001, EDX: 64-bit mode.
|
||||
@@ -186,7 +184,7 @@ pub fn cpuid(leaf: u32, _subleaf: u32) -> [u32; 4] {
|
||||
1 => [0, 0, CPUID_POPCNT, CPUID_CMOV],
|
||||
// Highest extended leaf.
|
||||
0x8000_0000 => [0x8000_0001, 0, 0, 0],
|
||||
0x8000_0001 => [0, 0, CPUID_LAHF_SAHF | CPUID_LZCNT, CPUID_LONG_MODE],
|
||||
0x8000_0001 => [0, 0, CPUID_LZCNT, CPUID_LONG_MODE],
|
||||
_ => [0; 4],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,26 +690,6 @@ pub fn execute(
|
||||
next = insn.imm;
|
||||
}
|
||||
}
|
||||
// The count is RCX, decremented without changing any flag; LOOPE and
|
||||
// LOOPNE also test ZF (Intel SDM Vol. 2A, LOOP/LOOPcc).
|
||||
Op::Loop | Op::Loope | Op::Loopne => {
|
||||
let count = cpu.gpr[RCX].wrapping_sub(1);
|
||||
cpu.gpr[RCX] = count;
|
||||
let zf_holds = match insn.op {
|
||||
Op::Loope => cpu.flags.zf,
|
||||
Op::Loopne => !cpu.flags.zf,
|
||||
_ => true,
|
||||
};
|
||||
if count != 0 && zf_holds {
|
||||
next = insn.imm;
|
||||
}
|
||||
}
|
||||
// JRCXZ reads RCX and changes nothing (Intel SDM Vol. 2A, Jcc).
|
||||
Op::Jrcxz => {
|
||||
if cpu.gpr[RCX] == 0 {
|
||||
next = insn.imm;
|
||||
}
|
||||
}
|
||||
Op::Ret => {
|
||||
let sp = cpu.gpr[RSP];
|
||||
next = read_mem(memory, sp, 8)?;
|
||||
@@ -768,28 +748,6 @@ pub fn execute(
|
||||
Op::Clc => cpu.flags.cf = false,
|
||||
Op::Stc => cpu.flags.cf = true,
|
||||
Op::Cmc => cpu.flags.cf = !cpu.flags.cf,
|
||||
// AH = SF:ZF:0:AF:0:PF:1:CF (Intel SDM Vol. 2A, LAHF).
|
||||
Op::Lahf => {
|
||||
let f = cpu.flags;
|
||||
let ah = u64::from(f.sf) << 7
|
||||
| u64::from(f.zf) << 6
|
||||
| u64::from(f.af) << 4
|
||||
| u64::from(f.pf) << 2
|
||||
| 1 << 1
|
||||
| u64::from(f.cf);
|
||||
cpu.gpr[RAX] = cpu.gpr[RAX] & !0xFF00 | ah << 8;
|
||||
}
|
||||
// SF, ZF, AF, PF and CF from AH bits 7, 6, 4, 2 and 0; OF is
|
||||
// unchanged (Intel SDM Vol. 2B, SAHF).
|
||||
Op::Sahf => {
|
||||
let ah = (cpu.gpr[RAX] >> 8) as u8;
|
||||
let flags = &mut cpu.flags;
|
||||
flags.sf = ah & 0x80 != 0;
|
||||
flags.zf = ah & 0x40 != 0;
|
||||
flags.af = ah & 0x10 != 0;
|
||||
flags.pf = ah & 0x04 != 0;
|
||||
flags.cf = ah & 0x01 != 0;
|
||||
}
|
||||
Op::Hlt => {
|
||||
cpu.rip = next;
|
||||
return Ok(Some(ExitReason::Halt));
|
||||
|
||||
+125
-185
@@ -63,10 +63,6 @@ pub enum Op {
|
||||
Call,
|
||||
Jmp,
|
||||
Jcc,
|
||||
Loopne,
|
||||
Loope,
|
||||
Loop,
|
||||
Jrcxz,
|
||||
Ret,
|
||||
Nop,
|
||||
Hlt,
|
||||
@@ -74,8 +70,6 @@ pub enum Op {
|
||||
Clc,
|
||||
Stc,
|
||||
Cmc,
|
||||
Lahf,
|
||||
Sahf,
|
||||
Cpuid,
|
||||
Cld,
|
||||
Std,
|
||||
@@ -224,7 +218,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::Rcl, Op::Rcr, Op::Shl, Op::Shr, Op::Sar, Op::Shld, Op::Shrd, 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::Loopne, Op::Loope, Op::Loop, Op::Jrcxz, Op::Ret, Op::Nop, Op::Hlt, Op::Syscall, Op::Clc, Op::Stc, Op::Cmc, Op::Lahf, Op::Sahf, Op::Cpuid, Op::Cld, Op::Std, Op::Fninit, Op::Movs, Op::Stos, Op::Movaps, Op::Movups, Op::Movdqa, Op::Movdqu, Op::Movntdq, Op::Movnti, 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::Lfence, Op::Mfence, Op::Sfence, 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::Shld, Op::Shrd, 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::Fninit, Op::Movs, Op::Stos, Op::Movaps, Op::Movups, Op::Movdqa, Op::Movdqu, Op::Movntdq, Op::Movnti, 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::Lfence, Op::Mfence, Op::Sfence, 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 {
|
||||
@@ -284,10 +278,6 @@ impl Op {
|
||||
Op::Call => "call",
|
||||
Op::Jmp => "jmp",
|
||||
Op::Jcc => "jcc",
|
||||
Op::Loopne => "loopne",
|
||||
Op::Loope => "loope",
|
||||
Op::Loop => "loop",
|
||||
Op::Jrcxz => "jrcxz",
|
||||
Op::Ret => "ret",
|
||||
Op::Nop => "nop",
|
||||
Op::Hlt => "hlt",
|
||||
@@ -295,8 +285,6 @@ impl Op {
|
||||
Op::Clc => "clc",
|
||||
Op::Stc => "stc",
|
||||
Op::Cmc => "cmc",
|
||||
Op::Lahf => "lahf",
|
||||
Op::Sahf => "sahf",
|
||||
Op::Cpuid => "cpuid",
|
||||
Op::Cld => "cld",
|
||||
Op::Std => "std",
|
||||
@@ -503,10 +491,6 @@ impl Op {
|
||||
Op::Call => 0,
|
||||
Op::Jmp => 0,
|
||||
Op::Jcc => 31,
|
||||
Op::Loopne => 2,
|
||||
Op::Loope => 2,
|
||||
Op::Loop => 0,
|
||||
Op::Jrcxz => 0,
|
||||
Op::Ret => 0,
|
||||
Op::Nop => 0,
|
||||
Op::Hlt => 0,
|
||||
@@ -514,8 +498,6 @@ impl Op {
|
||||
Op::Clc => 0,
|
||||
Op::Stc => 0,
|
||||
Op::Cmc => 1,
|
||||
Op::Lahf => 55,
|
||||
Op::Sahf => 0,
|
||||
Op::Cpuid => 0,
|
||||
Op::Cld => 0,
|
||||
Op::Std => 0,
|
||||
@@ -722,10 +704,6 @@ impl Op {
|
||||
Op::Call => 0,
|
||||
Op::Jmp => 0,
|
||||
Op::Jcc => 0,
|
||||
Op::Loopne => 0,
|
||||
Op::Loope => 0,
|
||||
Op::Loop => 0,
|
||||
Op::Jrcxz => 0,
|
||||
Op::Ret => 0,
|
||||
Op::Nop => 0,
|
||||
Op::Hlt => 0,
|
||||
@@ -733,8 +711,6 @@ impl Op {
|
||||
Op::Clc => 1,
|
||||
Op::Stc => 1,
|
||||
Op::Cmc => 1,
|
||||
Op::Lahf => 0,
|
||||
Op::Sahf => 55,
|
||||
Op::Cpuid => 0,
|
||||
Op::Cld => 0,
|
||||
Op::Std => 0,
|
||||
@@ -941,10 +917,6 @@ impl Op {
|
||||
Op::Call => 0,
|
||||
Op::Jmp => 0,
|
||||
Op::Jcc => 0,
|
||||
Op::Loopne => 0,
|
||||
Op::Loope => 0,
|
||||
Op::Loop => 0,
|
||||
Op::Jrcxz => 0,
|
||||
Op::Ret => 0,
|
||||
Op::Nop => 0,
|
||||
Op::Hlt => 0,
|
||||
@@ -952,8 +924,6 @@ impl Op {
|
||||
Op::Clc => 1,
|
||||
Op::Stc => 1,
|
||||
Op::Cmc => 1,
|
||||
Op::Lahf => 0,
|
||||
Op::Sahf => 55,
|
||||
Op::Cpuid => 0,
|
||||
Op::Cld => 0,
|
||||
Op::Std => 0,
|
||||
@@ -1160,10 +1130,6 @@ impl Op {
|
||||
Op::Call => 0,
|
||||
Op::Jmp => 0,
|
||||
Op::Jcc => 0,
|
||||
Op::Loopne => 0,
|
||||
Op::Loope => 0,
|
||||
Op::Loop => 0,
|
||||
Op::Jrcxz => 0,
|
||||
Op::Ret => 0,
|
||||
Op::Nop => 0,
|
||||
Op::Hlt => 0,
|
||||
@@ -1171,8 +1137,6 @@ impl Op {
|
||||
Op::Clc => 0,
|
||||
Op::Stc => 0,
|
||||
Op::Cmc => 0,
|
||||
Op::Lahf => 0,
|
||||
Op::Sahf => 0,
|
||||
Op::Cpuid => 0,
|
||||
Op::Cld => 0,
|
||||
Op::Std => 0,
|
||||
@@ -1379,10 +1343,6 @@ impl Op {
|
||||
Op::Call => true,
|
||||
Op::Jmp => true,
|
||||
Op::Jcc => true,
|
||||
Op::Loopne => true,
|
||||
Op::Loope => true,
|
||||
Op::Loop => true,
|
||||
Op::Jrcxz => true,
|
||||
Op::Ret => true,
|
||||
Op::Nop => false,
|
||||
Op::Hlt => true,
|
||||
@@ -1390,8 +1350,6 @@ impl Op {
|
||||
Op::Clc => false,
|
||||
Op::Stc => false,
|
||||
Op::Cmc => false,
|
||||
Op::Lahf => false,
|
||||
Op::Sahf => false,
|
||||
Op::Cpuid => false,
|
||||
Op::Cld => false,
|
||||
Op::Std => false,
|
||||
@@ -1598,10 +1556,6 @@ impl Op {
|
||||
Op::Call => false,
|
||||
Op::Jmp => false,
|
||||
Op::Jcc => false,
|
||||
Op::Loopne => false,
|
||||
Op::Loope => false,
|
||||
Op::Loop => false,
|
||||
Op::Jrcxz => false,
|
||||
Op::Ret => false,
|
||||
Op::Nop => false,
|
||||
Op::Hlt => false,
|
||||
@@ -1609,8 +1563,6 @@ impl Op {
|
||||
Op::Clc => false,
|
||||
Op::Stc => false,
|
||||
Op::Cmc => false,
|
||||
Op::Lahf => false,
|
||||
Op::Sahf => false,
|
||||
Op::Cpuid => false,
|
||||
Op::Cld => false,
|
||||
Op::Std => false,
|
||||
@@ -1817,10 +1769,6 @@ impl Op {
|
||||
Op::Call => false,
|
||||
Op::Jmp => false,
|
||||
Op::Jcc => false,
|
||||
Op::Loopne => false,
|
||||
Op::Loope => false,
|
||||
Op::Loop => false,
|
||||
Op::Jrcxz => false,
|
||||
Op::Ret => false,
|
||||
Op::Nop => false,
|
||||
Op::Hlt => false,
|
||||
@@ -1828,8 +1776,6 @@ impl Op {
|
||||
Op::Clc => false,
|
||||
Op::Stc => false,
|
||||
Op::Cmc => false,
|
||||
Op::Lahf => false,
|
||||
Op::Sahf => false,
|
||||
Op::Cpuid => false,
|
||||
Op::Cld => false,
|
||||
Op::Std => false,
|
||||
@@ -1979,7 +1925,7 @@ impl Op {
|
||||
}
|
||||
}
|
||||
|
||||
pub static FORMS: [Form; 403] = [
|
||||
pub static FORMS: [Form; 397] = [
|
||||
Form { op: Op::Movsxd, encoding: Encoding::RegRm, size: OperandSize::Wide, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, fixed_rm: None, 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, fixed_rm: None, 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, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
@@ -2018,8 +1964,6 @@ pub static FORMS: [Form; 403] = [
|
||||
Form { op: Op::Nop, encoding: Encoding::RmUnread, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Cwde, encoding: Encoding::None, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Cdq, encoding: Encoding::None, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Sahf, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Lahf, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Mov, encoding: Encoding::OpRegImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Mov, encoding: Encoding::OpRegImm, size: OperandSize::Variable, immediate: Immediate::Full, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Mov, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
@@ -2027,10 +1971,6 @@ pub static FORMS: [Form; 403] = [
|
||||
Form { op: Op::Ret, encoding: Encoding::Imm, size: OperandSize::None, immediate: Immediate::Word, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Ret, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Leave, encoding: Encoding::None, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Loopne, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Loope, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Loop, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Jrcxz, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Call, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::Signed32, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Jmp, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::Signed32, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
Form { op: Op::Jmp, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, fixed_rm: None, no_rex_b: false, unaligned: false, lockable: false },
|
||||
@@ -2387,48 +2327,48 @@ pub static FORMS: [Form; 403] = [
|
||||
|
||||
/// Form per ModRM digit; 65535 marks an unsupported digit.
|
||||
pub static GROUPS: [[u16; 8]; 23] = [
|
||||
[275, 284, 293, 302, 311, 320, 329, 338],
|
||||
[276, 285, 294, 303, 312, 321, 330, 339],
|
||||
[277, 286, 295, 304, 313, 322, 331, 340],
|
||||
[269, 278, 287, 296, 305, 314, 323, 332],
|
||||
[270, 279, 288, 297, 306, 315, 324, 333],
|
||||
[271, 280, 289, 298, 307, 316, 325, 334],
|
||||
[6, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[361, 362, 363, 364, 365, 366, 65535, 367],
|
||||
[368, 369, 370, 371, 372, 373, 65535, 374],
|
||||
[42, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[43, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[375, 376, 377, 378, 379, 380, 65535, 381],
|
||||
[382, 383, 384, 385, 386, 387, 65535, 388],
|
||||
[389, 390, 391, 392, 393, 394, 65535, 395],
|
||||
[396, 397, 398, 399, 400, 401, 65535, 402],
|
||||
[65535, 65535, 65535, 65535, 68, 65535, 65535, 65535],
|
||||
[18, 65535, 345, 346, 347, 348, 349, 350],
|
||||
[19, 65535, 351, 352, 353, 354, 355, 356],
|
||||
[357, 358, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[359, 360, 54, 65535, 55, 65535, 5, 65535],
|
||||
[355, 356, 357, 358, 359, 360, 65535, 361],
|
||||
[362, 363, 364, 365, 366, 367, 65535, 368],
|
||||
[40, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[41, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[369, 370, 371, 372, 373, 374, 65535, 375],
|
||||
[376, 377, 378, 379, 380, 381, 65535, 382],
|
||||
[383, 384, 385, 386, 387, 388, 65535, 389],
|
||||
[390, 391, 392, 393, 394, 395, 65535, 396],
|
||||
[65535, 65535, 65535, 65535, 62, 65535, 65535, 65535],
|
||||
[18, 65535, 339, 340, 341, 342, 343, 344],
|
||||
[19, 65535, 345, 346, 347, 348, 349, 350],
|
||||
[351, 352, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[353, 354, 48, 65535, 49, 65535, 5, 65535],
|
||||
[35, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
|
||||
[65535, 65535, 212, 213, 65535, 214, 215, 216],
|
||||
[65535, 65535, 65535, 65535, 341, 342, 343, 344],
|
||||
[65535, 65535, 206, 207, 65535, 208, 209, 210],
|
||||
[65535, 65535, 65535, 65535, 335, 336, 337, 338],
|
||||
[65535, 65535, 178, 65535, 180, 65535, 182, 65535],
|
||||
[65535, 65535, 184, 65535, 186, 65535, 188, 65535],
|
||||
[65535, 65535, 190, 65535, 192, 65535, 194, 65535],
|
||||
[65535, 65535, 196, 199, 65535, 65535, 198, 200],
|
||||
[65535, 65535, 190, 193, 65535, 65535, 192, 194],
|
||||
];
|
||||
|
||||
pub static ONE_BYTE: [Entry; 256] = [
|
||||
Entry::Form(269), Entry::Form(270), Entry::Form(271), Entry::Form(272),
|
||||
Entry::Form(273), Entry::Form(274), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(278), Entry::Form(279), Entry::Form(280), Entry::Form(281),
|
||||
Entry::Form(282), Entry::Form(283), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(287), Entry::Form(288), Entry::Form(289), Entry::Form(290),
|
||||
Entry::Form(291), Entry::Form(292), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(296), Entry::Form(297), Entry::Form(298), Entry::Form(299),
|
||||
Entry::Form(300), Entry::Form(301), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(305), Entry::Form(306), Entry::Form(307), Entry::Form(308),
|
||||
Entry::Form(309), Entry::Form(310), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(314), Entry::Form(315), Entry::Form(316), Entry::Form(317),
|
||||
Entry::Form(318), Entry::Form(319), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(323), Entry::Form(324), Entry::Form(325), Entry::Form(326),
|
||||
Entry::Form(327), Entry::Form(328), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(332), Entry::Form(333), Entry::Form(334), Entry::Form(335),
|
||||
Entry::Form(336), Entry::Form(337), 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::Form(326), Entry::Form(327), Entry::Form(328), Entry::Form(329),
|
||||
Entry::Form(330), Entry::Form(331), 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,
|
||||
@@ -2452,46 +2392,46 @@ pub static ONE_BYTE: [Entry; 256] = [
|
||||
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::Form(38), Entry::Form(39),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(62), Entry::Form(63), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(16), Entry::Form(17), Entry::Form(64), Entry::Form(65),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(40), Entry::Form(40), Entry::Form(40), Entry::Form(40),
|
||||
Entry::Form(40), Entry::Form(40), Entry::Form(40), Entry::Form(40),
|
||||
Entry::Form(41), Entry::Form(41), Entry::Form(41), Entry::Form(41),
|
||||
Entry::Form(41), Entry::Form(41), Entry::Form(41), Entry::Form(41),
|
||||
Entry::Group(4), Entry::Group(5), Entry::Form(44), Entry::Form(45),
|
||||
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(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(46), 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,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Group(12),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(47), Entry::Form(48), Entry::Form(49), Entry::Form(50),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(51), Entry::Form(52), Entry::Unsupported, Entry::Form(53),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(56), Entry::Form(57), Entry::Group(13), Entry::Group(14),
|
||||
Entry::Form(58), Entry::Form(59), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(66), Entry::Form(67), Entry::Group(15), Entry::Group(16),
|
||||
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(50), Entry::Form(51), Entry::Group(13), Entry::Group(14),
|
||||
Entry::Form(52), Entry::Form(53), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(60), Entry::Form(61), Entry::Group(15), Entry::Group(16),
|
||||
];
|
||||
|
||||
pub static TWO_BYTE: [Entry; 256] = [
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(60), 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(95), Entry::Form(96), Entry::Form(115), Entry::Form(117),
|
||||
Entry::Form(206), Entry::Form(208), Entry::Form(119), Entry::Form(121),
|
||||
Entry::Form(89), Entry::Form(90), Entry::Form(109), Entry::Form(111),
|
||||
Entry::Form(200), Entry::Form(202), Entry::Form(113), Entry::Form(115),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Group(17),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(91), Entry::Form(92), Entry::Unsupported, Entry::Form(105),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(249), Entry::Form(250),
|
||||
Entry::Form(85), Entry::Form(86), Entry::Unsupported, Entry::Form(99),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(243), Entry::Form(244),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2500,10 +2440,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(123), Entry::Form(217), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(127), Entry::Form(130), Entry::Form(133), Entry::Form(136),
|
||||
Entry::Form(221), Entry::Form(225), Entry::Form(253), Entry::Form(257),
|
||||
Entry::Form(229), Entry::Form(233), Entry::Form(237), Entry::Form(241),
|
||||
Entry::Form(117), Entry::Form(211), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(121), Entry::Form(124), Entry::Form(127), Entry::Form(130),
|
||||
Entry::Form(215), Entry::Form(219), Entry::Form(247), Entry::Form(251),
|
||||
Entry::Form(223), Entry::Form(227), Entry::Form(231), 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,
|
||||
@@ -2520,18 +2460,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(61), Entry::Form(79),
|
||||
Entry::Form(87), Entry::Form(88), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(80),
|
||||
Entry::Form(89), Entry::Form(90), Entry::Group(18), Entry::Form(9),
|
||||
Entry::Form(83), Entry::Form(84), Entry::Unsupported, Entry::Form(81),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(69), Entry::Form(70),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Group(19), Entry::Form(82),
|
||||
Entry::Form(74), Entry::Form(75), Entry::Form(71), Entry::Form(72),
|
||||
Entry::Form(85), Entry::Form(86), Entry::Form(245), Entry::Form(104),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(204), Entry::Unsupported,
|
||||
Entry::Form(73), Entry::Form(73), Entry::Form(73), Entry::Form(73),
|
||||
Entry::Form(73), Entry::Form(73), Entry::Form(73), Entry::Form(73),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(55), Entry::Form(73),
|
||||
Entry::Form(81), Entry::Form(82), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(74),
|
||||
Entry::Form(83), Entry::Form(84), Entry::Group(18), Entry::Form(9),
|
||||
Entry::Form(77), Entry::Form(78), Entry::Unsupported, Entry::Form(75),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(63), Entry::Form(64),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Group(19), Entry::Form(76),
|
||||
Entry::Form(68), Entry::Form(69), Entry::Form(65), Entry::Form(66),
|
||||
Entry::Form(79), Entry::Form(80), Entry::Form(239), Entry::Form(98),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(198), Entry::Unsupported,
|
||||
Entry::Form(67), Entry::Form(67), Entry::Form(67), Entry::Form(67),
|
||||
Entry::Form(67), Entry::Form(67), Entry::Form(67), Entry::Form(67),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2551,14 +2491,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(97), Entry::Form(98), Entry::Form(116), Entry::Form(118),
|
||||
Entry::Form(207), Entry::Form(209), Entry::Form(120), Entry::Form(122),
|
||||
Entry::Form(91), Entry::Form(92), Entry::Form(110), Entry::Form(112),
|
||||
Entry::Form(201), Entry::Form(203), Entry::Form(114), Entry::Form(116),
|
||||
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(93), Entry::Form(94), Entry::Unsupported, Entry::Form(106),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(251), Entry::Form(252),
|
||||
Entry::Form(87), Entry::Form(88), Entry::Unsupported, Entry::Form(100),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(245), 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,
|
||||
@@ -2567,18 +2507,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(124), Entry::Form(218), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(128), Entry::Form(131), Entry::Form(134), Entry::Form(137),
|
||||
Entry::Form(222), Entry::Form(226), Entry::Form(254), Entry::Form(258),
|
||||
Entry::Form(230), Entry::Form(234), Entry::Form(238), Entry::Form(242),
|
||||
Entry::Form(138), Entry::Form(139), Entry::Form(140), Entry::Form(141),
|
||||
Entry::Form(142), Entry::Form(143), Entry::Form(144), Entry::Form(145),
|
||||
Entry::Form(146), Entry::Form(147), Entry::Form(148), Entry::Form(149),
|
||||
Entry::Form(150), Entry::Form(151), Entry::Form(113), Entry::Form(99),
|
||||
Entry::Form(201), Entry::Group(20), Entry::Group(21), Entry::Group(22),
|
||||
Entry::Form(152), Entry::Form(153), Entry::Form(154), Entry::Unsupported,
|
||||
Entry::Form(118), Entry::Form(212), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(122), Entry::Form(125), Entry::Form(128), Entry::Form(131),
|
||||
Entry::Form(216), Entry::Form(220), Entry::Form(248), Entry::Form(252),
|
||||
Entry::Form(224), Entry::Form(228), Entry::Form(232), Entry::Form(236),
|
||||
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(140), Entry::Form(141), Entry::Form(142), Entry::Form(143),
|
||||
Entry::Form(144), Entry::Form(145), Entry::Form(107), Entry::Form(93),
|
||||
Entry::Form(195), Entry::Group(20), Entry::Group(21), Entry::Group(22),
|
||||
Entry::Form(146), Entry::Form(147), Entry::Form(148), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(114), Entry::Form(100),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(108), Entry::Form(94),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
@@ -2595,22 +2535,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(246), Entry::Unsupported,
|
||||
Entry::Form(210), Entry::Form(211), Entry::Form(205), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(240), Entry::Unsupported,
|
||||
Entry::Form(204), Entry::Form(205), Entry::Form(199), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(183), Entry::Form(189), Entry::Form(195),
|
||||
Entry::Form(155), Entry::Form(156), Entry::Form(112), Entry::Form(125),
|
||||
Entry::Form(157), Entry::Form(158), Entry::Form(159), Entry::Form(126),
|
||||
Entry::Form(160), Entry::Form(161), Entry::Form(162), Entry::Form(129),
|
||||
Entry::Form(163), Entry::Form(185), Entry::Form(191), Entry::Form(164),
|
||||
Entry::Form(165), Entry::Form(166), Entry::Form(260), Entry::Form(103),
|
||||
Entry::Form(167), Entry::Form(168), Entry::Form(169), Entry::Form(132),
|
||||
Entry::Form(170), Entry::Form(171), Entry::Form(172), Entry::Form(135),
|
||||
Entry::Unsupported, Entry::Form(187), Entry::Form(193), Entry::Form(197),
|
||||
Entry::Form(173), Entry::Form(174), Entry::Form(175), Entry::Unsupported,
|
||||
Entry::Form(176), Entry::Form(177), Entry::Form(178), Entry::Form(179),
|
||||
Entry::Form(180), Entry::Form(181), Entry::Form(182), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(177), Entry::Form(183), Entry::Form(189),
|
||||
Entry::Form(149), Entry::Form(150), Entry::Form(106), Entry::Form(119),
|
||||
Entry::Form(151), Entry::Form(152), Entry::Form(153), Entry::Form(120),
|
||||
Entry::Form(154), Entry::Form(155), Entry::Form(156), Entry::Form(123),
|
||||
Entry::Form(157), Entry::Form(179), Entry::Form(185), Entry::Form(158),
|
||||
Entry::Form(159), Entry::Form(160), Entry::Form(254), Entry::Form(97),
|
||||
Entry::Form(161), Entry::Form(162), Entry::Form(163), Entry::Form(126),
|
||||
Entry::Form(164), Entry::Form(165), Entry::Form(166), Entry::Form(129),
|
||||
Entry::Unsupported, Entry::Form(181), Entry::Form(187), Entry::Form(191),
|
||||
Entry::Form(167), Entry::Form(168), Entry::Form(169), Entry::Unsupported,
|
||||
Entry::Form(170), Entry::Form(171), Entry::Form(172), Entry::Form(173),
|
||||
Entry::Form(174), Entry::Form(175), Entry::Form(176), Entry::Unsupported,
|
||||
];
|
||||
|
||||
pub static TWO_BYTE_F3: [Entry; 256] = [
|
||||
@@ -2618,14 +2558,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(107), Entry::Form(108), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(101), Entry::Form(102), 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(263), Entry::Unsupported,
|
||||
Entry::Form(264), Entry::Form(265), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(257), Entry::Unsupported,
|
||||
Entry::Form(258), Entry::Form(259), 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,
|
||||
@@ -2634,18 +2574,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(219), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(213), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(223), Entry::Form(227), Entry::Form(255), Entry::Form(259),
|
||||
Entry::Form(231), Entry::Form(235), Entry::Form(239), Entry::Form(243),
|
||||
Entry::Form(217), Entry::Form(221), Entry::Form(249), Entry::Form(253),
|
||||
Entry::Form(225), Entry::Form(229), Entry::Form(233), 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,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(101),
|
||||
Entry::Form(202), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(95),
|
||||
Entry::Form(196), 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(111), Entry::Form(102),
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(105), 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,
|
||||
@@ -2660,9 +2600,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(76), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(77), Entry::Form(78), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(247), Entry::Unsupported,
|
||||
Entry::Form(70), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(71), Entry::Form(72), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(241), 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,
|
||||
@@ -2671,7 +2611,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(261), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(255), 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,
|
||||
@@ -2685,14 +2625,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(109), Entry::Form(110), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(103), Entry::Form(104), 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(266), Entry::Unsupported,
|
||||
Entry::Form(267), Entry::Form(268), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(260), Entry::Unsupported,
|
||||
Entry::Form(261), Entry::Form(262), 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,
|
||||
@@ -2701,15 +2641,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(220), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Form(214), Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(224), Entry::Form(228), Entry::Form(256), Entry::Unsupported,
|
||||
Entry::Form(232), Entry::Form(236), Entry::Form(240), Entry::Form(244),
|
||||
Entry::Form(218), Entry::Form(222), Entry::Form(250), Entry::Unsupported,
|
||||
Entry::Form(226), Entry::Form(230), Entry::Form(234), Entry::Form(238),
|
||||
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(203), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported,
|
||||
Entry::Form(197), 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,
|
||||
@@ -2729,7 +2669,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(248), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(242), 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,
|
||||
@@ -2738,7 +2678,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(262), Entry::Unsupported,
|
||||
Entry::Unsupported, Entry::Unsupported, Entry::Form(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,
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
//! assembled with `clang -target x86_64-apple-macos` and read with `objdump`.
|
||||
|
||||
use xenora_loader::cpu::{
|
||||
CPUID_CMOV, CPUID_LAHF_SAHF, CPUID_LONG_MODE, CPUID_LZCNT, CPUID_POPCNT, CpuState, ExitReason,
|
||||
Interpreter, RFlags, cpuid,
|
||||
CPUID_CMOV, CPUID_LONG_MODE, CPUID_LZCNT, CPUID_POPCNT, CpuState, ExitReason, Interpreter,
|
||||
RFlags, cpuid,
|
||||
};
|
||||
use xenora_loader::dbt::DbtEngine;
|
||||
use xenora_loader::memory::{GuestMemory, MemoryPermissions};
|
||||
@@ -79,9 +79,9 @@ fn every_leaf_returns_its_documented_values() {
|
||||
(1, 0xFFFF_FFFF, [0, 0, 0x0080_0000, 0x0000_8000]),
|
||||
// Highest extended leaf.
|
||||
(0x8000_0000, 0, [0x8000_0001, 0, 0, 0]),
|
||||
// LAHF/SAHF is ECX bit 0, LZCNT ECX bit 5 and long mode EDX bit 29.
|
||||
(0x8000_0001, 0, [0, 0, 0x0000_0021, 0x2000_0000]),
|
||||
(0x8000_0001, 7, [0, 0, 0x0000_0021, 0x2000_0000]),
|
||||
// LZCNT is ECX bit 5 and long mode is EDX bit 29.
|
||||
(0x8000_0001, 0, [0, 0, 0x0000_0020, 0x2000_0000]),
|
||||
(0x8000_0001, 7, [0, 0, 0x0000_0020, 0x2000_0000]),
|
||||
// Everything else, above or between the highest leaves, is zeros.
|
||||
(2, 0, [0; 4]),
|
||||
(4, 0, [0; 4]),
|
||||
@@ -129,14 +129,8 @@ fn every_leaf_returns_its_documented_values() {
|
||||
.collect();
|
||||
assert_eq!(vendor, b"Xenora guest");
|
||||
assert_eq!(
|
||||
(
|
||||
CPUID_POPCNT,
|
||||
CPUID_CMOV,
|
||||
CPUID_LAHF_SAHF,
|
||||
CPUID_LZCNT,
|
||||
CPUID_LONG_MODE
|
||||
),
|
||||
(1 << 23, 1 << 15, 1, 1 << 5, 1 << 29)
|
||||
(CPUID_POPCNT, CPUID_CMOV, CPUID_LZCNT, CPUID_LONG_MODE),
|
||||
(1 << 23, 1 << 15, 1 << 5, 1 << 29)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -195,10 +189,6 @@ fn reported_features_have_all_their_instructions_in_the_fixtures() {
|
||||
decodable(&format!("{name} {high}, {}", memory(bits)));
|
||||
}
|
||||
}
|
||||
// LAHF and SAHF have one form each and no operands.
|
||||
assert_ne!(cpuid(0x8000_0001, 0)[ECX] & CPUID_LAHF_SAHF, 0);
|
||||
decodable("lahf");
|
||||
decodable("sahf");
|
||||
// Long mode: 64-bit operands and the registers only it has.
|
||||
assert_ne!(cpuid(0x8000_0001, 0)[EDX] & CPUID_LONG_MODE, 0);
|
||||
decodable("add r9, r12");
|
||||
@@ -242,6 +232,7 @@ fn unreported_features_each_have_an_instruction_that_is_refused() {
|
||||
("RDSEED", 7, EBX, 18, &[0x0F, 0xC7, 0xF8]), // rdseed eax
|
||||
("ADX", 7, EBX, 19, &[0x66, 0x0F, 0x38, 0xF6, 0xC1]), // adcx eax, ecx
|
||||
("SHA", 7, EBX, 29, &[0x0F, 0x38, 0xC9, 0xC1]), // sha1msg1 xmm0, xmm1
|
||||
("LAHF/SAHF", 0x8000_0001, ECX, 0, &[0x9F]), // lahf
|
||||
("PREFETCHW", 0x8000_0001, ECX, 8, &[0x0F, 0x0D, 0x0E]), // prefetchw [rsi]
|
||||
("SYSCALL/SYSRET", 0x8000_0001, EDX, 11, &[0x48, 0x0F, 0x07]), // sysretq
|
||||
("RDTSCP", 0x8000_0001, EDX, 27, &[0x0F, 0x01, 0xF9]), // rdtscp
|
||||
|
||||
@@ -600,15 +600,6 @@ const FLAG_MOVES: &str = r"
|
||||
SDM 2A LAHF
|
||||
lahf: rax=8877665544332211 f=CPASO => rax=8877665544339711 f=*
|
||||
lahf_zero: rax=8877665544332211 f=Z => rax=8877665544334211 f=*
|
||||
lahf_carry_only: rax=ffffffffffffffff f=C => rax=ffffffffffff03ff f=*
|
||||
lahf_parity_only: rax=ffffffffffffffff f=P => rax=ffffffffffff06ff f=*
|
||||
lahf_adjust_only: rax=ffffffffffffffff f=A => rax=ffffffffffff12ff f=*
|
||||
lahf_sign_only: rax=ffffffffffffffff f=S => rax=ffffffffffff82ff f=*
|
||||
lahf_does_not_store_of: rax=ffffffffffffffff f=O => rax=ffffffffffff02ff f=*
|
||||
@ rex.w lahf
|
||||
489f
|
||||
SDM 2A LAHF; 2A 2.2.1.2
|
||||
lahf_rex_w_changes_nothing: rax=ffffffffffffffff f=CO => rax=ffffffffffff03ff f=*
|
||||
@ sahf; lahf
|
||||
9e 9f
|
||||
SDM 2B SAHF
|
||||
@@ -617,12 +608,6 @@ sahf_ignores_bits_1_3_5: rax=ff00 f=O => rax=d700 f=CPAZSO
|
||||
9e
|
||||
SDM 2B SAHF
|
||||
sahf_clear_keeps_of: rax=2800 f=OC => f=cpazsO
|
||||
sahf_carry_only: rax=100 f=O => f=CpazsO
|
||||
sahf_parity_only: rax=400 f=O => f=cPazsO
|
||||
sahf_adjust_only: rax=1000 f=O => f=cpAzsO
|
||||
sahf_zero_only: rax=4000 f=O => f=cpaZsO
|
||||
sahf_sign_only: rax=8000 f=O => f=cpazSO
|
||||
sahf_reads_only_ah: rax=ffffffffffff00ff f=CPAZS => f=cpazso
|
||||
@ stc
|
||||
f9
|
||||
SDM 2B STC
|
||||
@@ -1099,8 +1084,6 @@ cmov_all_unsigned_below_signed_greater: rax=1 rbx=80000000 => rcx=1 r8=1 r9=0 r1
|
||||
b800000000 e305 b801000000 90
|
||||
SDM 2A Jcc
|
||||
jrcxz_tests_all_64_bits: rcx=100000000 => rax=1 f=*
|
||||
jrcxz_sees_bit_63: rcx=8000000000000000 => rax=1 f=*
|
||||
jrcxz_taken_at_zero_keeps_rcx: rcx=0 => rax=0 rcx=0 f=*
|
||||
@ mov eax, 0; jecxz 1f; mov eax, 1; 1: nop
|
||||
b800000000 67e305 b801000000 90
|
||||
SDM 2A Jcc
|
||||
@@ -1113,24 +1096,6 @@ loop_decrements_rcx_without_flags: rax=0 rcx=3 => rax=3 rcx=0 f=*
|
||||
488d4001 e0fa
|
||||
SDM 2A LOOP
|
||||
loopne_stops_on_zero_flag: rax=0 rcx=5 f=Z => rax=1 rcx=4 f=*
|
||||
@ mov eax, 0; loop 1f; mov eax, 1; 1: nop
|
||||
b800000000 e205 b801000000 90
|
||||
SDM 2A LOOP
|
||||
loop_from_zero_wraps_and_branches: rcx=0 => rax=0 rcx=ffffffffffffffff f=*
|
||||
loop_at_one_falls_through: rcx=1 => rax=1 rcx=0 f=*
|
||||
loop_counts_all_64_bits: rcx=100000000 => rax=0 rcx=ffffffff f=*
|
||||
@ mov eax, 0; loope 1f; mov eax, 1; 1: nop
|
||||
b800000000 e105 b801000000 90
|
||||
SDM 2A LOOP
|
||||
loope_taken_with_zf: rcx=2 f=Z => rax=0 rcx=1 f=*
|
||||
loope_not_taken_without_zf: rcx=2 f=CPASO => rax=1 rcx=1 f=*
|
||||
loope_count_expires_with_zf: rcx=1 f=Z => rax=1 rcx=0 f=*
|
||||
@ mov eax, 0; loopne 1f; mov eax, 1; 1: nop
|
||||
b800000000 e005 b801000000 90
|
||||
SDM 2A LOOP
|
||||
loopne_taken_without_zf: rcx=2 f=CPASO => rax=0 rcx=1 f=*
|
||||
loopne_not_taken_with_zf: rcx=2 f=Z => rax=1 rcx=1 f=*
|
||||
loopne_count_expires_without_zf: rcx=1 => rax=1 rcx=0 f=*
|
||||
";
|
||||
|
||||
const STACK_AND_CALLS: &str = r"
|
||||
@@ -3002,11 +2967,16 @@ const UNSUPPORTED: &[(&str, usize)] = &[
|
||||
("haddps_hsubpd_addsubps", 0),
|
||||
("insertps_zero_mask", 0),
|
||||
("jecxz_tests_low_32_bits", 1),
|
||||
("jrcxz_tests_all_64_bits", 1),
|
||||
("lahf", 0),
|
||||
("lahf_zero", 0),
|
||||
("lea64_addr32_truncates_effective_address", 0),
|
||||
("lock_btc_memory", 0),
|
||||
("lodsd_zero_extends", 1),
|
||||
("lodsd_zero_extends_df_clear", 0),
|
||||
("lodsw_preserves_upper48", 1),
|
||||
("loop_decrements_rcx_without_flags", 1),
|
||||
("loopne_stops_on_zero_flag", 1),
|
||||
("maskmovdqu_selects_bytes", 0),
|
||||
("mov_moffs64_load", 0),
|
||||
("mov_moffs8_store", 0),
|
||||
@@ -3048,6 +3018,8 @@ const UNSUPPORTED: &[(&str, usize)] = &[
|
||||
("roundps_uses_mxcsr_rc", 0),
|
||||
("roundsd_suppress_precision", 0),
|
||||
("roundss_imm_modes", 0),
|
||||
("sahf_clear_keeps_of", 0),
|
||||
("sahf_ignores_bits_1_3_5", 0),
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -1,261 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
//! LOOP, LOOPE, LOOPNE and JRCXZ (issue #396).
|
||||
//!
|
||||
//! Expected results come from a step-by-step model written from the operation
|
||||
//! sections of the Intel SDM Vol. 2A for LOOP/LOOPcc and Jcc. The model never
|
||||
//! decodes or calls the production semantics. Encodings were assembled with
|
||||
//! `clang -target x86_64-apple-macos` and read with `objdump`. Nothing was
|
||||
//! compared with x86 hardware.
|
||||
//!
|
||||
//! In 64-bit mode with the default address size the count is RCX. LOOP
|
||||
//! decrements it without changing a flag and branches while the result is not
|
||||
//! zero; LOOPE also needs ZF set and LOOPNE ZF clear. JRCXZ branches when RCX is
|
||||
//! zero and changes nothing.
|
||||
|
||||
use xenora_loader::cpu::{CpuState, ExecutionResult, ExitReason, Interpreter, RFlags};
|
||||
use xenora_loader::dbt::DbtEngine;
|
||||
use xenora_loader::memory::{GuestMemory, MemoryPermissions};
|
||||
|
||||
const ENTRY: u64 = 0x1000;
|
||||
|
||||
const RAX: usize = 0;
|
||||
const RCX: usize = 1;
|
||||
const RBX: usize = 3;
|
||||
const RDI: usize = 7;
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
enum Kind {
|
||||
Loop,
|
||||
Loope,
|
||||
Loopne,
|
||||
}
|
||||
|
||||
impl Kind {
|
||||
fn opcode(self) -> u8 {
|
||||
match self {
|
||||
Kind::Loopne => 0xE0,
|
||||
Kind::Loope => 0xE1,
|
||||
Kind::Loop => 0xE2,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// ```text
|
||||
/// top: inc rbx 48 ff c3
|
||||
/// cmp rbx, rdi 48 39 fb
|
||||
/// jmp next eb 00 ; ends a translated block
|
||||
/// next: loop/loope/loopne top
|
||||
/// hlt f4
|
||||
/// ```
|
||||
fn loop_program(kind: Kind) -> Vec<u8> {
|
||||
vec![
|
||||
0x48,
|
||||
0xFF,
|
||||
0xC3,
|
||||
0x48,
|
||||
0x39,
|
||||
0xFB,
|
||||
0xEB,
|
||||
0x00,
|
||||
kind.opcode(),
|
||||
0xF6,
|
||||
0xF4,
|
||||
]
|
||||
}
|
||||
|
||||
/// Start of each instruction of [`loop_program`], and the end of HLT.
|
||||
const OFFSETS: [u64; 6] = [0, 3, 6, 8, 10, 11];
|
||||
|
||||
fn image(code: &[u8]) -> GuestMemory {
|
||||
let mut memory = GuestMemory::new();
|
||||
memory
|
||||
.map_region_with_data(ENTRY, code.len(), MemoryPermissions::READ_EXECUTE, code)
|
||||
.unwrap();
|
||||
memory
|
||||
}
|
||||
|
||||
/// The interpreter and the DBT, each from its own copy of the state. The DBT
|
||||
/// result carries the state it left in its own copy.
|
||||
fn both(cpu: &CpuState, code: &[u8], budget: usize) -> [(&'static str, ExecutionResult); 2] {
|
||||
let mut interpreted = image(code);
|
||||
let result = Interpreter::new(cpu.clone(), &mut interpreted, budget).run();
|
||||
let mut translated = image(code);
|
||||
let mut state = cpu.clone();
|
||||
let mut native = DbtEngine::new(64 * 1024)
|
||||
.unwrap()
|
||||
.run(&mut state, &mut translated, budget);
|
||||
native.final_state = state;
|
||||
[("interpreter", result), ("DBT", native)]
|
||||
}
|
||||
|
||||
/// What the model predicts after at most `budget` instructions.
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
struct Outcome {
|
||||
exit: ExitReason,
|
||||
executed: usize,
|
||||
rip: u64,
|
||||
rcx: u64,
|
||||
rbx: u64,
|
||||
zf: bool,
|
||||
}
|
||||
|
||||
fn model(kind: Kind, rcx: u64, rbx: u64, rdi: u64, zf: bool, budget: usize) -> Outcome {
|
||||
let (mut rcx, mut rbx, mut zf) = (rcx, rbx, zf);
|
||||
let mut at = 0;
|
||||
let mut executed = 0;
|
||||
while executed < budget {
|
||||
executed += 1;
|
||||
at = match at {
|
||||
// INC writes ZF too (Intel SDM Vol. 2A, INC).
|
||||
0 => {
|
||||
rbx = rbx.wrapping_add(1);
|
||||
zf = rbx == 0;
|
||||
1
|
||||
}
|
||||
1 => {
|
||||
zf = rbx == rdi;
|
||||
2
|
||||
}
|
||||
2 => 3,
|
||||
3 => {
|
||||
rcx = rcx.wrapping_sub(1);
|
||||
let condition = match kind {
|
||||
Kind::Loop => true,
|
||||
Kind::Loope => zf,
|
||||
Kind::Loopne => !zf,
|
||||
};
|
||||
if rcx != 0 && condition { 0 } else { 4 }
|
||||
}
|
||||
_ => {
|
||||
return Outcome {
|
||||
exit: ExitReason::Halt,
|
||||
executed,
|
||||
rip: ENTRY + OFFSETS[5],
|
||||
rcx,
|
||||
rbx,
|
||||
zf,
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
Outcome {
|
||||
exit: ExitReason::StepLimitExceeded,
|
||||
executed,
|
||||
rip: ENTRY + OFFSETS[at],
|
||||
rcx,
|
||||
rbx,
|
||||
zf,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn loops_match_the_model_for_every_count_match_point_and_budget() {
|
||||
let mut checked = 0;
|
||||
for kind in [Kind::Loop, Kind::Loope, Kind::Loopne] {
|
||||
let code = loop_program(kind);
|
||||
for rcx in [0, 1, 2, 3, 5, 0x1_0000_0000] {
|
||||
// RDI is the value of RBX after the iteration whose CMP sets ZF;
|
||||
// 0 never matches within these counts.
|
||||
for rdi in [0, 1, 2, 3, 4] {
|
||||
for zf in [false, true] {
|
||||
// Budgets that stop before, inside and after the loop.
|
||||
for budget in [1, 3, 4, 5, 8, 9, 11, 13, 22, 200] {
|
||||
let wanted = model(kind, rcx, 0, rdi, zf, budget);
|
||||
let mut cpu = CpuState::new(ENTRY, 0);
|
||||
cpu.gpr[RCX] = rcx;
|
||||
cpu.gpr[RDI] = rdi;
|
||||
cpu.flags.zf = zf;
|
||||
for (engine, result) in both(&cpu, &code, budget) {
|
||||
let state = &result.final_state;
|
||||
let found = Outcome {
|
||||
exit: result.exit_reason,
|
||||
executed: result.instructions_executed,
|
||||
rip: state.rip,
|
||||
rcx: state.gpr[RCX],
|
||||
rbx: state.gpr[RBX],
|
||||
zf: state.flags.zf,
|
||||
};
|
||||
assert_eq!(
|
||||
found, wanted,
|
||||
"{kind:?} rcx={rcx:#x} rdi={rdi} zf={zf} budget={budget} on the {engine}"
|
||||
);
|
||||
checked += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assert_eq!(checked, 3 * 6 * 5 * 2 * 10 * 2);
|
||||
}
|
||||
|
||||
/// ```text
|
||||
/// mov eax, 7 b8 07 00 00 00
|
||||
/// jrcxz done e3 05
|
||||
/// mov eax, 1 b8 01 00 00 00
|
||||
/// done: hlt f4
|
||||
/// ```
|
||||
#[test]
|
||||
fn jrcxz_branches_only_on_a_zero_rcx_and_changes_nothing() {
|
||||
let code = [
|
||||
0xB8, 0x07, 0x00, 0x00, 0x00, 0xE3, 0x05, 0xB8, 0x01, 0x00, 0x00, 0x00, 0xF4,
|
||||
];
|
||||
let mut values = vec![0, 1, u64::MAX];
|
||||
values.extend((0..64).map(|bit| 1u64 << bit));
|
||||
for rcx in values {
|
||||
for flags in [RFlags::default(), all_flags()] {
|
||||
let mut cpu = CpuState::new(ENTRY, 0);
|
||||
cpu.gpr[RCX] = rcx;
|
||||
cpu.flags = flags;
|
||||
let mut wanted = cpu.clone();
|
||||
wanted.gpr[RAX] = if rcx == 0 { 7 } else { 1 };
|
||||
wanted.rip = ENTRY + code.len() as u64;
|
||||
for (engine, result) in both(&cpu, &code, 8) {
|
||||
assert_eq!(
|
||||
result.exit_reason,
|
||||
ExitReason::Halt,
|
||||
"rcx={rcx:#x} {engine}"
|
||||
);
|
||||
let executed = if rcx == 0 { 3 } else { 4 };
|
||||
assert_eq!(
|
||||
result.instructions_executed, executed,
|
||||
"rcx={rcx:#x} {engine}"
|
||||
);
|
||||
assert_eq!(result.final_state, wanted, "rcx={rcx:#x} {engine}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// LOOP from RCX = 0 wraps to 2^64 - 1 and branches. With a budget the loop
|
||||
/// stops early, and both engines agree on the whole state.
|
||||
#[test]
|
||||
fn loop_from_zero_wraps_and_keeps_every_flag() {
|
||||
let code = loop_program(Kind::Loop);
|
||||
for flags in [RFlags::default(), all_flags()] {
|
||||
let mut cpu = CpuState::new(ENTRY, 0);
|
||||
cpu.gpr[RDI] = 1;
|
||||
cpu.flags = flags;
|
||||
let [(_, interpreted), (_, translated)] = both(&cpu, &code, 4);
|
||||
assert_eq!(interpreted.exit_reason, ExitReason::StepLimitExceeded);
|
||||
assert_eq!(interpreted.final_state.gpr[RCX], u64::MAX);
|
||||
assert_eq!(interpreted.final_state.rip, ENTRY);
|
||||
// INC and CMP set the flags; LOOP leaves them as CMP left them.
|
||||
let after_cmp = model(Kind::Loop, 0, 0, 1, flags.zf, 2).zf;
|
||||
assert_eq!(interpreted.final_state.flags.zf, after_cmp);
|
||||
assert_eq!(interpreted.final_state, translated.final_state);
|
||||
assert_eq!(interpreted.exit_reason, translated.exit_reason);
|
||||
}
|
||||
}
|
||||
|
||||
fn all_flags() -> RFlags {
|
||||
RFlags {
|
||||
cf: true,
|
||||
zf: true,
|
||||
sf: true,
|
||||
of: true,
|
||||
pf: true,
|
||||
af: true,
|
||||
}
|
||||
}
|
||||
@@ -102,8 +102,8 @@ def cases():
|
||||
out += [f"{op} ah, bl", f"{op} cl, dh", f"{op} {mem(8)}, ch"]
|
||||
out += ["mov ah, bl", "mov dl, ch", "mov bh, 0x21", "xchg ah, bl", "mov sil, dil",
|
||||
"movabs r15, 0x8877665544332211", "mov rcx, -2", "bswap ebx", "bswap r9",
|
||||
"cbw", "cwde", "cdqe", "cwd", "cdq", "cqo", "clc", "stc", "cmc", "lahf", "sahf",
|
||||
"nop", "cpuid", "nop dword ptr [rax + 8]", "pause", "lfence", "mfence", "sfence", "fninit",
|
||||
"cbw", "cwde", "cdqe", "cwd", "cdq", "cqo", "clc", "stc", "cmc", "nop", "cpuid",
|
||||
"nop dword ptr [rax + 8]", "pause", "lfence", "mfence", "sfence", "fninit",
|
||||
f"movnti {mem(32)}, ebx", f"movnti {mem(64)}, rbx",
|
||||
f"movnti {mem(32)}, r9d", f"movnti {mem(64)}, r14", "push r9", "push rbx", "push -5", "push 0x12345678",
|
||||
f"push {mem(64)}", "pop rbx", "pop r12", f"pop {mem(64)}", "leave"]
|
||||
|
||||
@@ -1185,8 +1185,6 @@ b7 21 | mov bh, 0x21
|
||||
f8 | clc
|
||||
f9 | stc
|
||||
f5 | cmc
|
||||
9f | lahf
|
||||
9e | sahf
|
||||
90 | nop
|
||||
0f a2 | cpuid
|
||||
0f 1f 40 08 | nop dword ptr [rax + 8]
|
||||
|
||||
@@ -331,11 +331,6 @@ fn reference(m: &mut Machine, text: &str) -> Outcome {
|
||||
bits,
|
||||
high: false,
|
||||
};
|
||||
let ah = Place::Reg {
|
||||
index: RAX,
|
||||
bits: 8,
|
||||
high: true,
|
||||
};
|
||||
|
||||
if let Some(code) = name.strip_prefix("cmov") {
|
||||
let value = read(
|
||||
@@ -794,26 +789,6 @@ fn reference(m: &mut Machine, text: &str) -> Outcome {
|
||||
m.flags.cf = !m.flags.cf;
|
||||
Outcome::Done(none)
|
||||
}
|
||||
// AH bits 7 to 0 are SF, ZF, 0, AF, 0, PF, 1 and CF; OF has no bit.
|
||||
"lahf" => {
|
||||
let f = m.flags;
|
||||
let bits = [f.cf, true, f.pf, false, f.af, false, f.zf, f.sf];
|
||||
let value = (0..8)
|
||||
.filter(|&index| bits[index])
|
||||
.map(|index| 1u128 << index)
|
||||
.sum();
|
||||
write(m, ah, value);
|
||||
Outcome::Done(none)
|
||||
}
|
||||
"sahf" => {
|
||||
let value = read(m, ah, 8);
|
||||
m.flags.cf = bit(value, 0);
|
||||
m.flags.pf = bit(value, 2);
|
||||
m.flags.af = bit(value, 4);
|
||||
m.flags.zf = bit(value, 6);
|
||||
m.flags.sf = bit(value, 7);
|
||||
Outcome::Done(none)
|
||||
}
|
||||
// The fences order memory accesses and compute nothing.
|
||||
"nop" | "pause" | "lfence" | "mfence" | "sfence" => Outcome::Done(none),
|
||||
"fninit" => {
|
||||
@@ -825,15 +800,14 @@ fn reference(m: &mut Machine, text: &str) -> Outcome {
|
||||
}
|
||||
"cpuid" => {
|
||||
// Xenora's guest CPUID contract, restated: the vendor "Xenora guest"
|
||||
// and the five features whose every instruction exists, CMOV and
|
||||
// POPCNT in leaf 1, LAHF/SAHF, LZCNT and long mode in leaf
|
||||
// 0x8000_0001.
|
||||
// and the four features whose every instruction exists, CMOV and
|
||||
// POPCNT in leaf 1, LZCNT and long mode in leaf 0x8000_0001.
|
||||
let word = |text: &[u8; 4]| u32::from_le_bytes(*text);
|
||||
let values = match m.gpr[RAX] as u32 {
|
||||
0 => [1, word(b"Xeno"), word(b"uest"), word(b"ra g")],
|
||||
1 => [0, 0, 1 << 23, 1 << 15],
|
||||
0x8000_0000 => [0x8000_0001, 0, 0, 0],
|
||||
0x8000_0001 => [0, 0, 1 | 1 << 5, 1 << 29],
|
||||
0x8000_0001 => [0, 0, 1 << 5, 1 << 29],
|
||||
_ => [0; 4],
|
||||
};
|
||||
// EAX, EBX, ECX and EDX, each zero-extended.
|
||||
@@ -1093,10 +1067,6 @@ fn every_declared_form_is_executed_by_a_fixture() {
|
||||
let separate = [
|
||||
Op::Ldmxcsr,
|
||||
Op::Jcc,
|
||||
Op::Loop,
|
||||
Op::Loope,
|
||||
Op::Loopne,
|
||||
Op::Jrcxz,
|
||||
Op::Jmp,
|
||||
Op::Call,
|
||||
Op::Ret,
|
||||
|
||||
@@ -93,11 +93,6 @@ leave = { ref = "sdm LEAVE" }
|
||||
call = { terminator = true, ref = "sdm CALL" }
|
||||
jmp = { terminator = true, ref = "sdm JMP" }
|
||||
jcc = { reads = "cf zf sf of pf", terminator = true, ref = "sdm Jcc" }
|
||||
# The count is RCX: the address-size prefix that would select ECX is rejected.
|
||||
loopne = { reads = "zf", terminator = true, ref = "sdm LOOP/LOOPcc" }
|
||||
loope = { reads = "zf", terminator = true, ref = "sdm LOOP/LOOPcc" }
|
||||
loop = { terminator = true, ref = "sdm LOOP/LOOPcc" }
|
||||
jrcxz = { terminator = true, ref = "sdm Jcc" }
|
||||
ret = { terminator = true, ref = "sdm RET" }
|
||||
nop = { ref = "sdm NOP" }
|
||||
hlt = { terminator = true, ref = "sdm HLT" }
|
||||
@@ -105,10 +100,6 @@ syscall = { terminator = true, ref = "sdm SYSCALL" }
|
||||
clc = { writes = "cf", ref = "sdm CLC" }
|
||||
stc = { writes = "cf", ref = "sdm STC" }
|
||||
cmc = { reads = "cf", writes = "cf", ref = "sdm CMC" }
|
||||
# AH holds SF, ZF, AF, PF and CF; valid in 64-bit mode when CPUID
|
||||
# 8000_0001h ECX bit 0 is set.
|
||||
lahf = { reads = "cf zf sf pf af", ref = "sdm LAHF" }
|
||||
sahf = { writes = "cf zf sf pf af", ref = "sdm SAHF" }
|
||||
cpuid = { ref = "sdm CPUID" }
|
||||
cld = { ref = "sdm CLD" }
|
||||
std = { ref = "sdm STD" }
|
||||
@@ -525,18 +516,6 @@ opcode = 0x99
|
||||
enc = "none"
|
||||
size = "v"
|
||||
|
||||
[[form]]
|
||||
op = "sahf"
|
||||
opcode = 0x9E
|
||||
enc = "none"
|
||||
size = "n"
|
||||
|
||||
[[form]]
|
||||
op = "lahf"
|
||||
opcode = 0x9F
|
||||
enc = "none"
|
||||
size = "n"
|
||||
|
||||
[[form]]
|
||||
op = "mov"
|
||||
opcode = 0xB0
|
||||
@@ -588,34 +567,6 @@ opcode = 0xC9
|
||||
enc = "none"
|
||||
size = "q"
|
||||
|
||||
[[form]]
|
||||
op = "loopne"
|
||||
opcode = 0xE0
|
||||
enc = "rel"
|
||||
size = "n"
|
||||
imm = "rel8"
|
||||
|
||||
[[form]]
|
||||
op = "loope"
|
||||
opcode = 0xE1
|
||||
enc = "rel"
|
||||
size = "n"
|
||||
imm = "rel8"
|
||||
|
||||
[[form]]
|
||||
op = "loop"
|
||||
opcode = 0xE2
|
||||
enc = "rel"
|
||||
size = "n"
|
||||
imm = "rel8"
|
||||
|
||||
[[form]]
|
||||
op = "jrcxz"
|
||||
opcode = 0xE3
|
||||
enc = "rel"
|
||||
size = "n"
|
||||
imm = "rel8"
|
||||
|
||||
[[form]]
|
||||
op = "call"
|
||||
opcode = 0xE8
|
||||
|
||||
@@ -104,12 +104,12 @@ CPUID (`0F A2`) returns a fixed table that never reads the host. It describes a
|
||||
| 0 | 1, the highest basic leaf | `Xeno` | `uest` | `ra g` |
|
||||
| 1 | 0 | 0 | POPCNT (bit 23) | CMOV (bit 15) |
|
||||
| 0x8000_0000 | 0x8000_0001, the highest extended leaf | 0 | 0 | 0 |
|
||||
| 0x8000_0001 | 0 | 0 | LAHF/SAHF (bit 0), LZCNT (bit 5) | long mode (bit 29) |
|
||||
| 0x8000_0001 | 0 | 0 | LZCNT (bit 5) | long mode (bit 29) |
|
||||
| any other | 0 | 0 | 0 | 0 |
|
||||
|
||||
A feature bit is set only when every instruction of that feature is implemented. That is stricter than "some of it works", and it has consequences:
|
||||
|
||||
- SSE and SSE2 are not reported, although most of their instructions exist, because parts are still rejected: RSQRTPS and MASKMOVDQU, for example. BMI1 is not reported although TZCNT exists, because ANDN does not. The x87 FPU is not reported although FNINIT exists. MMX, FXSAVE, CMPXCHG8B, the time-stamp counter and SYSRET are absent too.
|
||||
- SSE and SSE2 are not reported, although most of their instructions exist, because parts are still rejected: RSQRTPS and MASKMOVDQU, for example. BMI1 is not reported although TZCNT exists, because ANDN does not. The x87 FPU is not reported although FNINIT exists. MMX, FXSAVE, CMPXCHG8B, the time-stamp counter, LAHF and SYSRET are absent too.
|
||||
- The table is therefore truthful about BetterXen, not plausible as hardware: every real 64-bit processor reports the FPU and SSE2. A guest that tests a bit before using a feature avoids it; a guest that assumes SSE2 because it runs in 64-bit mode still gets every form that exists and an illegal-instruction exit for one that does not.
|
||||
- A leaf that is not listed returns zeros, whatever the subleaf. Intel processors answer a leaf above the highest basic one with that leaf's data instead; software is expected to read the highest leaf first.
|
||||
|
||||
|
||||
Reference in new issue
Block a user