mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-22 07:50:59 +00:00
target/i386: set rip_offset for some SSE4.1 instructions
When emulating various SSE4.1 instructions such as pinsrd, the address of a memory operand is computed without allowing for the 8-bit immediate operand located after the memory operand, meaning that the memory operand uses the wrong address in the case where it is rip-relative. This patch adds the required rip_offset setting for those instructions, so fixing some GCC test failures (13 in the gcc testsuite in my GCC 6-based testing) when testing with a default CPU setting enabling those instructions. Backports commit ab6ab3e9972a49a359f59895a88bed311472ca97 from qemu
This commit is contained in:
parent
71bf994214
commit
e5b84c6d59
|
@ -76,14 +76,14 @@ out:
|
||||||
|
|
||||||
void *cpu_alloc_env(CPUState *cpu)
|
void *cpu_alloc_env(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
CPUClass *cc = CPU_GET_CLASS(cpu->uc, cpu);
|
||||||
|
|
||||||
return cc->alloc_env ? cc->alloc_env(cpu) : NULL;
|
return cc->alloc_env ? cc->alloc_env(cpu) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpu_get_env(CPUState *cpu, void *env)
|
void cpu_get_env(CPUState *cpu, void *env)
|
||||||
{
|
{
|
||||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
CPUClass *cc = CPU_GET_CLASS(cpu->uc, cpu);
|
||||||
|
|
||||||
if (cc->get_env) {
|
if (cc->get_env) {
|
||||||
cc->get_env(cpu, env);
|
cc->get_env(cpu, env);
|
||||||
|
@ -92,7 +92,7 @@ void cpu_get_env(CPUState *cpu, void *env)
|
||||||
|
|
||||||
void cpu_set_env(CPUState *cpu, void *env)
|
void cpu_set_env(CPUState *cpu, void *env)
|
||||||
{
|
{
|
||||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
CPUClass *cc = CPU_GET_CLASS(cpu->uc, cpu);
|
||||||
|
|
||||||
if (cc->set_env) {
|
if (cc->set_env) {
|
||||||
cc->set_env(cpu, env);
|
cc->set_env(cpu, env);
|
||||||
|
@ -101,7 +101,7 @@ void cpu_set_env(CPUState *cpu, void *env)
|
||||||
|
|
||||||
void cpu_free_env(CPUState *cpu, void *env)
|
void cpu_free_env(CPUState *cpu, void *env)
|
||||||
{
|
{
|
||||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
CPUClass *cc = CPU_GET_CLASS(cpu->uc, cpu);
|
||||||
|
|
||||||
if (cc->free_env) {
|
if (cc->free_env) {
|
||||||
cc->free_env(cpu, env);
|
cc->free_env(cpu, env);
|
||||||
|
|
|
@ -4646,6 +4646,7 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
|
||||||
if (sse_fn_eppi == SSE_SPECIAL) {
|
if (sse_fn_eppi == SSE_SPECIAL) {
|
||||||
ot = mo_64_32(s->dflag);
|
ot = mo_64_32(s->dflag);
|
||||||
rm = (modrm & 7) | REX_B(s);
|
rm = (modrm & 7) | REX_B(s);
|
||||||
|
s->rip_offset = 1;
|
||||||
if (mod != 3)
|
if (mod != 3)
|
||||||
gen_lea_modrm(env, s, modrm);
|
gen_lea_modrm(env, s, modrm);
|
||||||
reg = ((modrm >> 3) & 7) | rex_r;
|
reg = ((modrm >> 3) & 7) | rex_r;
|
||||||
|
|
Loading…
Reference in a new issue