48 |
|
#endif |
49 |
|
#endif |
50 |
|
|
51 |
+ |
#ifdef HAVE_WIN32_VM |
52 |
+ |
/* Windows is either ILP32 or LLP64 */ |
53 |
+ |
typedef UINT_PTR vm_uintptr_t; |
54 |
+ |
#else |
55 |
+ |
/* Other systems are sane as they are either ILP32 or LP64 */ |
56 |
+ |
typedef unsigned long vm_uintptr_t; |
57 |
+ |
#endif |
58 |
+ |
|
59 |
|
/* We want MAP_32BIT, if available, for SheepShaver and BasiliskII |
60 |
|
because the emulated target is 32-bit and this helps to allocate |
61 |
|
memory so that branches could be resolved more easily (32-bit |
119 |
|
#ifdef HAVE_WIN32_VM |
120 |
|
static inline LPVOID align_addr_segment(LPVOID addr) |
121 |
|
{ |
122 |
< |
return (LPVOID)(((DWORD)addr) & -65536); |
122 |
> |
return (LPVOID)(((vm_uintptr_t)addr) & -((vm_uintptr_t)65536)); |
123 |
|
} |
124 |
|
|
125 |
|
static inline DWORD align_size_segment(LPVOID addr, DWORD size) |
126 |
|
{ |
127 |
< |
return size + ((DWORD)addr - (DWORD)align_addr_segment(addr)); |
127 |
> |
return size + ((vm_uintptr_t)addr - (vm_uintptr_t)align_addr_segment(addr)); |
128 |
|
} |
129 |
|
#endif |
130 |
|
|
333 |
|
int vm_get_page_size(void) |
334 |
|
{ |
335 |
|
#ifdef HAVE_WIN32_VM |
336 |
< |
static unsigned long page_size = 0; |
336 |
> |
static vm_uintptr_t page_size = 0; |
337 |
|
if (page_size == 0) { |
338 |
|
SYSTEM_INFO si; |
339 |
|
GetSystemInfo(&si); |
367 |
|
signal(SIGBUS, fault_handler); |
368 |
|
#endif |
369 |
|
|
370 |
< |
#define page_align(address) ((char *)((unsigned long)(address) & -page_size)) |
371 |
< |
unsigned long page_size = vm_get_page_size(); |
370 |
> |
#define page_align(address) ((char *)((vm_uintptr_t)(address) & -page_size)) |
371 |
> |
vm_uintptr_t page_size = vm_get_page_size(); |
372 |
|
|
373 |
|
const int area_size = 6 * page_size; |
374 |
|
volatile char * area = (volatile char *) vm_acquire(area_size); |