target/i386: gdbstub: only write CR0/CR2/CR3/EFER for sysemu

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210322132800.7470-21-cfontana@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Claudio Fontana 2021-03-22 14:27:56 +01:00 committed by Paolo Bonzini
parent 4d81e28514
commit 1852f0942c

View File

@ -351,22 +351,30 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
case IDX_CTL_CR0_REG: case IDX_CTL_CR0_REG:
len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp); len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp);
#ifndef CONFIG_USER_ONLY
cpu_x86_update_cr0(env, tmp); cpu_x86_update_cr0(env, tmp);
#endif
return len; return len;
case IDX_CTL_CR2_REG: case IDX_CTL_CR2_REG:
len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp); len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp);
#ifndef CONFIG_USER_ONLY
env->cr[2] = tmp; env->cr[2] = tmp;
#endif
return len; return len;
case IDX_CTL_CR3_REG: case IDX_CTL_CR3_REG:
len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp); len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp);
#ifndef CONFIG_USER_ONLY
cpu_x86_update_cr3(env, tmp); cpu_x86_update_cr3(env, tmp);
#endif
return len; return len;
case IDX_CTL_CR4_REG: case IDX_CTL_CR4_REG:
len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp); len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp);
#ifndef CONFIG_USER_ONLY
cpu_x86_update_cr4(env, tmp); cpu_x86_update_cr4(env, tmp);
#endif
return len; return len;
case IDX_CTL_CR8_REG: case IDX_CTL_CR8_REG:
@ -378,7 +386,9 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
case IDX_CTL_EFER_REG: case IDX_CTL_EFER_REG:
len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp); len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp);
#ifndef CONFIG_USER_ONLY
cpu_load_efer(env, tmp); cpu_load_efer(env, tmp);
#endif
return len; return len;
} }
} }