intermediate commit, working unmap of complete blocks, still need sub-blocks, and cross block

This commit is contained in:
Chris Eagle
2015-08-29 21:17:30 -07:00
parent 160033c36c
commit 6beb1b8a13
18 changed files with 147 additions and 59 deletions

View File

@ -47,6 +47,8 @@ typedef void (*uc_args_uc_u64_t)(struct uc_struct *, uint64_t addr);
typedef MemoryRegion* (*uc_args_uc_ram_size_t)(struct uc_struct*, ram_addr_t begin, size_t size, uint32_t perms);
typedef void (*uc_mem_unmap_t)(struct uc_struct*, MemoryRegion *mr);
typedef void (*uc_readonly_mem_t)(MemoryRegion *mr, bool readonly);
// which interrupt should make emulation stop?
@ -90,6 +92,7 @@ struct uc_struct {
uc_args_tcg_enable_t tcg_enabled;
uc_args_uc_long_t tcg_exec_init;
uc_args_uc_ram_size_t memory_map;
uc_mem_unmap_t memory_unmap;
uc_readonly_mem_t readonly_mem;
// list of cpu
void* cpu;

View File

@ -422,9 +422,9 @@ uc_err uc_mem_map(uch handle, uint64_t address, size_t size, uint32_t perms);
This API changes permissions on an existing memory region.
@handle: handle returned by uc_open()
@start: starting address of the memory region to be modified.
@address: starting address of the memory region to be modified.
This address must be aligned to 4KB, or this will return with UC_ERR_MAP error.
@block_size: size of the memory region to be modified.
@size: size of the memory region to be modified.
This size must be multiple of 4KB, or this will return with UC_ERR_MAP error.
@perms: New permissions for the mapped region.
This must be some combination of UC_PROT_READ | UC_PROT_WRITE | UC_PROT_EXEC,
@ -434,7 +434,23 @@ uc_err uc_mem_map(uch handle, uint64_t address, size_t size, uint32_t perms);
for detailed error).
*/
UNICORN_EXPORT
uc_err uc_mem_protect(uch handle, uint64_t start, size_t block_size, uint32_t perms);
uc_err uc_mem_protect(uch handle, uint64_t address, size_t size, uint32_t perms);
/*
Unmap a region of emulation memory.
This API deletes a memory mapping from the emulation memory space.
@handle: handle returned by uc_open()
@address: starting address of the memory region to be unmapped.
This address must be aligned to 4KB, or this will return with UC_ERR_MAP error.
@size: size of the memory region to be modified.
This size must be multiple of 4KB, or this will return with UC_ERR_MAP error.
@return UC_ERR_OK on success, or other value on failure (refer to uc_err enum
for detailed error).
*/
UNICORN_EXPORT
uc_err uc_mem_unmap(uch handle, uint64_t address, size_t size);
#ifdef __cplusplus
}