ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/vm_alloc.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/vm_alloc.cpp (file contents):
Revision 1.27 by gbeauche, 2008-01-01T09:40:33Z vs.
Revision 1.28 by gbeauche, 2008-01-12T21:43:02Z

# Line 48 | Line 48
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
# Line 111 | Line 119 | static int translate_map_flags(int vm_fl
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  
# Line 325 | Line 333 | int vm_protect(void * addr, size_t size,
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);
# Line 359 | Line 367 | int main(void)
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);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines