mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-25 03:56:54 +00:00
exec: optimize remaining address_space_* cases
Do them right before the next patch generalizes them into a multi-included file. Backports commit 2651efe7f5f9d6dc89c8e54d7d63952b7b22597d from qemu
This commit is contained in:
parent
0f94929fa7
commit
f3cc489a72
31
qemu/exec.c
31
qemu/exec.c
|
@ -2534,17 +2534,42 @@ uint64_t ldq_be_phys(AddressSpace *as, hwaddr addr)
|
|||
return address_space_ldq_be(as, addr, MEMTXATTRS_UNSPECIFIED, NULL);
|
||||
}
|
||||
|
||||
/* XXX: optimize */
|
||||
uint32_t address_space_ldub(AddressSpace *as, hwaddr addr,
|
||||
MemTxAttrs attrs, MemTxResult *result)
|
||||
{
|
||||
uint8_t val;
|
||||
uint8_t *ptr;
|
||||
uint64_t val;
|
||||
MemoryRegion *mr;
|
||||
hwaddr l = 1;
|
||||
hwaddr addr1;
|
||||
MemTxResult r;
|
||||
// Unicorn: commented out
|
||||
//bool release_lock = false;
|
||||
|
||||
r = address_space_rw(as, addr, attrs, &val, 1, 0);
|
||||
//rcu_read_lock();
|
||||
mr = address_space_translate(as, addr, &addr1, &l, false);
|
||||
if (!memory_access_is_direct(mr, false)) {
|
||||
// Unicorn: commented out
|
||||
//release_lock |= prepare_mmio_access(mr);
|
||||
|
||||
/* I/O case */
|
||||
r = memory_region_dispatch_read(mr, addr1, &val, 1, attrs);
|
||||
} else {
|
||||
/* RAM case */
|
||||
ptr = qemu_map_ram_ptr(mr->uc, mr->ram_block, addr1);
|
||||
val = ldub_p(ptr);
|
||||
r = MEMTX_OK;
|
||||
}
|
||||
if (result) {
|
||||
*result = r;
|
||||
}
|
||||
// Unicorn: if'd out
|
||||
#if 0
|
||||
if (release_lock) {
|
||||
qemu_mutex_unlock_iothread();
|
||||
}
|
||||
rcu_read_unlock();
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue