diff options
author | mozilla%weilbacher.org <devnull@localhost> | 2006-12-12 22:00:25 +0000 |
---|---|---|
committer | mozilla%weilbacher.org <devnull@localhost> | 2006-12-12 22:00:25 +0000 |
commit | 02658faa84e2b617fd77cc3a7b793d30dfeee756 (patch) | |
tree | edc7308450772c8667b1126e36a3248d504594bf | |
parent | 5c7c775d16bd95b00b53011bad0e501ccb5a2ddb (diff) | |
download | nspr-hg-02658faa84e2b617fd77cc3a7b793d30dfeee756.tar.gz |
[OS/2] Bug 351246: Load Mozilla into Highmem on OS/2. Part 2, changes to NSPR. r=mkaply, sr=wtc
-rw-r--r-- | configure.in | 14 | ||||
-rw-r--r-- | pr/src/md/os2/os2io.c | 15 | ||||
-rw-r--r-- | pr/src/md/os2/os2misc.c | 19 |
3 files changed, 48 insertions, 0 deletions
diff --git a/configure.in b/configure.in index 6d5e7170..43a42f23 100644 --- a/configure.in +++ b/configure.in @@ -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__" diff --git a/pr/src/md/os2/os2io.c b/pr/src/md/os2/os2io.c index 185ba973..2d007dc8 100644 --- a/pr/src/md/os2/os2io.c +++ b/pr/src/md/os2/os2io.c @@ -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) diff --git a/pr/src/md/os2/os2misc.c b/pr/src/md/os2/os2misc.c index cbcafc83..3021b23d 100644 --- a/pr/src/md/os2/os2misc.c +++ b/pr/src/md/os2/os2misc.c @@ -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; |