Add PS4 port.

Thanks to Eddie Edwards.
This commit is contained in:
Mike Pall
2014-02-26 15:56:07 +01:00
parent 998651fcda
commit 6a47e123a4
7 changed files with 138 additions and 10 deletions

View File

@@ -188,7 +188,7 @@ static LJ_AINLINE void *CALL_MMAP(size_t size)
return ptr;
}
#elif LJ_TARGET_OSX || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun__)
#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun__)
/* OSX and FreeBSD mmap() use a naive first-fit linear search.
** That's perfect for us. Except that -pagezero_size must be set for OSX,
@@ -197,12 +197,14 @@ static LJ_AINLINE void *CALL_MMAP(size_t size)
*/
#if LJ_TARGET_OSX
#define MMAP_REGION_START ((uintptr_t)0x10000)
#elif LJ_TARGET_PS4
#define MMAP_REGION_START ((uintptr_t)0x4000)
#else
#define MMAP_REGION_START ((uintptr_t)0x10000000)
#endif
#define MMAP_REGION_END ((uintptr_t)0x80000000)
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !LJ_TARGET_PS4
#include <sys/resource.h>
#endif
@@ -212,7 +214,7 @@ static LJ_AINLINE void *CALL_MMAP(size_t size)
/* Hint for next allocation. Doesn't need to be thread-safe. */
static uintptr_t alloc_hint = MMAP_REGION_START;
int retry = 0;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !LJ_TARGET_PS4
static int rlimit_modified = 0;
if (LJ_UNLIKELY(rlimit_modified == 0)) {
struct rlimit rlim;