[OS/2] Bug 351246: Load Mozilla into Highmem on OS/2. Part 2, changes to NSPR. r=mkaply, sr=wtc

git-svn-id: svn://10.0.0.236/trunk@216905 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mozilla%weilbacher.org
2006-12-12 22:00:25 +00:00
parent c77318159c
commit f4e25b5f8e
3 changed files with 48 additions and 0 deletions

View File

@@ -778,6 +778,15 @@ fi
OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
dnl ========================================================
dnl Enable high-memory support on OS/2, disabled by default
dnl ========================================================
AC_ARG_ENABLE(os2-high-mem,
[ --enable-os2-high-mem Enable high-memory support on OS/2],
[ if test "$enableval" = "yes"; then
MOZ_OS2_HIGH_MEMORY=1
else
MOZ_OS2_HIGH_MEMORY=
fi ])
dnl ========================================================
dnl Override of system specific host options
@@ -2091,6 +2100,11 @@ mips-sony-newsos*)
OS_LIBS="-lsocket"
IMPLIB='emximp -o'
FILTER='emxexp -o'
if test -n "$MOZ_OS2_HIGH_MEMORY"; then
DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
LDFLAGS="$LDFLAGS -Zhigh-mem"
AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
fi
# GCC for OS/2 currently predefines these, but we don't want them
DEFINES="$DEFINES -Uunix -U__unix -U__unix__"

View File

@@ -200,6 +200,21 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode)
APIRET rc = 0;
PRUword actionTaken;
#ifdef MOZ_OS2_HIGH_MEMORY
/*
* All the pointer arguments (&file, &actionTaken and name) have to be in
* low memory for DosOpen to use them.
* The following moves name to low memory.
*/
if ((ULONG)name >= 0x20000000)
{
size_t len = strlen(name) + 1;
char *copy = (char *)alloca(len);
memcpy(copy, name, len);
name = copy;
}
#endif
if (osflags & PR_SYNC) access |= OPEN_FLAGS_WRITE_THROUGH;
if (osflags & PR_RDONLY)

View File

@@ -40,6 +40,12 @@
* os2misc.c
*
*/
#ifdef MOZ_OS2_HIGH_MEMORY
/* os2safe.h has to be included before os2.h, needed for high mem */
#include <os2safe.h>
#endif
#include <string.h>
#include "primpl.h"
@@ -282,6 +288,19 @@ PRProcess * _PR_CreateOS2Process(
PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
goto errorExit;
}
#ifdef MOZ_OS2_HIGH_MEMORY
/*
* DosQueryAppType() fails if path (the char* in the first argument) is in
* high memory. If that is the case, the following moves it to low memory.
*/
if ((ULONG)path >= 0x20000000) {
size_t len = strlen(path) + 1;
char *copy = (char *)alloca(len);
memcpy(copy, path, len);
path = copy;
}
#endif
if (envp == NULL) {
newEnvp = NULL;