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. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							parent
							
								
									b216aa6c0f
								
							
						
					
					
						commit
						3f7d846486
					
				| 
						 | 
				
			
			@ -5,5 +5,3 @@ obj-y += gdbstub.o
 | 
			
		|||
obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o
 | 
			
		||||
obj-$(CONFIG_KVM) += kvm.o
 | 
			
		||||
obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
 | 
			
		||||
obj-$(CONFIG_LINUX_USER) += ioport-user.o
 | 
			
		||||
obj-$(CONFIG_BSD_USER) += ioport-user.o
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -86,12 +86,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_2(outb, void, i32, i32)
 | 
			
		||||
DEF_HELPER_1(inb, tl, i32)
 | 
			
		||||
DEF_HELPER_2(outw, void, i32, i32)
 | 
			
		||||
DEF_HELPER_1(inw, tl, i32)
 | 
			
		||||
DEF_HELPER_2(outl, void, i32, i32)
 | 
			
		||||
DEF_HELPER_1(inl, tl, 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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,60 +0,0 @@
 | 
			
		|||
/*
 | 
			
		||||
 *  qemu user ioport functions
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2003-2008 Fabrice Bellard
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
 *  it under the terms of the GNU General Public License as published by
 | 
			
		||||
 *  the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
 *  (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is distributed in the hope that it will be useful,
 | 
			
		||||
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 *  GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program; if not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
#include "qemu.h"
 | 
			
		||||
#include "qemu-common.h"
 | 
			
		||||
#include "exec/ioport.h"
 | 
			
		||||
 | 
			
		||||
void cpu_outb(pio_addr_t addr, uint8_t val)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(stderr, "outb: port=0x%04"FMT_pioaddr", data=%02"PRIx8"\n",
 | 
			
		||||
            addr, val);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cpu_outw(pio_addr_t addr, uint16_t val)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(stderr, "outw: port=0x%04"FMT_pioaddr", data=%04"PRIx16"\n",
 | 
			
		||||
            addr, val);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cpu_outl(pio_addr_t addr, uint32_t val)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(stderr, "outl: port=0x%04"FMT_pioaddr", data=%08"PRIx32"\n",
 | 
			
		||||
            addr, val);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t cpu_inb(pio_addr_t addr)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(stderr, "inb: port=0x%04"FMT_pioaddr"\n", addr);
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint16_t cpu_inw(pio_addr_t addr)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(stderr, "inw: port=0x%04"FMT_pioaddr"\n", addr);
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t cpu_inl(pio_addr_t addr)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(stderr, "inl: port=0x%04"FMT_pioaddr"\n", addr);
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -18,38 +18,71 @@
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
#include "cpu.h"
 | 
			
		||||
#include "exec/ioport.h"
 | 
			
		||||
#include "exec/helper-proto.h"
 | 
			
		||||
#include "exec/cpu_ldst.h"
 | 
			
		||||
#include "exec/address-spaces.h"
 | 
			
		||||
 | 
			
		||||
void helper_outb(uint32_t port, uint32_t data)
 | 
			
		||||
void helper_outb(CPUX86State *env, uint32_t port, uint32_t data)
 | 
			
		||||
{
 | 
			
		||||
    cpu_outb(port, data & 0xff);
 | 
			
		||||
#ifdef CONFIG_USER_ONLY
 | 
			
		||||
    fprintf(stderr, "outb: port=0x%04x, data=%02x\n", port, data);
 | 
			
		||||
#else
 | 
			
		||||
    address_space_stb(&address_space_io, port, data,
 | 
			
		||||
                      cpu_get_mem_attrs(env), NULL);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
target_ulong helper_inb(uint32_t port)
 | 
			
		||||
target_ulong helper_inb(CPUX86State *env, uint32_t port)
 | 
			
		||||
{
 | 
			
		||||
    return cpu_inb(port);
 | 
			
		||||
#ifdef CONFIG_USER_ONLY
 | 
			
		||||
    fprintf(stderr, "inb: port=0x%04x\n", port);
 | 
			
		||||
    return 0;
 | 
			
		||||
#else
 | 
			
		||||
    return address_space_ldub(&address_space_io, port,
 | 
			
		||||
                              cpu_get_mem_attrs(env), NULL);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void helper_outw(uint32_t port, uint32_t data)
 | 
			
		||||
void helper_outw(CPUX86State *env, uint32_t port, uint32_t data)
 | 
			
		||||
{
 | 
			
		||||
    cpu_outw(port, data & 0xffff);
 | 
			
		||||
#ifdef CONFIG_USER_ONLY
 | 
			
		||||
    fprintf(stderr, "outw: port=0x%04x, data=%04x\n", port, data);
 | 
			
		||||
#else
 | 
			
		||||
    address_space_stw(&address_space_io, port, data,
 | 
			
		||||
                      cpu_get_mem_attrs(env), NULL);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
target_ulong helper_inw(uint32_t port)
 | 
			
		||||
target_ulong helper_inw(CPUX86State *env, uint32_t port)
 | 
			
		||||
{
 | 
			
		||||
    return cpu_inw(port);
 | 
			
		||||
#ifdef CONFIG_USER_ONLY
 | 
			
		||||
    fprintf(stderr, "inw: port=0x%04x\n", port);
 | 
			
		||||
    return 0;
 | 
			
		||||
#else
 | 
			
		||||
    return address_space_lduw(&address_space_io, port,
 | 
			
		||||
                              cpu_get_mem_attrs(env), NULL);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void helper_outl(uint32_t port, uint32_t data)
 | 
			
		||||
void helper_outl(CPUX86State *env, uint32_t port, uint32_t data)
 | 
			
		||||
{
 | 
			
		||||
    cpu_outl(port, data);
 | 
			
		||||
#ifdef CONFIG_USER_ONLY
 | 
			
		||||
    fprintf(stderr, "outw: port=0x%04x, data=%08x\n", port, data);
 | 
			
		||||
#else
 | 
			
		||||
    address_space_stl(&address_space_io, port, data,
 | 
			
		||||
                      cpu_get_mem_attrs(env), NULL);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
target_ulong helper_inl(uint32_t port)
 | 
			
		||||
target_ulong helper_inl(CPUX86State *env, uint32_t port)
 | 
			
		||||
{
 | 
			
		||||
    return cpu_inl(port);
 | 
			
		||||
#ifdef CONFIG_USER_ONLY
 | 
			
		||||
    fprintf(stderr, "inl: port=0x%04x\n", port);
 | 
			
		||||
    return 0;
 | 
			
		||||
#else
 | 
			
		||||
    return address_space_ldl(&address_space_io, port,
 | 
			
		||||
                             cpu_get_mem_attrs(env), NULL);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void helper_into(CPUX86State *env, int next_eip_addend)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -631,13 +631,13 @@ static void gen_helper_in_func(TCGMemOp ot, TCGv v, TCGv_i32 n)
 | 
			
		|||
{
 | 
			
		||||
    switch (ot) {
 | 
			
		||||
    case MO_8:
 | 
			
		||||
        gen_helper_inb(v, n);
 | 
			
		||||
        gen_helper_inb(v, cpu_env, n);
 | 
			
		||||
        break;
 | 
			
		||||
    case MO_16:
 | 
			
		||||
        gen_helper_inw(v, n);
 | 
			
		||||
        gen_helper_inw(v, cpu_env, n);
 | 
			
		||||
        break;
 | 
			
		||||
    case MO_32:
 | 
			
		||||
        gen_helper_inl(v, n);
 | 
			
		||||
        gen_helper_inl(v, cpu_env, n);
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        tcg_abort();
 | 
			
		||||
| 
						 | 
				
			
			@ -648,13 +648,13 @@ static void gen_helper_out_func(TCGMemOp ot, TCGv_i32 v, TCGv_i32 n)
 | 
			
		|||
{
 | 
			
		||||
    switch (ot) {
 | 
			
		||||
    case MO_8:
 | 
			
		||||
        gen_helper_outb(v, n);
 | 
			
		||||
        gen_helper_outb(cpu_env, v, n);
 | 
			
		||||
        break;
 | 
			
		||||
    case MO_16:
 | 
			
		||||
        gen_helper_outw(v, n);
 | 
			
		||||
        gen_helper_outw(cpu_env, v, n);
 | 
			
		||||
        break;
 | 
			
		||||
    case MO_32:
 | 
			
		||||
        gen_helper_outl(v, n);
 | 
			
		||||
        gen_helper_outl(cpu_env, v, n);
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        tcg_abort();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue