mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-26 14:50:43 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a29bd9c37 |
No files matched your search
+1
-1
@@ -25,11 +25,11 @@ remains unsupported.
|
||||
- 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
|
||||
- Non-canonical 64-bit guest data addresses now raise `#GP` instead of a memory fault in both the interpreter and native DBT, including accesses that cross the canonical-address boundary. The synthetic architectural test is enabled again.
|
||||
- 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 a Python 3 fallback for `timeout` in `scripts/test-gpu.sh`, so the native Metal suite runs on stock macOS without GNU coreutils while preserving bounded execution and the usual timeout exit status.
|
||||
|
||||
### Added
|
||||
- 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.
|
||||
- `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).
|
||||
|
||||
@@ -167,7 +167,7 @@ pub enum ExitReason {
|
||||
StackUnderflow,
|
||||
/// Division by zero or a quotient too large for its destination (#DE).
|
||||
DivideError,
|
||||
/// A misaligned 16-byte operand or a reserved MXCSR bit (#GP).
|
||||
/// A non-canonical data address, misaligned 16-byte operand or reserved MXCSR bit (#GP).
|
||||
GeneralProtection,
|
||||
/// An unmasked SSE floating-point exception (#XM); MXCSR holds its flags.
|
||||
SimdException,
|
||||
|
||||
@@ -1234,11 +1234,22 @@ struct BlockContext {
|
||||
const BLOCK_CTX_FAULTED_OFFSET: u32 = 8;
|
||||
const _: () = assert!(std::mem::offset_of!(BlockContext, faulted) == 8);
|
||||
|
||||
fn check_guest_address(ctx: *mut BlockContext, address: u64, size: u8) -> bool {
|
||||
if x86_exec::canonical_access(address, size) {
|
||||
return true;
|
||||
}
|
||||
fault(ctx, ExitReason::GeneralProtection);
|
||||
false
|
||||
}
|
||||
|
||||
extern "C" fn write_u64_helper(ctx: *mut BlockContext, addr: u64, val: u64) {
|
||||
unsafe {
|
||||
if (*ctx).exit_reason.is_some() {
|
||||
return;
|
||||
}
|
||||
if !check_guest_address(ctx, addr, 8) {
|
||||
return;
|
||||
}
|
||||
let mem = &mut *(*ctx).memory_ptr;
|
||||
if let Err(e) = mem.write_u64(addr, val) {
|
||||
(*ctx).faulted = 1;
|
||||
@@ -1252,6 +1263,9 @@ extern "C" fn read_u64_helper(ctx: *mut BlockContext, addr: u64) -> u64 {
|
||||
if (*ctx).exit_reason.is_some() {
|
||||
return 0;
|
||||
}
|
||||
if !check_guest_address(ctx, addr, 8) {
|
||||
return 0;
|
||||
}
|
||||
let mem = &*(*ctx).memory_ptr;
|
||||
match mem.read_u64(addr) {
|
||||
Ok(v) => v,
|
||||
@@ -1295,6 +1309,9 @@ fn fault(ctx: *mut BlockContext, reason: ExitReason) {
|
||||
|
||||
/// Read 16 bytes at any alignment; returned in X0 (low) and X1 (high).
|
||||
extern "C" fn read_u128_helper(ctx: *mut BlockContext, addr: u64) -> u128 {
|
||||
if !check_guest_address(ctx, addr, 16) {
|
||||
return 0;
|
||||
}
|
||||
let memory = unsafe { &*(*ctx).memory_ptr };
|
||||
let mut bytes = [0; 16];
|
||||
if let Err(error) = memory.read_bytes(addr, &mut bytes) {
|
||||
@@ -1313,6 +1330,9 @@ extern "C" fn read_aligned_u128_helper(ctx: *mut BlockContext, addr: u64) -> u12
|
||||
|
||||
/// Write 16 bytes at any alignment; `value` arrives in X2 (low) and X3 (high).
|
||||
extern "C" fn write_u128_helper(ctx: *mut BlockContext, addr: u64, value: u128) {
|
||||
if !check_guest_address(ctx, addr, 16) {
|
||||
return;
|
||||
}
|
||||
let memory = unsafe { &mut *(*ctx).memory_ptr };
|
||||
if let Err(error) = memory.write_bytes(addr, &value.to_le_bytes()) {
|
||||
fault(ctx, ExitReason::MemoryFault(error));
|
||||
@@ -1360,6 +1380,9 @@ extern "C" fn write_u16_helper(ctx: *mut BlockContext, addr: u64, val: u64) {
|
||||
if (*ctx).exit_reason.is_some() {
|
||||
return;
|
||||
}
|
||||
if !check_guest_address(ctx, addr, 2) {
|
||||
return;
|
||||
}
|
||||
let mem = &mut *(*ctx).memory_ptr;
|
||||
if let Err(e) = mem.write_u16(addr, val as u16) {
|
||||
(*ctx).faulted = 1;
|
||||
@@ -1373,6 +1396,9 @@ extern "C" fn write_u32_helper(ctx: *mut BlockContext, addr: u64, val: u64) {
|
||||
if (*ctx).exit_reason.is_some() {
|
||||
return;
|
||||
}
|
||||
if !check_guest_address(ctx, addr, 4) {
|
||||
return;
|
||||
}
|
||||
let mem = &mut *(*ctx).memory_ptr;
|
||||
if let Err(e) = mem.write_u32(addr, val as u32) {
|
||||
(*ctx).faulted = 1;
|
||||
@@ -1386,6 +1412,9 @@ extern "C" fn read_u32_helper(ctx: *mut BlockContext, addr: u64) -> u64 {
|
||||
if (*ctx).exit_reason.is_some() {
|
||||
return 0;
|
||||
}
|
||||
if !check_guest_address(ctx, addr, 4) {
|
||||
return 0;
|
||||
}
|
||||
let mem = &*(*ctx).memory_ptr;
|
||||
match mem.read_u32(addr) {
|
||||
Ok(v) => u64::from(v),
|
||||
@@ -1403,6 +1432,9 @@ extern "C" fn write_u8_helper(ctx: *mut BlockContext, addr: u64, val: u64) {
|
||||
if (*ctx).exit_reason.is_some() {
|
||||
return;
|
||||
}
|
||||
if !check_guest_address(ctx, addr, 1) {
|
||||
return;
|
||||
}
|
||||
let mem = &mut *(*ctx).memory_ptr;
|
||||
if let Err(e) = mem.write_u8(addr, val as u8) {
|
||||
(*ctx).faulted = 1;
|
||||
@@ -1416,6 +1448,9 @@ extern "C" fn read_u8_helper(ctx: *mut BlockContext, addr: u64) -> u64 {
|
||||
if (*ctx).exit_reason.is_some() {
|
||||
return 0;
|
||||
}
|
||||
if !check_guest_address(ctx, addr, 1) {
|
||||
return 0;
|
||||
}
|
||||
let mem = &*(*ctx).memory_ptr;
|
||||
match mem.read_u8(addr) {
|
||||
Ok(v) => v as u64,
|
||||
@@ -1433,6 +1468,9 @@ extern "C" fn read_u16_helper(ctx: *mut BlockContext, addr: u64) -> u64 {
|
||||
if (*ctx).exit_reason.is_some() {
|
||||
return 0;
|
||||
}
|
||||
if !check_guest_address(ctx, addr, 2) {
|
||||
return 0;
|
||||
}
|
||||
let mem = &*(*ctx).memory_ptr;
|
||||
match mem.read_u16(addr) {
|
||||
Ok(v) => v as u64,
|
||||
|
||||
@@ -49,6 +49,26 @@ pub fn address(cpu: &CpuState, operand: &MemOperand) -> u64 {
|
||||
base.wrapping_add(offset(cpu, operand))
|
||||
}
|
||||
|
||||
/// Whether a 64-bit guest address is canonical under the x86-64 48-bit
|
||||
/// virtual-address rule (Intel SDM Vol. 1, section 3.3.7.1).
|
||||
pub(crate) fn is_canonical(address: u64) -> bool {
|
||||
matches!(address >> 47, 0 | 0x1_ffff)
|
||||
}
|
||||
|
||||
/// Whether every byte of a data access has a canonical address. An overflowing
|
||||
/// range is left to [`GuestMemory`] so it keeps its existing overflow fault.
|
||||
pub(crate) fn canonical_access(address: u64, size: u8) -> bool {
|
||||
if !is_canonical(address) {
|
||||
return false;
|
||||
}
|
||||
if size <= 1 {
|
||||
return true;
|
||||
}
|
||||
address
|
||||
.checked_add(u64::from(size) - 1)
|
||||
.is_none_or(is_canonical)
|
||||
}
|
||||
|
||||
/// Effective address without a segment base, as LEA computes it.
|
||||
fn offset(cpu: &CpuState, operand: &MemOperand) -> u64 {
|
||||
let base = operand.base.map_or(0, |index| cpu.gpr[usize::from(index)]);
|
||||
@@ -78,6 +98,9 @@ pub(crate) fn write_reg(cpu: &mut CpuState, reg: RegOperand, size: u8, value: u6
|
||||
}
|
||||
|
||||
pub(crate) fn read_mem(memory: &GuestMemory, address: u64, size: u8) -> Result<u64, ExitReason> {
|
||||
if !canonical_access(address, size) {
|
||||
return Err(ExitReason::GeneralProtection);
|
||||
}
|
||||
match size {
|
||||
1 => memory.read_u8(address).map(u64::from),
|
||||
2 => memory.read_u16(address).map(u64::from),
|
||||
@@ -93,6 +116,9 @@ pub(crate) fn write_mem(
|
||||
size: u8,
|
||||
value: u64,
|
||||
) -> Result<(), ExitReason> {
|
||||
if !canonical_access(address, size) {
|
||||
return Err(ExitReason::GeneralProtection);
|
||||
}
|
||||
match size {
|
||||
1 => memory.write_u8(address, value as u8),
|
||||
2 => memory.write_u16(address, value as u16),
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
use crate::cpu::{CpuState, ExitReason, Mxcsr};
|
||||
use crate::memory::GuestMemory;
|
||||
use crate::x86_decode::{Encoding, Insn, RegOperand, RmOperand};
|
||||
use crate::x86_exec::{address, read_mem, read_reg, rm_operand, write_mem, write_reg};
|
||||
use crate::x86_exec::{
|
||||
address, canonical_access, read_mem, read_reg, rm_operand, write_mem, write_reg,
|
||||
};
|
||||
use crate::x86_float;
|
||||
use crate::x86_table::{FORMS, Op};
|
||||
|
||||
@@ -216,6 +218,9 @@ fn read_vector(memory: &GuestMemory, address: u64, size: u8) -> Result<u128, Exi
|
||||
if size < 16 {
|
||||
return read_mem(memory, address, size).map(u128::from);
|
||||
}
|
||||
if !canonical_access(address, size) {
|
||||
return Err(ExitReason::GeneralProtection);
|
||||
}
|
||||
let mut bytes = [0; 16];
|
||||
memory
|
||||
.read_bytes(address, &mut bytes)
|
||||
@@ -232,6 +237,9 @@ fn write_vector(
|
||||
if size < 16 {
|
||||
return write_mem(memory, address, size, value as u64);
|
||||
}
|
||||
if !canonical_access(address, size) {
|
||||
return Err(ExitReason::GeneralProtection);
|
||||
}
|
||||
memory
|
||||
.write_bytes(address, &value.to_le_bytes())
|
||||
.map_err(ExitReason::MemoryFault)
|
||||
|
||||
@@ -1294,147 +1294,6 @@ gs_xadd_without_lock: rbx=8 rcx=5 gs8=03000000 => rcx=3 gs8=08000000 f=cpazso
|
||||
fs_rep_movsb_overrides_source_only_df_clear: rsi=8 rdi=D rcx=2 fs8=a1a2 m0=0000 => rsi=a rdi=D+2 rcx=0 m0=a1a2 f=*
|
||||
";
|
||||
|
||||
/// MOV r/m, imm (opcodes C6 /0 and C7 /0), issue #194.
|
||||
///
|
||||
/// Memory-form encodings came from Apple clang's assembler. The register forms
|
||||
/// of C6/C7 are the long alternatives to B0+r and B8+r, which that assembler
|
||||
/// never emits, so they were written by hand from the opcode map (ModRM
|
||||
/// `11 000 rm`). Expected values follow SDM 2B MOV, where the imm32 of the
|
||||
/// 64-bit form is sign-extended, and were computed by hand before the first run,
|
||||
/// without reading how the interpreter or the DBT execute C6 and C7. The author is
|
||||
/// an AI model, as for the rest of this file. Both engines already agreed with
|
||||
/// every case, so this group closes a coverage gap and fixes no defect.
|
||||
const IMMEDIATE_STORES: &str = r"
|
||||
@ mov byte ptr [rdi], 0x80
|
||||
c60780
|
||||
SDM 2B MOV (C6 /0)
|
||||
store_byte_base: rdi=D m0=aaaaaaaa => m0=80aaaaaa f=*
|
||||
@ mov word ptr [rdi], 0x8001
|
||||
66c7070180
|
||||
SDM 2B MOV (C7 /0, 66 prefix)
|
||||
store_word_base: rdi=D m0=aaaaaaaa => m0=0180aaaa f=*
|
||||
@ mov dword ptr [rdi], 0x80000001
|
||||
c70701000080
|
||||
SDM 2B MOV (C7 /0)
|
||||
store_dword_base_is_not_sign_extended: rdi=D m0=aaaaaaaaaaaaaaaa => m0=01000080aaaaaaaa f=*
|
||||
@ mov qword ptr [rdi], -0x7fffffff
|
||||
48c70701000080
|
||||
SDM 2B MOV (REX.W C7 /0, imm32 sign-extended to 64 bits)
|
||||
store_qword_negative_immediate_sign_extends: rdi=D m0=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa => m0=01000080ffffffffaaaaaaaaaaaaaaaa f=*
|
||||
@ mov qword ptr [rdi], 1
|
||||
48c70701000000
|
||||
SDM 2B MOV (REX.W C7 /0)
|
||||
store_qword_positive_immediate_clears_upper_half: rdi=D m0=ffffffffffffffffaaaaaaaaaaaaaaaa => m0=0100000000000000aaaaaaaaaaaaaaaa f=*
|
||||
@ mov qword ptr [rdi+rcx*8+0x10], -2
|
||||
48c744cf10feffffff
|
||||
SDM 2B MOV; 2A 2.1.5 (SIB, disp8)
|
||||
store_qword_sib_scale_8_disp8: rdi=D rcx=2 m20=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa => m20=feffffffffffffffaaaaaaaaaaaaaaaa f=*
|
||||
@ mov dword ptr [rdi+0x7f], 0x11223344
|
||||
c7477f44332211
|
||||
SDM 2B MOV; 2A 2.1.5 (disp8, largest positive)
|
||||
store_dword_disp8_positive_limit: rdi=D m7e=aaaaaaaaaaaaaaaaaaaa => m7e=aa44332211aaaaaaaaaa f=*
|
||||
@ mov dword ptr [rdi-0x80], 0x11223344
|
||||
c7478044332211
|
||||
SDM 2B MOV; 2A 2.1.5 (disp8 is sign-extended)
|
||||
store_dword_disp8_negative_limit: rdi=D+80 m0=aaaaaaaaaaaaaaaa => m0=44332211aaaaaaaa f=*
|
||||
@ mov dword ptr [rdi+0x100], 0x11223344
|
||||
c7870001000044332211
|
||||
SDM 2B MOV; 2A 2.1.5 (disp32)
|
||||
store_dword_disp32: rdi=D m100=aaaaaaaaaaaaaaaa => m100=44332211aaaaaaaa f=*
|
||||
@ mov byte ptr [r9+r10*2+1], 7
|
||||
43c644510107
|
||||
SDM 2B MOV; 2A 2.1.5 (REX.X and REX.B)
|
||||
store_byte_rex_base_and_index: r9=D+10 r10=8 m20=aaaaaaaa => m20=aa07aaaa f=*
|
||||
@ mov qword ptr [r12], 5
|
||||
49c7042405000000
|
||||
SDM 2B MOV; 2A 2.1.5 (R12 needs a SIB byte)
|
||||
store_qword_r12_base: r12=D+30 m30=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa => m30=0500000000000000aaaaaaaaaaaaaaaa f=*
|
||||
@ mov qword ptr [r13], 5
|
||||
49c7450005000000
|
||||
SDM 2B MOV; 2A 2.1.5 (R13 with mod 00 would be RIP-relative, so disp8 0)
|
||||
store_qword_r13_base: r13=D+40 m40=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa => m40=0500000000000000aaaaaaaaaaaaaaaa f=*
|
||||
@ mov word ptr [rsp+8], 0x1234
|
||||
66c74424083412
|
||||
SDM 2B MOV; 2A 2.1.5 (RSP needs a SIB byte)
|
||||
store_word_rsp_base: rsp=D+58 m60=aaaaaaaa => m60=3412aaaa f=*
|
||||
@ mov byte ptr [rbp+2], 0x7f
|
||||
c645027f
|
||||
SDM 2B MOV
|
||||
store_byte_rbp_disp8: rbp=D+70 m72=aaaa => m72=7faa f=*
|
||||
@ mov byte ptr [rdi+rcx], -1
|
||||
c6040fff
|
||||
SDM 2B MOV
|
||||
store_byte_base_plus_index: rdi=D+80 rcx=5 m84=aaaaaaaa => m84=aaffaaaa f=*
|
||||
@ mov word ptr [r8+r9*4+0x20], 0x7ffe
|
||||
6643c7448820fe7f
|
||||
SDM 2B MOV; 2A 2.1.5
|
||||
store_word_r8_r9_scaled: r8=D r9=10 m60=aaaaaaaa => m60=fe7faaaa f=*
|
||||
@ mov eax, 0x80000001
|
||||
c7c001000080
|
||||
SDM 2B MOV (C7 /0, register form); 1 3.4.1.1
|
||||
register_dword_zero_extends: rax=ffffffffffffffff => rax=0000000080000001 f=*
|
||||
@ mov ax, 0x8001
|
||||
66c7c00180
|
||||
SDM 2B MOV; 1 3.4.1.1
|
||||
register_word_keeps_upper_bits: rax=1122334455667788 => rax=1122334455668001 f=*
|
||||
@ mov rax, -2
|
||||
48c7c0feffffff
|
||||
SDM 2B MOV (REX.W C7 /0, register form)
|
||||
register_qword_sign_extends: rax=0 => rax=fffffffffffffffe f=*
|
||||
@ mov r10, 0x7fffffff
|
||||
49c7c2ffffff7f
|
||||
SDM 2B MOV
|
||||
register_qword_rex_b_positive: r10=ffffffffffffffff => r10=000000007fffffff f=*
|
||||
@ mov r8d, -1
|
||||
41c7c0ffffffff
|
||||
SDM 2B MOV; 1 3.4.1.1
|
||||
register_dword_rex_b_zero_extends: r8=1122334455667788 => r8=00000000ffffffff f=*
|
||||
@ mov al, 0x80
|
||||
c6c080
|
||||
SDM 2B MOV (C6 /0, register form)
|
||||
register_byte_al: rax=1122334455667788 => rax=1122334455667780 f=*
|
||||
@ mov ah, 5
|
||||
c6c405
|
||||
SDM 2B MOV; 1 3.4.1.1 (no REX: ModRM 4 is AH)
|
||||
register_byte_ah: rax=1122334455667788 => rax=1122334455660588 f=*
|
||||
@ mov sil, 3
|
||||
40c6c603
|
||||
SDM 2B MOV; 1 3.4.1.1 (a REX prefix makes ModRM 6 SIL)
|
||||
register_byte_sil: rsi=1122334455667788 => rsi=1122334455667703 f=*
|
||||
@ mov r9b, 4
|
||||
41c6c104
|
||||
SDM 2B MOV
|
||||
register_byte_r9b: r9=1122334455667788 => r9=1122334455667704 f=*
|
||||
@ mov byte ptr [rdi], 0x80
|
||||
!c60780
|
||||
SDM 3A 7.15 Interrupt 14
|
||||
store_byte_unmapped: rdi=U => ! PFW U
|
||||
store_byte_readonly: rdi=R+8 => ! PFW R+8
|
||||
@ mov word ptr [rdi], 0x8001
|
||||
!66c7070180
|
||||
SDM 3A 7.15 Interrupt 14
|
||||
store_word_unmapped: rdi=U => ! PFW U
|
||||
store_word_readonly: rdi=R+8 => ! PFW R+8
|
||||
@ mov dword ptr [rdi], 0x80000001
|
||||
!c70701000080
|
||||
SDM 3A 7.15 Interrupt 14
|
||||
store_dword_unmapped: rdi=U => ! PFW U
|
||||
store_dword_readonly: rdi=R+8 => ! PFW R+8
|
||||
@ mov qword ptr [rdi], -0x7fffffff
|
||||
!48c70701000080
|
||||
SDM 3A 7.15 Interrupt 14
|
||||
store_qword_unmapped: rdi=U => ! PFW U
|
||||
store_qword_readonly: rdi=R+8 => ! PFW R+8
|
||||
@ C6 with ModRM reg field 1 (no such instruction)
|
||||
!c60f01
|
||||
SDM 2B MOV (C6 is defined only as /0); 3A 7.15 Interrupt 6
|
||||
c6_reg_field_1_is_ud: rdi=D m0=aaaaaaaa => ! UD
|
||||
@ C7 with ModRM reg field 1 (no such instruction)
|
||||
!c70f01000000
|
||||
SDM 2B MOV (C7 is defined only as /0); 3A 7.15 Interrupt 6
|
||||
c7_reg_field_1_is_ud: rdi=D m0=aaaaaaaa => ! UD
|
||||
";
|
||||
|
||||
const DECODING: &str = r"
|
||||
@ mov eax, [ebx]
|
||||
678b03
|
||||
@@ -1688,15 +1547,75 @@ store8_crossing_into_unmapped_page_writes_nothing: rdi=U rax=1122334455667788 =>
|
||||
movups_load_crossing_into_unmapped: rsi=U => ! PFR U
|
||||
";
|
||||
|
||||
const DEFECT_NONCANONICAL_ADDRESS: &str = r"
|
||||
const NONCANONICAL_ADDRESS: &str = r"
|
||||
@ movzx eax, byte ptr [rsi]
|
||||
!0fb606
|
||||
SDM 1 3.3.7.1; 2A MOVZX
|
||||
noncanonical_byte_load_faults: rsi=0000800000000000 => ! GP
|
||||
@ mov ax, [rsi]
|
||||
!668b06
|
||||
SDM 1 3.3.7.1; 2A MOV
|
||||
noncanonical_word_load_faults: rsi=0000800000000000 => ! GP
|
||||
@ mov eax, [rsi]
|
||||
!8b06
|
||||
SDM 1 3.3.7.1; 2A MOV
|
||||
noncanonical_dword_load_faults: rsi=0000800000000000 => ! GP
|
||||
@ mov rax, [rsi]
|
||||
!488b06
|
||||
SDM 1 3.3.7.1; 3A 7.15 Interrupt 13
|
||||
noncanonical_load_faults: rsi=100000000000000 => ! GP
|
||||
@ mov [rdi], rax
|
||||
SDM 1 3.3.7.1; 2A MOV
|
||||
noncanonical_qword_load_faults: rsi=0000800000000000 => ! GP
|
||||
@ mov byte ptr [rdi], al
|
||||
!8807
|
||||
SDM 1 3.3.7.1; 2A MOV
|
||||
noncanonical_byte_store_faults: rdi=ffff7fffffffffff => ! GP
|
||||
@ mov word ptr [rdi], ax
|
||||
!668907
|
||||
SDM 1 3.3.7.1; 2A MOV
|
||||
noncanonical_word_store_faults: rdi=ffff7fffffffffff => ! GP
|
||||
@ mov dword ptr [rdi], eax
|
||||
!8907
|
||||
SDM 1 3.3.7.1; 2A MOV
|
||||
noncanonical_dword_store_faults: rdi=ffff7fffffffffff => ! GP
|
||||
@ mov qword ptr [rdi], rax
|
||||
!488907
|
||||
SDM 1 3.3.7.1; 3A 7.15 Interrupt 13
|
||||
noncanonical_store_faults: rdi=7fffffffffffffff => ! GP
|
||||
SDM 1 3.3.7.1; 2A MOV
|
||||
noncanonical_qword_store_faults: rdi=ffff7fffffffffff => ! GP
|
||||
@ mov rax, [rsi]
|
||||
!488b06
|
||||
SDM 1 3.3.7.1; 2A MOV
|
||||
qword_crossing_into_lower_hole_faults: rsi=00007fffffffffff => ! GP
|
||||
qword_ending_at_last_lower_canonical_byte_is_unmapped: rsi=00007ffffffffff8 => ! PFR 00007ffffffffff8
|
||||
@ movzx eax, byte ptr [rsi]
|
||||
!0fb606
|
||||
SDM 1 3.3.7.1; 2A MOVZX
|
||||
last_lower_canonical_byte_is_unmapped: rsi=00007fffffffffff => ! PFR 00007fffffffffff
|
||||
first_upper_canonical_byte_is_unmapped: rsi=ffff800000000000 => ! PFR ffff800000000000
|
||||
@ movups xmm0, [rsi]
|
||||
!0f1006
|
||||
SDM 1 3.3.7.1; 2B MOVUPS
|
||||
noncanonical_vector_load_faults: rsi=0000800000000000 => ! GP
|
||||
vector_crossing_into_lower_hole_faults: rsi=00007fffffffffff => ! GP
|
||||
vector_ending_at_last_lower_canonical_byte_is_unmapped: rsi=00007ffffffffff0 => ! PFR 00007ffffffffff0
|
||||
@ movups [rdi], xmm0
|
||||
!0f1107
|
||||
SDM 1 3.3.7.1; 2B MOVUPS
|
||||
noncanonical_vector_store_faults: rdi=ffff7fffffffffff => ! GP
|
||||
vector_store_at_first_upper_canonical_byte_is_unmapped: rdi=ffff800000000000 => ! PFR ffff800000000000
|
||||
@ movdqu xmm0, [rsi]
|
||||
!f30f6f06
|
||||
SDM 1 3.3.7.1; 2B MOVDQU
|
||||
movdqu_crossing_into_lower_hole_faults: rsi=00007fffffffffff => ! GP
|
||||
movdqu_at_first_upper_canonical_byte_is_unmapped: rsi=ffff800000000000 => ! PFR ffff800000000000
|
||||
@ movdqu [rdi], xmm0
|
||||
!f30f7f07
|
||||
SDM 1 3.3.7.1; 2B MOVDQU
|
||||
movdqu_store_crossing_into_lower_hole_faults: rdi=00007fffffffffff => ! GP
|
||||
@ mov rax, gs:[rsi]
|
||||
!65488b06
|
||||
SDM 1 3.3.7.1, 3A 4.2; 2A MOV
|
||||
wrapped_segment_address_is_checked: gsbase=0000800000000000 rsi=ffffffffffffffff => ! GP
|
||||
noncanonical_segment_base_faults: gsbase=0000800000000000 rsi=0 => ! GP
|
||||
canonical_upper_segment_base_is_unmapped: gsbase=ffff800000000000 rsi=0 => ! PFR ffff800000000000
|
||||
";
|
||||
|
||||
const PACKED_INTEGER_SSE2: &str = r"
|
||||
@@ -2817,7 +2736,7 @@ const GROUPS: &[(&str, &str)] = &[
|
||||
("fences", FENCES),
|
||||
("memory_faults", MEMORY_FAULTS),
|
||||
("straddling_fault_address", STRADDLING_FAULT_ADDRESS),
|
||||
("defect_noncanonical_address", DEFECT_NONCANONICAL_ADDRESS),
|
||||
("noncanonical_address", NONCANONICAL_ADDRESS),
|
||||
("packed_integer_sse2", PACKED_INTEGER_SSE2),
|
||||
("packed_integer_beyond_sse2", PACKED_INTEGER_BEYOND_SSE2),
|
||||
("fp_rounding", FP_ROUNDING),
|
||||
@@ -3548,11 +3467,6 @@ fn exchange() {
|
||||
check_group(EXCHANGE);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn immediate_stores() {
|
||||
check_group(IMMEDIATE_STORES);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flag_moves() {
|
||||
check_group(FLAG_MOVES);
|
||||
@@ -3614,9 +3528,8 @@ fn straddling_fault_address() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "known defect (#155): a non-canonical address is a memory fault, not #GP"]
|
||||
fn defect_noncanonical_address() {
|
||||
check_group(DEFECT_NONCANONICAL_ADDRESS);
|
||||
fn noncanonical_address() {
|
||||
check_group(NONCANONICAL_ADDRESS);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user