[OS/2] Bug 351246: Load Mozilla into Highmem on OS/2. Part 1, changes to OS/2 only core code. r=abwillis1, sr=mkaply

This commit is contained in:
mozilla%weilbacher.org 2006-12-10 08:53:03 +00:00
parent 01ccd95a11
commit 4deb44606c
7 changed files with 95 additions and 2 deletions

View File

@ -1110,11 +1110,27 @@ void * os2_alloc(size_t bytes)
{
void * result;
#ifdef MOZ_OS2_HIGH_MEMORY
APIRET rc = DosAllocMem(&result, bytes, PAG_EXECUTE | PAG_READ |
PAG_WRITE | PAG_COMMIT | OBJ_ANY);
if (rc != NO_ERROR) { /* Did the kernel handle OBJ_ANY? */
/* Try again without OBJ_ANY and if the first failure was not caused
* by OBJ_ANY then we will get the same failure, else we have taken
* care of pre-FP13 systems where the kernel couldn't handle it.
*/
rc = DosAllocMem(&result, bytes, PAG_EXECUTE | PAG_READ |
PAG_WRITE | PAG_COMMIT);
if (rc != NO_ERROR) {
return(0);
}
}
#else
if (DosAllocMem(&result, bytes, PAG_EXECUTE | PAG_READ |
PAG_WRITE | PAG_COMMIT)
!= NO_ERROR) {
return(0);
}
#endif
if (result == 0) return(os2_alloc(bytes));
return(result);
}

View File

@ -56,8 +56,20 @@ nsMessengerOS2Integration::nsMessengerOS2Integration()
PAG_READ | PAG_WRITE);
if (rc != NO_ERROR) {
#ifdef MOZ_OS2_HIGH_MEMORY
rc = DosAllocSharedMem(&pvObject, WARPCENTER_SHAREDMEM, sizeof(ULONG),
PAG_COMMIT | PAG_WRITE | OBJ_ANY);
if (rc != NO_ERROR) { // Did the kernel handle OBJ_ANY?
// Try again without OBJ_ANY and if the first failure was not caused
// by OBJ_ANY then we will get the same failure, else we have taken
// care of pre-FP13 systems where the kernel couldn't handle it.
rc = DosAllocSharedMem(&pvObject, WARPCENTER_SHAREDMEM, sizeof(ULONG),
PAG_COMMIT | PAG_WRITE);
}
#else
rc = DosAllocSharedMem(&pvObject, WARPCENTER_SHAREDMEM, sizeof(ULONG),
PAG_COMMIT | PAG_WRITE);
#endif
pUnreadState = (PULONG)pvObject;
}
*pUnreadState = 0;

View File

@ -38,6 +38,11 @@
*
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_OS2_HIGH_MEMORY
// os2safe.h has to be included before os2.h, needed for high mem
#include <os2safe.h>
#endif
#define INCL_PM
#define INCL_GPI
#define INCL_DOS
@ -671,9 +676,24 @@ struct MessageWindow {
return NS_ERROR_FAILURE;
ULONG ulSize = sizeof(COPYDATASTRUCT)+strlen(cmd)+1+CCHMAXPATH;
#ifdef MOZ_OS2_HIGH_MEMORY
APIRET rc = DosAllocSharedMem( &pvData, NULL, ulSize,
PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE | OBJ_ANY);
if (rc != NO_ERROR) { // Did the kernel handle OBJ_ANY?
// Try again without OBJ_ANY and if the first failure was not caused
// by OBJ_ANY then we will get the same failure, else we have taken
// care of pre-FP13 systems where the kernel couldn't handle it.
rc = DosAllocSharedMem( &pvData, NULL, ulSize,
PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE);
if (rc != NO_ERROR) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
#else
if (DosAllocSharedMem( &pvData, NULL, ulSize,
(PAG_COMMIT|PAG_READ|PAG_WRITE|OBJ_GETTABLE)))
PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE | OBJ_ANY))
return NS_ERROR_OUT_OF_MEMORY;
#endif
// We used to set dwData to zero, when we didn't send the
// working dir. Now we're using it as a version number.

View File

@ -1472,8 +1472,22 @@ nsresult RenderToDTShare( PDRAGITEM pditem, HWND hwnd)
nsresult rv;
void * pMem;
#ifdef MOZ_OS2_HIGH_MEMORY
APIRET rc = DosAllocSharedMem( &pMem, DTSHARE_NAME, 0x100000,
PAG_WRITE | PAG_READ | OBJ_ANY);
if (rc != NO_ERROR &&
rc != ERROR_ALREADY_EXISTS) { // Did the kernel handle OBJ_ANY?
// Try again without OBJ_ANY and if the first failure was not caused
// by OBJ_ANY then we will get the same failure, else we have taken
// care of pre-FP13 systems where the kernel couldn't handle it.
rc = DosAllocSharedMem( &pMem, DTSHARE_NAME, 0x100000,
PAG_WRITE | PAG_READ);
}
#else
APIRET rc = DosAllocSharedMem( &pMem, DTSHARE_NAME, 0x100000,
PAG_WRITE | PAG_READ);
#endif
if (rc == ERROR_ALREADY_EXISTS)
rc = DosGetNamedSharedMem( &pMem, DTSHARE_NAME,
PAG_WRITE | PAG_READ);

View File

@ -2113,7 +2113,14 @@ nsLocalFile::IsExecutable(PRBool *_retval)
return NS_OK;
// upper-case the extension, then see if it claims to be an executable
#ifdef MOZ_OS2_HIGH_MEMORY
// WinUpper() cannot be used because it crashes with high memory.
// strupr() does not take into account non-ASCII characters but this is
// irrelevant for the possible extensions below
strupr(ext);
#else
WinUpper(0, 0, 0, ext);
#endif
if (strcmp(ext, ".EXE") == 0 ||
strcmp(ext, ".CMD") == 0 ||
strcmp(ext, ".COM") == 0 ||

View File

@ -39,6 +39,11 @@
*
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_OS2_HIGH_MEMORY
// os2safe.h has to be included before os2.h, needed for high mem
#include <os2safe.h>
#endif
#define INCL_PM
#define INCL_GPI
#define INCL_DOS
@ -1146,8 +1151,22 @@ struct MessageWindow {
APIRET rc = NO_ERROR;
PVOID pvData = NULL;
ULONG ulSize = sizeof(COPYDATASTRUCT)+strlen(cmd)+1;
#ifdef MOZ_OS2_HIGH_MEMORY
rc = DosAllocSharedMem( &pvData, NULL, ulSize,
(PAG_COMMIT|PAG_READ|PAG_WRITE|OBJ_GETTABLE) );
PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE | OBJ_ANY);
if( rc != NO_ERROR ) // Did the kernel handle OBJ_ANY?
{
// Try again without OBJ_ANY and if the first failure was not caused
// by OBJ_ANY then we will get the same failure, else we have taken
// care of pre-FP13 systems where the kernel couldn't handle it.
rc = DosAllocSharedMem( &pvData, NULL, ulSize,
PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE);
}
#else
rc = DosAllocSharedMem( &pvData, NULL, ulSize,
PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE);
#endif
if( rc != NO_ERROR )
{

View File

@ -37,6 +37,11 @@
*
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_OS2_HIGH_MEMORY
/* os2safe.h has to be included before os2.h, needed for high mem */
#include <os2safe.h>
#endif
#include "extern.h"
#include "extra.h"
#include "parser.h"