exec: Let the address_space API use void pointer arguments
As we are only dealing with a blob buffer, use a void pointer argument. This will let us simplify other APIs. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
parent
a152be43dc
commit
daa3dda43a
11
exec.c
11
exec.c
@ -3271,7 +3271,7 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
|
MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
|
||||||
MemTxAttrs attrs, uint8_t *buf, hwaddr len)
|
MemTxAttrs attrs, void *buf, hwaddr len)
|
||||||
{
|
{
|
||||||
MemTxResult result = MEMTX_OK;
|
MemTxResult result = MEMTX_OK;
|
||||||
FlatView *fv;
|
FlatView *fv;
|
||||||
@ -3287,7 +3287,7 @@ MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
|
|||||||
|
|
||||||
MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
|
MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
|
||||||
MemTxAttrs attrs,
|
MemTxAttrs attrs,
|
||||||
const uint8_t *buf, hwaddr len)
|
const void *buf, hwaddr len)
|
||||||
{
|
{
|
||||||
MemTxResult result = MEMTX_OK;
|
MemTxResult result = MEMTX_OK;
|
||||||
FlatView *fv;
|
FlatView *fv;
|
||||||
@ -3302,7 +3302,7 @@ MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
|
MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
|
||||||
uint8_t *buf, hwaddr len, bool is_write)
|
void *buf, hwaddr len, bool is_write)
|
||||||
{
|
{
|
||||||
if (is_write) {
|
if (is_write) {
|
||||||
return address_space_write(as, addr, attrs, buf, len);
|
return address_space_write(as, addr, attrs, buf, len);
|
||||||
@ -3326,7 +3326,7 @@ enum write_rom_type {
|
|||||||
static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,
|
static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,
|
||||||
hwaddr addr,
|
hwaddr addr,
|
||||||
MemTxAttrs attrs,
|
MemTxAttrs attrs,
|
||||||
const uint8_t *buf,
|
const void *ptr,
|
||||||
hwaddr len,
|
hwaddr len,
|
||||||
enum write_rom_type type)
|
enum write_rom_type type)
|
||||||
{
|
{
|
||||||
@ -3334,6 +3334,7 @@ static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,
|
|||||||
uint8_t *ram_ptr;
|
uint8_t *ram_ptr;
|
||||||
hwaddr addr1;
|
hwaddr addr1;
|
||||||
MemoryRegion *mr;
|
MemoryRegion *mr;
|
||||||
|
const uint8_t *buf = ptr;
|
||||||
|
|
||||||
RCU_READ_LOCK_GUARD();
|
RCU_READ_LOCK_GUARD();
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
@ -3366,7 +3367,7 @@ static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,
|
|||||||
/* used for ROM loading : can write in RAM and ROM */
|
/* used for ROM loading : can write in RAM and ROM */
|
||||||
MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,
|
MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,
|
||||||
MemTxAttrs attrs,
|
MemTxAttrs attrs,
|
||||||
const uint8_t *buf, hwaddr len)
|
const void *buf, hwaddr len)
|
||||||
{
|
{
|
||||||
return address_space_write_rom_internal(as, addr, attrs,
|
return address_space_write_rom_internal(as, addr, attrs,
|
||||||
buf, len, WRITE_DATA);
|
buf, len, WRITE_DATA);
|
||||||
|
@ -2052,7 +2052,7 @@ void address_space_remove_listeners(AddressSpace *as);
|
|||||||
* @is_write: indicates the transfer direction
|
* @is_write: indicates the transfer direction
|
||||||
*/
|
*/
|
||||||
MemTxResult address_space_rw(AddressSpace *as, hwaddr addr,
|
MemTxResult address_space_rw(AddressSpace *as, hwaddr addr,
|
||||||
MemTxAttrs attrs, uint8_t *buf,
|
MemTxAttrs attrs, void *buf,
|
||||||
hwaddr len, bool is_write);
|
hwaddr len, bool is_write);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2070,7 +2070,7 @@ MemTxResult address_space_rw(AddressSpace *as, hwaddr addr,
|
|||||||
*/
|
*/
|
||||||
MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
|
MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
|
||||||
MemTxAttrs attrs,
|
MemTxAttrs attrs,
|
||||||
const uint8_t *buf, hwaddr len);
|
const void *buf, hwaddr len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* address_space_write_rom: write to address space, including ROM.
|
* address_space_write_rom: write to address space, including ROM.
|
||||||
@ -2096,7 +2096,7 @@ MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
|
|||||||
*/
|
*/
|
||||||
MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,
|
MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,
|
||||||
MemTxAttrs attrs,
|
MemTxAttrs attrs,
|
||||||
const uint8_t *buf, hwaddr len);
|
const void *buf, hwaddr len);
|
||||||
|
|
||||||
/* address_space_ld*: load from an address space
|
/* address_space_ld*: load from an address space
|
||||||
* address_space_st*: store to an address space
|
* address_space_st*: store to an address space
|
||||||
@ -2334,7 +2334,7 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
|
|||||||
|
|
||||||
/* Internal functions, part of the implementation of address_space_read. */
|
/* Internal functions, part of the implementation of address_space_read. */
|
||||||
MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
|
MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
|
||||||
MemTxAttrs attrs, uint8_t *buf, hwaddr len);
|
MemTxAttrs attrs, void *buf, hwaddr len);
|
||||||
MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
|
MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
|
||||||
MemTxAttrs attrs, void *buf,
|
MemTxAttrs attrs, void *buf,
|
||||||
hwaddr len, hwaddr addr1, hwaddr l,
|
hwaddr len, hwaddr addr1, hwaddr l,
|
||||||
@ -2374,7 +2374,7 @@ static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write)
|
|||||||
*/
|
*/
|
||||||
static inline __attribute__((__always_inline__))
|
static inline __attribute__((__always_inline__))
|
||||||
MemTxResult address_space_read(AddressSpace *as, hwaddr addr,
|
MemTxResult address_space_read(AddressSpace *as, hwaddr addr,
|
||||||
MemTxAttrs attrs, uint8_t *buf,
|
MemTxAttrs attrs, void *buf,
|
||||||
hwaddr len)
|
hwaddr len)
|
||||||
{
|
{
|
||||||
MemTxResult result = MEMTX_OK;
|
MemTxResult result = MEMTX_OK;
|
||||||
@ -2433,7 +2433,7 @@ address_space_read_cached(MemoryRegionCache *cache, hwaddr addr,
|
|||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
address_space_write_cached(MemoryRegionCache *cache, hwaddr addr,
|
address_space_write_cached(MemoryRegionCache *cache, hwaddr addr,
|
||||||
void *buf, hwaddr len)
|
const void *buf, hwaddr len)
|
||||||
{
|
{
|
||||||
assert(addr < cache->len && len <= cache->len - addr);
|
assert(addr < cache->len && len <= cache->len - addr);
|
||||||
if (likely(cache->ptr)) {
|
if (likely(cache->ptr)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user