summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/private/gcconfig.h1
-rw-r--r--os_dep.c23
-rw-r--r--tools/setjmp_t.c22
3 files changed, 33 insertions, 13 deletions
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index c5cfd01c..0c711c7d 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -1438,6 +1438,7 @@ EXTERN_C_BEGIN
/* os_dep.c. OS2 actually has the right */
/* system call! */
# define DATAEND /* not needed */
+# define GETPAGESIZE() os2_getpagesize()
# endif
# ifdef MSWIN32
# define WOW64_THREAD_CONTEXT_WORKAROUND
diff --git a/os_dep.c b/os_dep.c
index 94219b23..16e0ffd8 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -689,11 +689,13 @@ struct o32_obj {
# endif /* __IBMC__ */
-# define INCL_DOSEXCEPTIONS
-# define INCL_DOSPROCESS
# define INCL_DOSERRORS
-# define INCL_DOSMODULEMGR
+# define INCL_DOSEXCEPTIONS
+# define INCL_DOSFILEMGR
# define INCL_DOSMEMMGR
+# define INCL_DOSMISC
+# define INCL_DOSMODULEMGR
+# define INCL_DOSPROCESS
# include <os2.h>
# endif /* OS/2 */
@@ -819,6 +821,21 @@ GC_INNER size_t GC_page_size = 0;
# define HAVE_GET_STACK_BASE
#else /* !MSWIN32 */
+
+# ifdef OS2
+ static int os2_getpagesize(void)
+ {
+ ULONG result[1];
+
+ if (DosQuerySysInfo(QSV_PAGE_SIZE, QSV_PAGE_SIZE,
+ (void *)result, sizeof(ULONG)) != NO_ERROR) {
+ WARN("DosQuerySysInfo failed\n", 0);
+ result[0] = 4096;
+ }
+ return (int)result[0];
+ }
+# endif /* OS2 */
+
GC_INNER void GC_setpagesize(void)
{
# ifdef ALT_PAGESIZE_USED
diff --git a/tools/setjmp_t.c b/tools/setjmp_t.c
index d3b0f1bb..106b1450 100644
--- a/tools/setjmp_t.c
+++ b/tools/setjmp_t.c
@@ -21,21 +21,23 @@
/* has no callee-save registers, then the generic code is */
/* safe, but this will not be noticed by this piece of */
/* code.) This test appears to be far from perfect. */
+
#include <stdio.h>
#include <setjmp.h>
#include <string.h>
+
#include "private/gc_priv.h"
#ifdef OS2
-/* GETPAGESIZE() is set to getpagesize() by default, but that */
-/* doesn't really exist, and the collector doesn't need it. */
-#define INCL_DOSFILEMGR
-#define INCL_DOSMISC
-#define INCL_DOSERRORS
-#include <os2.h>
-
-int getpagesize(void)
-{
+# define INCL_DOSERRORS
+# define INCL_DOSFILEMGR
+# define INCL_DOSMISC
+# include <os2.h>
+
+ /* Similar to that in os_dep.c but use fprintf() to report a failure. */
+ /* GETPAGESIZE() macro is defined to os2_getpagesize(). */
+ static int os2_getpagesize(void)
+ {
ULONG result[1];
if (DosQuerySysInfo(QSV_PAGE_SIZE, QSV_PAGE_SIZE,
@@ -44,7 +46,7 @@ int getpagesize(void)
result[0] = 4096;
}
return (int)result[0];
-}
+ }
#elif defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
static int win32_getpagesize(void)