mirror of https://github.com/xemu-project/xemu.git
i386: hvf: Move mmio_buf into CPUX86State
There's no similar field in CPUX86State, but it's needed for MMIO traps. Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> Message-Id: <20200528193758.51454-13-r.bolshakov@yadro.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
577f02b890
commit
fe76b09c5b
|
@ -1603,6 +1603,7 @@ typedef struct CPUX86State {
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_HVF)
|
#if defined(CONFIG_HVF)
|
||||||
HVFX86LazyFlags hvf_lflags;
|
HVFX86LazyFlags hvf_lflags;
|
||||||
|
void *hvf_mmio_buf;
|
||||||
HVFX86EmulatorState *hvf_emul;
|
HVFX86EmulatorState *hvf_emul;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -533,7 +533,11 @@ void hvf_reset_vcpu(CPUState *cpu) {
|
||||||
|
|
||||||
void hvf_vcpu_destroy(CPUState *cpu)
|
void hvf_vcpu_destroy(CPUState *cpu)
|
||||||
{
|
{
|
||||||
|
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||||
|
CPUX86State *env = &x86_cpu->env;
|
||||||
|
|
||||||
hv_return_t ret = hv_vcpu_destroy((hv_vcpuid_t)cpu->hvf_fd);
|
hv_return_t ret = hv_vcpu_destroy((hv_vcpuid_t)cpu->hvf_fd);
|
||||||
|
g_free(env->hvf_mmio_buf);
|
||||||
assert_hvf_ok(ret);
|
assert_hvf_ok(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,6 +567,7 @@ int hvf_init_vcpu(CPUState *cpu)
|
||||||
init_decoder();
|
init_decoder();
|
||||||
|
|
||||||
hvf_state->hvf_caps = g_new0(struct hvf_vcpu_caps, 1);
|
hvf_state->hvf_caps = g_new0(struct hvf_vcpu_caps, 1);
|
||||||
|
env->hvf_mmio_buf = g_new(char, 4096);
|
||||||
env->hvf_emul = g_new0(HVFX86EmulatorState, 1);
|
env->hvf_emul = g_new0(HVFX86EmulatorState, 1);
|
||||||
|
|
||||||
r = hv_vcpu_create((hv_vcpuid_t *)&cpu->hvf_fd, HV_VCPU_DEFAULT);
|
r = hv_vcpu_create((hv_vcpuid_t *)&cpu->hvf_fd, HV_VCPU_DEFAULT);
|
||||||
|
|
|
@ -230,7 +230,6 @@ typedef struct x68_segment_selector {
|
||||||
|
|
||||||
/* Definition of hvf_x86_state is here */
|
/* Definition of hvf_x86_state is here */
|
||||||
struct HVFX86EmulatorState {
|
struct HVFX86EmulatorState {
|
||||||
uint8_t mmio_buf[4096];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* useful register access macros */
|
/* useful register access macros */
|
||||||
|
|
|
@ -187,8 +187,8 @@ void write_val_ext(struct CPUX86State *env, target_ulong ptr, target_ulong val,
|
||||||
|
|
||||||
uint8_t *read_mmio(struct CPUX86State *env, target_ulong ptr, int bytes)
|
uint8_t *read_mmio(struct CPUX86State *env, target_ulong ptr, int bytes)
|
||||||
{
|
{
|
||||||
vmx_read_mem(env_cpu(env), env->hvf_emul->mmio_buf, ptr, bytes);
|
vmx_read_mem(env_cpu(env), env->hvf_mmio_buf, ptr, bytes);
|
||||||
return env->hvf_emul->mmio_buf;
|
return env->hvf_mmio_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -489,9 +489,9 @@ static void exec_ins_single(struct CPUX86State *env, struct x86_decode *decode)
|
||||||
target_ulong addr = linear_addr_size(env_cpu(env), RDI(env),
|
target_ulong addr = linear_addr_size(env_cpu(env), RDI(env),
|
||||||
decode->addressing_size, R_ES);
|
decode->addressing_size, R_ES);
|
||||||
|
|
||||||
hvf_handle_io(env_cpu(env), DX(env), env->hvf_emul->mmio_buf, 0,
|
hvf_handle_io(env_cpu(env), DX(env), env->hvf_mmio_buf, 0,
|
||||||
decode->operand_size, 1);
|
decode->operand_size, 1);
|
||||||
vmx_write_mem(env_cpu(env), addr, env->hvf_emul->mmio_buf,
|
vmx_write_mem(env_cpu(env), addr, env->hvf_mmio_buf,
|
||||||
decode->operand_size);
|
decode->operand_size);
|
||||||
|
|
||||||
string_increment_reg(env, R_EDI, decode);
|
string_increment_reg(env, R_EDI, decode);
|
||||||
|
@ -512,9 +512,9 @@ static void exec_outs_single(struct CPUX86State *env, struct x86_decode *decode)
|
||||||
{
|
{
|
||||||
target_ulong addr = decode_linear_addr(env, decode, RSI(env), R_DS);
|
target_ulong addr = decode_linear_addr(env, decode, RSI(env), R_DS);
|
||||||
|
|
||||||
vmx_read_mem(env_cpu(env), env->hvf_emul->mmio_buf, addr,
|
vmx_read_mem(env_cpu(env), env->hvf_mmio_buf, addr,
|
||||||
decode->operand_size);
|
decode->operand_size);
|
||||||
hvf_handle_io(env_cpu(env), DX(env), env->hvf_emul->mmio_buf, 1,
|
hvf_handle_io(env_cpu(env), DX(env), env->hvf_mmio_buf, 1,
|
||||||
decode->operand_size, 1);
|
decode->operand_size, 1);
|
||||||
|
|
||||||
string_increment_reg(env, R_ESI, decode);
|
string_increment_reg(env, R_ESI, decode);
|
||||||
|
|
Loading…
Reference in New Issue