mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-27 23:32:52 +00:00
implement vm_page_size() to get the actual size of a page
This commit is contained in:
parent
ce1420dcce
commit
fc47096ef8
@ -449,6 +449,17 @@ int vm_protect(void * addr, size_t size, int prot)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns the size of a page. */
|
||||||
|
|
||||||
|
int vm_page_size(void)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
return 4096;
|
||||||
|
#else
|
||||||
|
return getpagesize();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIGURE_TEST_VM_MAP
|
#ifdef CONFIGURE_TEST_VM_MAP
|
||||||
/* Tests covered here:
|
/* Tests covered here:
|
||||||
- TEST_VM_PROT_* program slices actually succeeds when a crash occurs
|
- TEST_VM_PROT_* program slices actually succeeds when a crash occurs
|
||||||
@ -459,11 +470,7 @@ int main(void)
|
|||||||
vm_init();
|
vm_init();
|
||||||
|
|
||||||
#define page_align(address) ((char *)((unsigned long)(address) & -page_size))
|
#define page_align(address) ((char *)((unsigned long)(address) & -page_size))
|
||||||
#ifdef _WIN32
|
unsigned long page_size = vm_page_size();
|
||||||
const unsigned long page_size = 4096;
|
|
||||||
#else
|
|
||||||
unsigned long page_size = getpagesize();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const int area_size = 6 * page_size;
|
const int area_size = 6 * page_size;
|
||||||
volatile char * area = (volatile char *) vm_acquire(area_size);
|
volatile char * area = (volatile char *) vm_acquire(area_size);
|
||||||
|
@ -109,4 +109,8 @@ extern int vm_release(void * addr, size_t size);
|
|||||||
|
|
||||||
extern int vm_protect(void * addr, size_t size, int prot);
|
extern int vm_protect(void * addr, size_t size, int prot);
|
||||||
|
|
||||||
|
/* Returns the size of a page. */
|
||||||
|
|
||||||
|
extern int vm_page_size(void);
|
||||||
|
|
||||||
#endif /* VM_ALLOC_H */
|
#endif /* VM_ALLOC_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user