mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
Add endianness as io mem parameter
As stated before, devices can be little, big or native endian. The target endianness is not of their concern, so we need to push things down a level. This patch adds a parameter to cpu_register_io_memory that allows a device to choose its endianness. For now, all devices simply choose native endian, because that's the same behavior as before. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
dd310534e3
commit
2507c12ab0
154 changed files with 446 additions and 262 deletions
21
exec.c
21
exec.c
|
@ -3331,7 +3331,8 @@ static subpage_t *subpage_init (target_phys_addr_t base, ram_addr_t *phys,
|
|||
mmio = qemu_mallocz(sizeof(subpage_t));
|
||||
|
||||
mmio->base = base;
|
||||
subpage_memory = cpu_register_io_memory(subpage_read, subpage_write, mmio);
|
||||
subpage_memory = cpu_register_io_memory(subpage_read, subpage_write, mmio,
|
||||
DEVICE_NATIVE_ENDIAN);
|
||||
#if defined(DEBUG_SUBPAGE)
|
||||
printf("%s: %p base " TARGET_FMT_plx " len %08x %d\n", __func__,
|
||||
mmio, base, TARGET_PAGE_SIZE, subpage_memory);
|
||||
|
@ -3468,7 +3469,6 @@ static int cpu_register_io_memory_fixed(int io_index,
|
|||
void *opaque, enum device_endian endian)
|
||||
{
|
||||
int i;
|
||||
int endian = DEVICE_NATIVE_ENDIAN;
|
||||
|
||||
if (io_index <= 0) {
|
||||
io_index = get_free_io_mem_idx();
|
||||
|
@ -3513,7 +3513,7 @@ int cpu_register_io_memory(CPUReadMemoryFunc * const *mem_read,
|
|||
CPUWriteMemoryFunc * const *mem_write,
|
||||
void *opaque, enum device_endian endian)
|
||||
{
|
||||
return cpu_register_io_memory_fixed(0, mem_read, mem_write, opaque);
|
||||
return cpu_register_io_memory_fixed(0, mem_read, mem_write, opaque, endian);
|
||||
}
|
||||
|
||||
void cpu_unregister_io_memory(int io_table_address)
|
||||
|
@ -3535,14 +3535,21 @@ static void io_mem_init(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
cpu_register_io_memory_fixed(IO_MEM_ROM, error_mem_read, unassigned_mem_write, NULL);
|
||||
cpu_register_io_memory_fixed(IO_MEM_UNASSIGNED, unassigned_mem_read, unassigned_mem_write, NULL);
|
||||
cpu_register_io_memory_fixed(IO_MEM_NOTDIRTY, error_mem_read, notdirty_mem_write, NULL);
|
||||
cpu_register_io_memory_fixed(IO_MEM_ROM, error_mem_read,
|
||||
unassigned_mem_write, NULL,
|
||||
DEVICE_NATIVE_ENDIAN);
|
||||
cpu_register_io_memory_fixed(IO_MEM_UNASSIGNED, unassigned_mem_read,
|
||||
unassigned_mem_write, NULL,
|
||||
DEVICE_NATIVE_ENDIAN);
|
||||
cpu_register_io_memory_fixed(IO_MEM_NOTDIRTY, error_mem_read,
|
||||
notdirty_mem_write, NULL,
|
||||
DEVICE_NATIVE_ENDIAN);
|
||||
for (i=0; i<5; i++)
|
||||
io_mem_used[i] = 1;
|
||||
|
||||
io_mem_watch = cpu_register_io_memory(watch_mem_read,
|
||||
watch_mem_write, NULL);
|
||||
watch_mem_write, NULL,
|
||||
DEVICE_NATIVE_ENDIAN);
|
||||
}
|
||||
|
||||
#endif /* !defined(CONFIG_USER_ONLY) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue