diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-09-20 14:23:50 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-09-20 14:23:50 +0000 |
commit | 7ffe51089f3bc9e5bf0fc5b8c35a24d7edadce44 (patch) | |
tree | 8719fc95b2d9beca7479d8af845bce1b20acce84 /sal/rtl/source/alloc_arena.c | |
parent | aebbb906664420feda0105bc13d2e9238952e238 (diff) |
INTEGRATION: CWS os2port01 (1.3.64); FILE MERGED
2007/08/09 09:19:02 obr 1.3.64.2: RESYNC: (1.3-1.4); FILE MERGED
2006/11/29 14:26:53 ydario 1.3.64.1: Initial OS/2 import.
Diffstat (limited to 'sal/rtl/source/alloc_arena.c')
-rw-r--r-- | sal/rtl/source/alloc_arena.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/sal/rtl/source/alloc_arena.c b/sal/rtl/source/alloc_arena.c index b3def7c5e65a..92890c3e4ad1 100644 --- a/sal/rtl/source/alloc_arena.c +++ b/sal/rtl/source/alloc_arena.c @@ -4,9 +4,9 @@ * * $RCSfile: alloc_arena.c,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: vg $ $Date: 2007-05-25 13:09:36 $ + * last change: $Author: vg $ $Date: 2007-09-20 15:23:50 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -60,6 +60,13 @@ #include <stdio.h> #endif +#include "sal/types.h" + +#ifdef OS2 +#undef OSL_TRACE +#define OSL_TRACE 1 ? ((void)0) : _OSL_GLOBAL osl_trace +#endif + /* ================================================================= * * * arena internals. @@ -1185,7 +1192,7 @@ SAL_CALL rtl_arena_free ( #if defined(SAL_UNX) #include <sys/mman.h> -#elif defined(SAL_W32) +#elif defined(SAL_W32) || defined(SAL_OS2) #define MAP_FAILED 0 #endif /* SAL_UNX || SAL_W32 */ @@ -1221,7 +1228,18 @@ SAL_CALL rtl_machdep_alloc ( addr = mmap (NULL, (size_t)(size), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); #elif defined(SAL_W32) addr = VirtualAlloc (NULL, (SIZE_T)(size), MEM_COMMIT, PAGE_READWRITE); -#endif /* (SAL_UNX || SAL_W32) */ +#elif defined(SAL_OS2) + { + APIRET rc; + addr = 0; + // Use DosAlloc* to get a 4KB page aligned address. + rc = DosAllocMem( &addr, size, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_ANY); + if (rc) { + fprintf( stderr, "sal3::DosAllocMem failed rc=%d\n", rc); + addr = 0; + } + } +#endif /* (SAL_UNX || SAL_W32 || SAL_OS2) */ if (addr != MAP_FAILED) { @@ -1254,6 +1272,8 @@ SAL_CALL rtl_machdep_free ( (void) munmap(pAddr, nSize); #elif defined(SAL_W32) (void) VirtualFree ((LPVOID)(pAddr), (SIZE_T)(0), MEM_RELEASE); +#elif defined(SAL_OS2) + (void) DosFreeMem( pAddr); #endif /* (SAL_UNX || SAL_W32) */ } @@ -1272,6 +1292,10 @@ rtl_machdep_pagesize (void) SYSTEM_INFO info; GetSystemInfo (&info); return ((sal_Size)(info.dwPageSize)); +#elif defined(SAL_OS2) + ULONG ulPageSize; + DosQuerySysInfo(QSV_PAGE_SIZE, QSV_PAGE_SIZE, &ulPageSize, sizeof(ULONG)); + return ((sal_Size)ulPageSize); #endif /* (SAL_UNX || SAL_W32) */ } |