mirror of
https://github.com/qemu/qemu.git
synced 2026-02-04 05:35:39 +00:00
system/ioport: Do not open-code address_space_ld/st_le() methods
When a variable size is known, prefer the address_space_ld/st() API. Keep address_space_read/write() for blobs. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260109165058.59144-23-philmd@linaro.org>
This commit is contained in:
@@ -62,58 +62,50 @@ const MemoryRegionOps unassigned_io_ops = {
|
||||
void cpu_outb(uint32_t addr, uint8_t val)
|
||||
{
|
||||
trace_cpu_out(addr, 'b', val);
|
||||
address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
|
||||
&val, 1);
|
||||
address_space_stb(&address_space_io, addr, val,
|
||||
MEMTXATTRS_UNSPECIFIED, NULL);
|
||||
}
|
||||
|
||||
void cpu_outw(uint32_t addr, uint16_t val)
|
||||
{
|
||||
uint8_t buf[2];
|
||||
|
||||
trace_cpu_out(addr, 'w', val);
|
||||
stw_le_p(buf, val);
|
||||
address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
|
||||
buf, 2);
|
||||
address_space_stw_le(&address_space_io, addr, val,
|
||||
MEMTXATTRS_UNSPECIFIED, NULL);
|
||||
}
|
||||
|
||||
void cpu_outl(uint32_t addr, uint32_t val)
|
||||
{
|
||||
uint8_t buf[4];
|
||||
|
||||
trace_cpu_out(addr, 'l', val);
|
||||
stl_le_p(buf, val);
|
||||
address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
|
||||
buf, 4);
|
||||
address_space_stl_le(&address_space_io, addr, val,
|
||||
MEMTXATTRS_UNSPECIFIED, NULL);
|
||||
}
|
||||
|
||||
uint8_t cpu_inb(uint32_t addr)
|
||||
{
|
||||
uint8_t val;
|
||||
|
||||
address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
|
||||
&val, 1);
|
||||
val = address_space_ldub(&address_space_io, addr,
|
||||
MEMTXATTRS_UNSPECIFIED, NULL);
|
||||
trace_cpu_in(addr, 'b', val);
|
||||
return val;
|
||||
}
|
||||
|
||||
uint16_t cpu_inw(uint32_t addr)
|
||||
{
|
||||
uint8_t buf[2];
|
||||
uint16_t val;
|
||||
|
||||
address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, buf, 2);
|
||||
val = lduw_le_p(buf);
|
||||
val = address_space_lduw_le(&address_space_io, addr,
|
||||
MEMTXATTRS_UNSPECIFIED, NULL);
|
||||
trace_cpu_in(addr, 'w', val);
|
||||
return val;
|
||||
}
|
||||
|
||||
uint32_t cpu_inl(uint32_t addr)
|
||||
{
|
||||
uint8_t buf[4];
|
||||
uint32_t val;
|
||||
|
||||
address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, buf, 4);
|
||||
val = ldl_le_p(buf);
|
||||
val = address_space_ldl_le(&address_space_io, addr,
|
||||
MEMTXATTRS_UNSPECIFIED, NULL);
|
||||
trace_cpu_in(addr, 'l', val);
|
||||
return val;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user