diff --git a/include/unicorn/unicorn.h b/include/unicorn/unicorn.h index ee307fac..103bf53f 100644 --- a/include/unicorn/unicorn.h +++ b/include/unicorn/unicorn.h @@ -400,6 +400,28 @@ uc_err uc_query(uc_engine *uc, uc_query_type type, size_t *result); UNICORN_EXPORT uc_err uc_errno(uc_engine *uc); +/* + Report the last error number when some API function fail. + Like glibc's errno, uc_errno might not retain its old value once accessed. + + @uc: handle returned by uc_open() + + @return: error code of uc_err enum type (UC_ERR_*, see above) +*/ +UNICORN_EXPORT +uint32_t uc_target_page_align(uc_engine *uc); + +/* + Report the last error number when some API function fail. + Like glibc's errno, uc_errno might not retain its old value once accessed. + + @uc: handle returned by uc_open() + + @return: error code of uc_err enum type (UC_ERR_*, see above) +*/ +UNICORN_EXPORT +uint32_t uc_target_page_size(uc_engine *uc); + /* Return a string describing given error code. diff --git a/uc.c b/uc.c index ef5ef23c..c54671b5 100644 --- a/uc.c +++ b/uc.c @@ -53,6 +53,20 @@ uc_err uc_errno(uc_engine *uc) } +UNICORN_EXPORT +uint32_t uc_target_page_align(uc_engine *uc) +{ + return uc->target_page_align; +} + + +UNICORN_EXPORT +uint32_t uc_target_page_size(uc_engine *uc) +{ + return uc->target_page_size; +} + + UNICORN_EXPORT const char *uc_strerror(uc_err code) {