mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-12 16:30:44 +00:00
- Check for caddr_t. On some systems like Solaris/SPARC, mmap() address
type (first parameter) is caddr_t instead of void *. Explicitly cast address to (caddr_t) type and C++ implicit pointer conversion rules will do the rest. aka. caddr_t -> void * is OK unlike the opposite.
This commit is contained in:
parent
7ec7300784
commit
99efbfc712
@ -17,6 +17,9 @@
|
||||
/* Define to 'off_t' if <sys/types.h> doesn't define. */
|
||||
#undef loff_t
|
||||
|
||||
/* Define to 'char *' if <sys/types.h> doesn't define. */
|
||||
#undef caddr_t
|
||||
|
||||
/* Define to 'int' if <sys/types.h> doesn't define. */
|
||||
#undef socklen_t
|
||||
|
||||
|
@ -216,6 +216,7 @@ AC_CHECK_SIZEOF(long long, 8)
|
||||
AC_CHECK_SIZEOF(void *, 4)
|
||||
AC_TYPE_OFF_T
|
||||
AC_CHECK_TYPE(loff_t, off_t)
|
||||
AC_CHECK_TYPE(caddr_t, [char *])
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_SIGNAL
|
||||
AC_HEADER_TIME
|
||||
|
@ -96,7 +96,7 @@ void * vm_acquire(size_t size)
|
||||
return VM_MAP_FAILED;
|
||||
#else
|
||||
#ifdef HAVE_MMAP_VM
|
||||
if ((addr = mmap(next_address, size, VM_PAGE_DEFAULT, map_flags, zero_fd, 0)) == MAP_FAILED)
|
||||
if ((addr = mmap((caddr_t)next_address, size, VM_PAGE_DEFAULT, map_flags, zero_fd, 0)) == MAP_FAILED)
|
||||
return VM_MAP_FAILED;
|
||||
|
||||
next_address = (char *)addr + size;
|
||||
@ -132,7 +132,7 @@ int vm_acquire_fixed(void * addr, size_t size)
|
||||
return -1;
|
||||
#else
|
||||
#ifdef HAVE_MMAP_VM
|
||||
if (mmap(addr, size, VM_PAGE_DEFAULT, map_flags | MAP_FIXED, zero_fd, 0) == MAP_FAILED)
|
||||
if (mmap((caddr_t)addr, size, VM_PAGE_DEFAULT, map_flags | MAP_FIXED, zero_fd, 0) == MAP_FAILED)
|
||||
return -1;
|
||||
|
||||
// Since I don't know the standard behavior of mmap(), zero-fill here
|
||||
@ -166,7 +166,7 @@ int vm_release(void * addr, size_t size)
|
||||
return -1;
|
||||
#else
|
||||
#ifdef HAVE_MMAP_VM
|
||||
if (munmap(addr, size) != 0)
|
||||
if (munmap((caddr_t)addr, size) != 0)
|
||||
return -1;
|
||||
#else
|
||||
free(addr);
|
||||
@ -186,7 +186,7 @@ int vm_protect(void * addr, size_t size, int prot)
|
||||
return ret_code == KERN_SUCCESS ? 0 : -1;
|
||||
#else
|
||||
#ifdef HAVE_MMAP_VM
|
||||
int ret_code = mprotect(addr, size, prot);
|
||||
int ret_code = mprotect((caddr_t)addr, size, prot);
|
||||
return ret_code == 0 ? 0 : -1;
|
||||
#else
|
||||
// Unsupported
|
||||
|
Loading…
x
Reference in New Issue
Block a user