Add error value UC_ERR_INVAL and rename UC_ERR_OOM to UC_ERR_NOMEM to provide more error specificity
This commit is contained in:
@ -104,7 +104,7 @@ typedef enum uc_mode {
|
||||
// These are values returned by uc_errno()
|
||||
typedef enum uc_err {
|
||||
UC_ERR_OK = 0, // No error: everything was fine
|
||||
UC_ERR_OOM, // Out-Of-Memory error: uc_open(), uc_emulate()
|
||||
UC_ERR_NOMEM, // Out-Of-Memory error: uc_open(), uc_emulate()
|
||||
UC_ERR_ARCH, // Unsupported architecture: uc_open()
|
||||
UC_ERR_HANDLE, // Invalid handle
|
||||
UC_ERR_UCH, // Invalid handle (uch)
|
||||
@ -119,6 +119,7 @@ typedef enum uc_err {
|
||||
UC_ERR_WRITE_PROT, // Quit emulation due to UC_PROT_WRITE violation: uc_emu_start()
|
||||
UC_ERR_READ_PROT, // Quit emulation due to UC_PROT_READ violation: uc_emu_start()
|
||||
UC_ERR_EXEC_PROT, // Quit emulation due to UC_PROT_EXEC violation: uc_emu_start()
|
||||
UC_ERR_INVAL, // Inavalid argument provided to uc_xxx function (See specific function API)
|
||||
} uc_err;
|
||||
|
||||
|
||||
@ -405,15 +406,15 @@ typedef enum uc_prot {
|
||||
|
||||
@handle: handle returned by uc_open()
|
||||
@address: starting address of the new memory region to be mapped in.
|
||||
This address must be aligned to 4KB, or this will return with UC_ERR_MAP error.
|
||||
This address must be aligned to 4KB, or this will return with UC_ERR_INVAL error.
|
||||
@size: size of the new memory region to be mapped in.
|
||||
This size must be multiple of 4KB, or this will return with UC_ERR_MAP error.
|
||||
This size must be multiple of 4KB, or this will return with UC_ERR_INVAL error.
|
||||
@perms: Permissions for the newly mapped region.
|
||||
This must be some combination of UC_PROT_READ | UC_PROT_WRITE | UC_PROT_EXEC,
|
||||
or this will return with UC_ERR_MAP error.
|
||||
or this will return with UC_ERR_INVAL error.
|
||||
|
||||
@return UC_ERR_OK on success, or other value on failure (refer to uc_err enum
|
||||
for detailed error).
|
||||
@return UC_ERR_OK on success, UC_ERR_NOMEM if no memory is available to satisfy the
|
||||
request, or other value on failure (refer to uc_err enum for detailed error).
|
||||
*/
|
||||
UNICORN_EXPORT
|
||||
uc_err uc_mem_map(uch handle, uint64_t address, size_t size, uint32_t perms);
|
||||
@ -424,15 +425,16 @@ uc_err uc_mem_map(uch handle, uint64_t address, size_t size, uint32_t perms);
|
||||
|
||||
@handle: handle returned by uc_open()
|
||||
@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.
|
||||
This address must be aligned to 4KB, or this will return with UC_ERR_INVAL 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.
|
||||
This size must be multiple of 4KB, or this will return with UC_ERR_INVAL error.
|
||||
@perms: New permissions for the mapped region.
|
||||
This must be some combination of UC_PROT_READ | UC_PROT_WRITE | UC_PROT_EXEC,
|
||||
or this will return with UC_ERR_MAP error.
|
||||
or this will return with UC_ERR_INVAL error.
|
||||
|
||||
@return UC_ERR_OK on success, or other value on failure (refer to uc_err enum
|
||||
for detailed error).
|
||||
@return UC_ERR_OK on success, UC_ERR_HANDLE for an invalid handle, UC_ERR_INVAL
|
||||
for invalid perms or unaligned address or size, UC_ERR_NOMEM if entire region
|
||||
is not mapped.
|
||||
*/
|
||||
UNICORN_EXPORT
|
||||
uc_err uc_mem_protect(uch handle, uint64_t address, size_t size, uint32_t perms);
|
||||
@ -443,9 +445,9 @@ uc_err uc_mem_protect(uch handle, uint64_t address, size_t size, uint32_t perms)
|
||||
|
||||
@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.
|
||||
This address must be aligned to 4KB, or this will return with UC_ERR_INVAL 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.
|
||||
This size must be multiple of 4KB, or this will return with UC_ERR_INVAL error.
|
||||
|
||||
@return UC_ERR_OK on success, or other value on failure (refer to uc_err enum
|
||||
for detailed error).
|
||||
|
Reference in New Issue
Block a user