mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-29 09:26:56 +00:00
exec: add wrapper for host pointer access
host pointer accesses force pointer math, let's add a wrapper to make them safer. Backports relevant parts of commit 1240be24357ee292f8d05aa2abfdba75dd0ca25d from qemu
This commit is contained in:
parent
0696e7fe19
commit
f64e3d4931
|
@ -1282,7 +1282,7 @@ void *qemu_get_ram_block_host_ptr(struct uc_struct *uc, ram_addr_t addr)
|
|||
{
|
||||
RAMBlock *block = qemu_get_ram_block(uc, addr);
|
||||
|
||||
return block->host;
|
||||
return ramblock_ptr(block, 0);
|
||||
}
|
||||
|
||||
/* Return a host pointer to ram allocated with qemu_ram_alloc.
|
||||
|
@ -1297,7 +1297,7 @@ void *qemu_get_ram_ptr(struct uc_struct *uc, ram_addr_t addr)
|
|||
{
|
||||
RAMBlock *block = qemu_get_ram_block(uc, addr);
|
||||
|
||||
return block->host + (addr - block->offset);
|
||||
return ramblock_ptr(block, addr - block->offset);
|
||||
}
|
||||
|
||||
/* Return a host pointer to guest's ram. Similar to qemu_get_ram_ptr
|
||||
|
|
Loading…
Reference in a new issue