[DYNAREC] Fixed some oversized memory load (#3051)

* [DYNAREC] Fixed some oversized memory load

* review
This commit is contained in:
Yang Liu
2025-10-11 04:35:59 +08:00
committed by GitHub
parent 275c25a048
commit 56b4de3b84
7 changed files with 48 additions and 14 deletions

View File

@@ -462,7 +462,7 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
INST_NAME("CVTTPS2PI Gm,Ex");
nextop = F8;
GETGM(q0);
GETEX(v1, 0, 0);
GETEXSD(v1, 0, 0);
if (BOX64ENV(dynarec_fastround)) {
VFCVTZSS(q0, v1);
} else {
@@ -496,7 +496,7 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
INST_NAME("CVTPS2PI Gm, Ex");
nextop = F8;
GETGM(q0);
GETEX(v1, 0, 0);
GETEXSD(v1, 0, 0);
if (BOX64ENV(dynarec_fastround)) {
u8 = sse_setround(dyn, ninst, x1, x2, x3);
VFRINTIS(q0, v1);
@@ -1220,7 +1220,7 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
case 0x5A:
INST_NAME("CVTPS2PD Gx, Ex");
nextop = F8;
GETEX(q0, 0, 0);
GETEXSD(q0, 0, 0);
GETGX_empty(q1);
FCVTL(q1, q0);
break;

View File

@@ -1154,7 +1154,15 @@ uintptr_t dynarec64_660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n
INST_NAME("PINSRB Gx, ED, Ib");
nextop = F8;
GETGX(q0, 1);
GETED(1);
if (MODREG) {
ed = TO_NAT((nextop & 7) + (rex.b << 3));
wback = 0;
} else {
SMREAD();
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, &unscaled, 0xfff, 0, rex, NULL, 0, 1);
LDB(x1, wback, fixedaddress);
ed = x1;
}
u8 = F8;
VMOVQBfrom(q0, (u8&15), ed);
break;

View File

@@ -508,7 +508,12 @@ uintptr_t dynarec64_AVX_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int
case 0x5A:
INST_NAME("VCVTPS2PD Gx, Ex");
nextop = F8;
GETGX_empty_EX(v0, v1, 0);
if (vex.l) {
GETGX_empty_EX(v0, v1, 0);
} else {
GETEXSD(v1, 0, 0);
GETGX_empty(v0);
}
if(vex.l) {
GETGY_empty(q0, -1, -1, -1);
FCVTL2(q0, v1);

View File

@@ -596,11 +596,16 @@ uintptr_t dynarec64_AVX_F2_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip,
VMOVQ(v0, v1);
}
} else {
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
v1 = ymm_get_reg_empty(dyn, ninst, x1, gd, -1, -1, -1);
SMREAD();
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, NULL, 0x3f<<4, 15, rex, NULL, 1, 0);
VLDP128_I7(v0, v1, ed, fixedaddress);
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
if (vex.l) {
v1 = ymm_get_reg_empty(dyn, ninst, x1, gd, -1, -1, -1);
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, NULL, 0x3f << 4, 15, rex, NULL, 1, 0);
VLDP128_I7(v0, v1, ed, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, &unscaled, 0xfff << 4, 15, rex, NULL, 0, 0);
VLD128(v0, ed, fixedaddress);
}
}
if(!vex.l) YMM0(gd);
break;

View File

@@ -317,7 +317,7 @@ uintptr_t dynarec64_0F(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
INST_NAME("CVTTPS2PI Gm, Ex");
nextop = F8;
GETGM(v0);
GETEX(v1, 0, 0);
GETEXSD(v1, 0, 0);
if (BOX64ENV(dynarec_fastround)) {
VFTINTRZ_W_S(v0, v1);
} else {
@@ -344,7 +344,7 @@ uintptr_t dynarec64_0F(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
INST_NAME("CVTPS2PI Gm, Ex");
nextop = F8;
GETGM(v0);
GETEX(v1, 0, 0);
GETEXSD(v1, 0, 0);
u8 = sse_setround(dyn, ninst, x4, x6);
if (BOX64ENV(dynarec_fastround)) {
VFTINTRZ_W_S(v0, v1);
@@ -887,7 +887,7 @@ uintptr_t dynarec64_0F(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
case 0x5A:
INST_NAME("CVTPS2PD Gx, Ex");
nextop = F8;
GETEX(q0, 0, 0);
GETEXSD(q0, 0, 0);
GETGX(q1, 1);
VFCVTL_D_S(q1, q0);
break;

View File

@@ -1148,7 +1148,15 @@ uintptr_t dynarec64_660F(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int
INST_NAME("PINSRB Gx, ED, Ib");
nextop = F8;
GETGX(q0, 1);
GETED(1);
if (MODREG) {
ed = TO_NAT((nextop & 7) + (rex.b << 3));
wback = 0;
} else {
SMREAD();
addr = geted(dyn, addr, ninst, nextop, &wback, x2, x1, &fixedaddress, rex, NULL, 1, 1);
LD_B(x1, wback, fixedaddress);
ed = x1;
}
u8 = F8;
VINSGR2VR_B(q0, ed, (u8 & 0xf));
break;

View File

@@ -1096,7 +1096,15 @@ uintptr_t dynarec64_660F38(dynarec_rv64_t* dyn, uintptr_t addr, uint8_t opcode,
INST_NAME("PINSRB Gx, ED, Ib");
nextop = F8;
GETGX();
GETED(1);
if (MODREG) {
ed = TO_NAT((nextop & 7) + (rex.b << 3));
wback = 0;
} else {
SMREAD();
addr = geted(dyn, addr, ninst, nextop, &wback, x2, x1, &fixedaddress, rex, NULL, 1, 1);
LB(x1, wback, fixedaddress);
ed = x1;
}
u8 = F8;
SB(ed, gback, gdoffset + (u8 & 0xF));
break;