mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-11 04:26:23 +00:00
target-i386: Use correct memory attributes for ioport accesses
In order to do this, stop using the cpu_in*/out* helpers, and instead access address_space_io directly. cpu_in* and cpu_out* remain for usage in the monitor, in qtest, and in Xen. Backports commit 3f7d84648607cc0fcb3812bb4b88978e2a7aa24f from qemu
This commit is contained in:
parent
25a58231fc
commit
e57e92feca
|
@ -88,12 +88,12 @@ DEF_HELPER_1(wrmsr, void, env)
|
|||
DEF_HELPER_2(check_iob, void, env, i32)
|
||||
DEF_HELPER_2(check_iow, void, env, i32)
|
||||
DEF_HELPER_2(check_iol, void, env, i32)
|
||||
DEF_HELPER_3(outb, void, ptr, i32, i32)
|
||||
DEF_HELPER_2(inb, tl, ptr, i32)
|
||||
DEF_HELPER_3(outw, void, ptr, i32, i32)
|
||||
DEF_HELPER_2(inw, tl, ptr, i32)
|
||||
DEF_HELPER_3(outl, void, ptr, i32, i32)
|
||||
DEF_HELPER_2(inl, tl, ptr, i32)
|
||||
DEF_HELPER_3(outb, void, env, i32, i32)
|
||||
DEF_HELPER_2(inb, tl, env, i32)
|
||||
DEF_HELPER_3(outw, void, env, i32, i32)
|
||||
DEF_HELPER_2(inw, tl, env, i32)
|
||||
DEF_HELPER_3(outl, void, env, i32, i32)
|
||||
DEF_HELPER_2(inl, tl, env, i32)
|
||||
|
||||
DEF_HELPER_3(svm_check_intercept_param, void, env, i32, i64)
|
||||
DEF_HELPER_3(vmexit, void, env, i32, i64)
|
||||
|
|
|
@ -24,34 +24,67 @@
|
|||
|
||||
#include "uc_priv.h"
|
||||
|
||||
void helper_outb(void *handle, uint32_t port, uint32_t data)
|
||||
void helper_outb(CPUX86State *env, uint32_t port, uint32_t data)
|
||||
{
|
||||
cpu_outb(handle, port, data & 0xff);
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
fprintf(stderr, "outb: port=0x%04x, data=%02x\n", port, data);
|
||||
#else
|
||||
address_space_stb(&env->uc->as, port, data,
|
||||
cpu_get_mem_attrs(env), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
target_ulong helper_inb(void *handle, uint32_t port)
|
||||
target_ulong helper_inb(CPUX86State *env, uint32_t port)
|
||||
{
|
||||
return cpu_inb(handle, port);
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
fprintf(stderr, "inb: port=0x%04x\n", port);
|
||||
return 0;
|
||||
#else
|
||||
return address_space_ldub(&env->uc->as, port,
|
||||
cpu_get_mem_attrs(env), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void helper_outw(void *handle, uint32_t port, uint32_t data)
|
||||
void helper_outw(CPUX86State *env, uint32_t port, uint32_t data)
|
||||
{
|
||||
cpu_outw(handle, port, data & 0xffff);
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
fprintf(stderr, "outw: port=0x%04x, data=%04x\n", port, data);
|
||||
#else
|
||||
address_space_stw(&env->uc->as, port, data,
|
||||
cpu_get_mem_attrs(env), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
target_ulong helper_inw(void *handle, uint32_t port)
|
||||
target_ulong helper_inw(CPUX86State *env, uint32_t port)
|
||||
{
|
||||
return cpu_inw(handle, port);
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
fprintf(stderr, "inw: port=0x%04x\n", port);
|
||||
return 0;
|
||||
#else
|
||||
return address_space_lduw(&env->uc->as, port,
|
||||
cpu_get_mem_attrs(env), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void helper_outl(void *handle, uint32_t port, uint32_t data)
|
||||
void helper_outl(CPUX86State *env, uint32_t port, uint32_t data)
|
||||
{
|
||||
cpu_outl(handle, port, data);
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
fprintf(stderr, "outw: port=0x%04x, data=%08x\n", port, data);
|
||||
#else
|
||||
address_space_stl(&env->uc->as, port, data,
|
||||
cpu_get_mem_attrs(env), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
target_ulong helper_inl(void *handle, uint32_t port)
|
||||
target_ulong helper_inl(CPUX86State *env, uint32_t port)
|
||||
{
|
||||
return cpu_inl(handle, port);
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
fprintf(stderr, "inl: port=0x%04x\n", port);
|
||||
return 0;
|
||||
#else
|
||||
return address_space_ldl(&env->uc->as, port,
|
||||
cpu_get_mem_attrs(env), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void helper_into(CPUX86State *env, int next_eip_addend)
|
||||
|
|
|
@ -760,13 +760,13 @@ static void gen_helper_in_func(TCGContext *s, TCGMemOp ot, TCGv v, TCGv_i32 n)
|
|||
{
|
||||
switch (ot) {
|
||||
case MO_8:
|
||||
gen_helper_inb(s, v, tcg_const_ptr(s, s->uc), n);
|
||||
gen_helper_inb(s, v, s->cpu_env, n);
|
||||
break;
|
||||
case MO_16:
|
||||
gen_helper_inw(s, v, tcg_const_ptr(s, s->uc), n);
|
||||
gen_helper_inw(s, v, s->cpu_env, n);
|
||||
break;
|
||||
case MO_32:
|
||||
gen_helper_inl(s, v, tcg_const_ptr(s, s->uc), n);
|
||||
gen_helper_inl(s, v, s->cpu_env, n);
|
||||
break;
|
||||
default:
|
||||
tcg_abort();
|
||||
|
@ -777,13 +777,13 @@ static void gen_helper_out_func(TCGContext *s, TCGMemOp ot, TCGv_i32 v, TCGv_i32
|
|||
{
|
||||
switch (ot) {
|
||||
case MO_8:
|
||||
gen_helper_outb(s, tcg_const_ptr(s, s->uc), v, n);
|
||||
gen_helper_outb(s, s->cpu_env, v, n);
|
||||
break;
|
||||
case MO_16:
|
||||
gen_helper_outw(s, tcg_const_ptr(s, s->uc), v, n);
|
||||
gen_helper_outw(s, s->cpu_env, v, n);
|
||||
break;
|
||||
case MO_32:
|
||||
gen_helper_outl(s, tcg_const_ptr(s, s->uc), v, n);
|
||||
gen_helper_outl(s, s->cpu_env, v, n);
|
||||
break;
|
||||
default:
|
||||
tcg_abort();
|
||||
|
|
Loading…
Reference in a new issue