mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
Replace cpu_physical_memory_rw were possible
Using cpu_physical_memory_read, cpu_physical_memory_write and ldub_phys improves readability and allows removing some type casts. lduw_phys and ldl_phys were not used because both require aligned addresses. Therefore it is not possible to simply replace existing calls by one of these functions. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
b8b79323d0
commit
54f7b4a396
8 changed files with 19 additions and 21 deletions
|
@ -427,7 +427,7 @@ static inline int get_dwords(OHCIState *ohci,
|
|||
addr += ohci->localmem_base;
|
||||
|
||||
for (i = 0; i < num; i++, buf++, addr += sizeof(*buf)) {
|
||||
cpu_physical_memory_rw(addr, (uint8_t *)buf, sizeof(*buf), 0);
|
||||
cpu_physical_memory_read(addr, buf, sizeof(*buf));
|
||||
*buf = le32_to_cpu(*buf);
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ static inline int put_dwords(OHCIState *ohci,
|
|||
|
||||
for (i = 0; i < num; i++, buf++, addr += sizeof(*buf)) {
|
||||
uint32_t tmp = cpu_to_le32(*buf);
|
||||
cpu_physical_memory_rw(addr, (uint8_t *)&tmp, sizeof(tmp), 1);
|
||||
cpu_physical_memory_write(addr, &tmp, sizeof(tmp));
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -459,7 +459,7 @@ static inline int get_words(OHCIState *ohci,
|
|||
addr += ohci->localmem_base;
|
||||
|
||||
for (i = 0; i < num; i++, buf++, addr += sizeof(*buf)) {
|
||||
cpu_physical_memory_rw(addr, (uint8_t *)buf, sizeof(*buf), 0);
|
||||
cpu_physical_memory_read(addr, buf, sizeof(*buf));
|
||||
*buf = le16_to_cpu(*buf);
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ static inline int put_words(OHCIState *ohci,
|
|||
|
||||
for (i = 0; i < num; i++, buf++, addr += sizeof(*buf)) {
|
||||
uint16_t tmp = cpu_to_le16(*buf);
|
||||
cpu_physical_memory_rw(addr, (uint8_t *)&tmp, sizeof(tmp), 1);
|
||||
cpu_physical_memory_write(addr, &tmp, sizeof(tmp));
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -504,8 +504,7 @@ static inline int ohci_read_iso_td(OHCIState *ohci,
|
|||
static inline int ohci_read_hcca(OHCIState *ohci,
|
||||
uint32_t addr, struct ohci_hcca *hcca)
|
||||
{
|
||||
cpu_physical_memory_rw(addr + ohci->localmem_base,
|
||||
(uint8_t *)hcca, sizeof(*hcca), 0);
|
||||
cpu_physical_memory_read(addr + ohci->localmem_base, hcca, sizeof(*hcca));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -531,8 +530,7 @@ static inline int ohci_put_iso_td(OHCIState *ohci,
|
|||
static inline int ohci_put_hcca(OHCIState *ohci,
|
||||
uint32_t addr, struct ohci_hcca *hcca)
|
||||
{
|
||||
cpu_physical_memory_rw(addr + ohci->localmem_base,
|
||||
(uint8_t *)hcca, sizeof(*hcca), 1);
|
||||
cpu_physical_memory_write(addr + ohci->localmem_base, hcca, sizeof(*hcca));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue