[query] add UC_QUERY_PAGE_SIZE uc_query helper

Return the current page size used by the current arch.
Useful to call uc_mem_map() with memory/size aligned.

Signed-off-by: Nicolas PLANEL <nplanel@redhat.com>
This commit is contained in:
Nicolas PLANEL
2016-03-04 15:26:06 +11:00
parent 1ddebc7304
commit 1087ba9dea
3 changed files with 16 additions and 0 deletions

5
uc.c
View File

@@ -1094,6 +1094,11 @@ uint32_t uc_mem_regions(uc_engine *uc, uc_mem_region **regions, uint32_t *count)
UNICORN_EXPORT
uc_err uc_query(uc_engine *uc, uc_query_type type, size_t *result)
{
if (type == UC_QUERY_PAGE_SIZE) {
*result = uc->target_page_size;
return UC_ERR_OK;
}
switch(uc->arch) {
case UC_ARCH_ARM:
return uc->query(uc, type, result);