X86: Correct memory access for FPU and MXCSR stores (#3112)

Co-authored-by: Sree24-ui <[email protected]>
This commit is contained in:
Sree24-ui
2026-10-11 14:53:15 +00:00
committed by GitHub
co-authored by Sree24-ui
parent 7e5253aada
commit bfb3a50661
2 changed files with 256 additions and 14 deletions
+14 -14
View File
@@ -3935,7 +3935,7 @@
{ /* X86_FNSTCW16m, X86_INS_FNSTCW: fnstcw */
X86_FPU_FLAGS_UNDEFINED_C0 | X86_FPU_FLAGS_UNDEFINED_C1 | X86_FPU_FLAGS_UNDEFINED_C2 | X86_FPU_FLAGS_UNDEFINED_C3,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_FNSTSW16r, X86_INS_FNSTSW: fnstsw */
@@ -4570,17 +4570,17 @@
{ /* X86_ISTT_FP16m, X86_INS_FISTTP: fisttp */
X86_FPU_FLAGS_RESET_C1 | X86_FPU_FLAGS_UNDEFINED_C0 | X86_FPU_FLAGS_UNDEFINED_C2 | X86_FPU_FLAGS_UNDEFINED_C3,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_ISTT_FP32m, X86_INS_FISTTP: fisttp */
X86_FPU_FLAGS_RESET_C1 | X86_FPU_FLAGS_UNDEFINED_C0 | X86_FPU_FLAGS_UNDEFINED_C2 | X86_FPU_FLAGS_UNDEFINED_C3,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_ISTT_FP64m, X86_INS_FISTTP: fisttp */
X86_FPU_FLAGS_RESET_C1 | X86_FPU_FLAGS_UNDEFINED_C0 | X86_FPU_FLAGS_UNDEFINED_C2 | X86_FPU_FLAGS_UNDEFINED_C3,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_ISTT_Fp16m32, X86_INS_FISTTP: fisttp */
@@ -4630,22 +4630,22 @@
{ /* X86_IST_F16m, X86_INS_FIST: fist */
X86_FPU_FLAGS_RESET_C1 | X86_FPU_FLAGS_UNDEFINED_C0 | X86_FPU_FLAGS_UNDEFINED_C2 | X86_FPU_FLAGS_UNDEFINED_C3,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_IST_F32m, X86_INS_FIST: fist */
X86_FPU_FLAGS_RESET_C1 | X86_FPU_FLAGS_UNDEFINED_C0 | X86_FPU_FLAGS_UNDEFINED_C2 | X86_FPU_FLAGS_UNDEFINED_C3,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_IST_FP16m, X86_INS_FISTP: fistp */
X86_FPU_FLAGS_RESET_C1 | X86_FPU_FLAGS_UNDEFINED_C0 | X86_FPU_FLAGS_UNDEFINED_C2 | X86_FPU_FLAGS_UNDEFINED_C3,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_IST_FP32m, X86_INS_FISTP: fistp */
X86_FPU_FLAGS_RESET_C1 | X86_FPU_FLAGS_UNDEFINED_C0 | X86_FPU_FLAGS_UNDEFINED_C2 | X86_FPU_FLAGS_UNDEFINED_C3,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_IST_FP64m, X86_INS_FISTP: fistp */
@@ -12725,7 +12725,7 @@
{ /* X86_STMXCSR, X86_INS_STMXCSR: stmxcsr */
0,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_STOSB, X86_INS_STOSB: stosb */
@@ -12770,22 +12770,22 @@
{ /* X86_ST_F32m, X86_INS_FST: fst */
X86_FPU_FLAGS_MODIFY_C1 | X86_FPU_FLAGS_UNDEFINED_C0 | X86_FPU_FLAGS_UNDEFINED_C2 | X86_FPU_FLAGS_UNDEFINED_C3,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_ST_F64m, X86_INS_FST: fst */
X86_FPU_FLAGS_MODIFY_C1 | X86_FPU_FLAGS_UNDEFINED_C0 | X86_FPU_FLAGS_UNDEFINED_C2 | X86_FPU_FLAGS_UNDEFINED_C3,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_ST_FP32m, X86_INS_FSTP: fstp */
X86_FPU_FLAGS_MODIFY_C1 | X86_FPU_FLAGS_UNDEFINED_C0 | X86_FPU_FLAGS_UNDEFINED_C2 | X86_FPU_FLAGS_UNDEFINED_C3,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_ST_FP64m, X86_INS_FSTP: fstp */
X86_FPU_FLAGS_MODIFY_C1 | X86_FPU_FLAGS_UNDEFINED_C0 | X86_FPU_FLAGS_UNDEFINED_C2 | X86_FPU_FLAGS_UNDEFINED_C3,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_ST_FP80m, X86_INS_FSTP: fstp */
@@ -73620,7 +73620,7 @@
{ /* X86_VSTMXCSR, X86_INS_VSTMXCSR: vstmxcsr */
0,
{ CS_AC_READ, 0 }
{ CS_AC_WRITE, 0 }
},
{ /* X86_VSUBPDYrm, X86_INS_VSUBPD: vsubpd */
+242
View File
@@ -7552,3 +7552,245 @@ test_cases:
size: 4
access: CS_AC_READ
regs_read: [ ax, ebx ]
-
input:
bytes: [0xd9, 0x13, 0xdd, 0x13, 0xd9, 0x1b, 0xdd, 0x1b]
arch: "x86"
options: [ CS_OPT_DETAIL, CS_MODE_32 ]
address: 0x1000
expected:
insns:
-
asm_text: "fst dword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 4
access: CS_AC_WRITE
-
asm_text: "fst qword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 8
access: CS_AC_WRITE
-
asm_text: "fstp dword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 4
access: CS_AC_WRITE
-
asm_text: "fstp qword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 8
access: CS_AC_WRITE
-
input:
bytes: [0xdf, 0x13, 0xdb, 0x13, 0xdf, 0x1b, 0xdb, 0x1b, 0xdf, 0x0b, 0xdb, 0x0b, 0xdd, 0x0b]
arch: "x86"
options: [ CS_OPT_DETAIL, CS_MODE_32 ]
address: 0x1000
expected:
insns:
-
asm_text: "fist word ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 2
access: CS_AC_WRITE
-
asm_text: "fist dword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 4
access: CS_AC_WRITE
-
asm_text: "fistp word ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 2
access: CS_AC_WRITE
-
asm_text: "fistp dword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 4
access: CS_AC_WRITE
-
asm_text: "fisttp word ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 2
access: CS_AC_WRITE
-
asm_text: "fisttp dword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 4
access: CS_AC_WRITE
-
asm_text: "fisttp qword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 8
access: CS_AC_WRITE
-
input:
bytes: [0xd9, 0x3b, 0x0f, 0xae, 0x1b, 0xc5, 0xf8, 0xae, 0x1b]
arch: "x86"
options: [ CS_OPT_DETAIL, CS_MODE_32 ]
address: 0x1000
expected:
insns:
-
asm_text: "fnstcw word ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 2
access: CS_AC_WRITE
-
asm_text: "stmxcsr dword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 4
access: CS_AC_WRITE
-
asm_text: "vstmxcsr dword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 4
access: CS_AC_WRITE
-
input:
bytes: [0xdb, 0x3b, 0xdf, 0x3b, 0xdd, 0x3b, 0xd9, 0x03, 0xd9, 0x2b, 0x0f, 0xae, 0x13, 0xc5, 0xf8, 0xae, 0x13]
arch: "x86"
options: [ CS_OPT_DETAIL, CS_MODE_32 ]
address: 0x1000
expected:
insns:
-
asm_text: "fstp xword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 10
access: CS_AC_WRITE
-
asm_text: "fistp qword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 8
access: CS_AC_WRITE
-
asm_text: "fnstsw word ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 2
access: CS_AC_WRITE
-
asm_text: "fld dword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 4
access: CS_AC_READ
-
asm_text: "fldcw word ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 2
access: CS_AC_READ
-
asm_text: "ldmxcsr dword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 4
access: CS_AC_READ
-
asm_text: "vldmxcsr dword ptr [ebx]"
details:
x86:
operands:
-
type: X86_OP_MEM
mem_base: ebx
size: 4
access: CS_AC_READ