Adjust big memory test for host pagesize
On machines with a page size larger than 4K, the requested memory size in `test_map_big_memory` gets rounded up and overflows to zero. This PR adds some code to query the page size and adjust the requested memory size accordingly.
This commit is contained in:
parent
e76b2db434
commit
e1e7b25268
@ -184,8 +184,15 @@ static void test_map_big_memory(void)
|
||||
|
||||
OK(uc_open(UC_ARCH_X86, UC_MODE_64, &uc));
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__WINDOWS__)
|
||||
uint64_t requested_size = 0xfffffffffffff000; // assume 4K page size
|
||||
#else
|
||||
long ps = sysconf(_SC_PAGESIZE);
|
||||
uint64_t requested_size = (uint64_t)(-ps);
|
||||
#endif
|
||||
|
||||
uc_assert_err(UC_ERR_NOMEM,
|
||||
uc_mem_map(uc, 0x0, 0xfffffffffffff000, UC_PROT_ALL));
|
||||
uc_mem_map(uc, 0x0, requested_size, UC_PROT_ALL));
|
||||
|
||||
OK(uc_close(uc));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user