| 1 |
diff -urN gc-7.1.orig/configure.ac gc-7.1/configure.ac |
| 2 |
--- gc-7.1.orig/configure.ac 2009-10-13 18:10:14.197994841 +0200 |
| 3 |
+++ gc-7.1/configure.ac 2009-10-13 19:15:47.685992441 +0200 |
| 4 |
@@ -93,6 +93,9 @@ |
| 5 |
AC_DEFINE(GC_LINUX_THREADS) |
| 6 |
AC_DEFINE(_REENTRANT) |
| 7 |
;; |
| 8 |
+ *-*-haiku*) |
| 9 |
+ THREADDLLIBS= |
| 10 |
+ ;; |
| 11 |
*-*-aix*) |
| 12 |
AC_DEFINE(GC_AIX_THREADS) |
| 13 |
AC_DEFINE(_REENTRANT) |
| 14 |
diff -urN gc-7.1.orig/include/private/gcconfig.h gc-7.1/include/private/gcconfig.h |
| 15 |
--- gc-7.1.orig/include/private/gcconfig.h 2009-10-13 18:10:14.245991121 +0200 |
| 16 |
+++ gc-7.1/include/private/gcconfig.h 2009-10-15 18:25:16.456763560 +0200 |
| 17 |
@@ -215,6 +215,11 @@ |
| 18 |
# define BEOS |
| 19 |
# define mach_type_known |
| 20 |
# endif |
| 21 |
+# if defined(__HAIKU__) && defined(_X86_) |
| 22 |
+# define I386 |
| 23 |
+# define HAIKU |
| 24 |
+# define mach_type_known |
| 25 |
+# endif |
| 26 |
# if defined(LINUX) && (defined(i386) || defined(__i386__)) |
| 27 |
# define I386 |
| 28 |
# define mach_type_known |
| 29 |
@@ -1016,6 +1021,13 @@ |
| 30 |
extern int etext[]; |
| 31 |
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) |
| 32 |
# endif |
| 33 |
+# ifdef HAIKU |
| 34 |
+# define OS_TYPE "HAIKU" |
| 35 |
+# include <OS.h> |
| 36 |
+# define GETPAGESIZE() B_PAGE_SIZE |
| 37 |
+ extern int etext[]; |
| 38 |
+# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) |
| 39 |
+# endif |
| 40 |
# ifdef SOLARIS |
| 41 |
# define OS_TYPE "SOLARIS" |
| 42 |
extern int _etext[], _end[]; |
| 43 |
diff -urN gc-7.1.orig/os_dep.c gc-7.1/os_dep.c |
| 44 |
--- gc-7.1.orig/os_dep.c 2009-10-13 18:10:14.177995852 +0200 |
| 45 |
+++ gc-7.1/os_dep.c 2009-10-15 19:33:33.120764577 +0200 |
| 46 |
@@ -776,14 +776,14 @@ |
| 47 |
|
| 48 |
# endif /* MS Windows */ |
| 49 |
|
| 50 |
-# ifdef BEOS |
| 51 |
+# if defined(BEOS) || defined(HAIKU) |
| 52 |
# include <kernel/OS.h> |
| 53 |
ptr_t GC_get_main_stack_base(void){ |
| 54 |
thread_info th; |
| 55 |
get_thread_info(find_thread(NULL),&th); |
| 56 |
return th.stack_end; |
| 57 |
} |
| 58 |
-# endif /* BEOS */ |
| 59 |
+# endif /* BEOS or HAIKU*/ |
| 60 |
|
| 61 |
|
| 62 |
# ifdef OS2 |
| 63 |
@@ -1104,7 +1104,7 @@ |
| 64 |
|
| 65 |
#endif /* FREEBSD_STACKBOTTOM */ |
| 66 |
|
| 67 |
-#if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \ |
| 68 |
+#if !defined(BEOS) && !defined(HAIKU) && !defined(AMIGA) && !defined(MSWIN32) \ |
| 69 |
&& !defined(MSWINCE) && !defined(OS2) && !defined(NOSYS) && !defined(ECOS) \ |
| 70 |
&& !defined(CYGWIN32) |
| 71 |
|
| 72 |
@@ -1163,7 +1163,7 @@ |
| 73 |
# endif /* STACKBOTTOM */ |
| 74 |
} |
| 75 |
|
| 76 |
-# endif /* ! AMIGA, !OS 2, ! MS Windows, !BEOS, !NOSYS, !ECOS */ |
| 77 |
+# endif /* ! AMIGA, !OS 2, ! MS Windows, !BEOS, !HAIKU, !NOSYS, !ECOS */ |
| 78 |
|
| 79 |
#if defined(GC_LINUX_THREADS) && !defined(HAVE_GET_STACK_BASE) |
| 80 |
|
| 81 |
@@ -1872,7 +1872,13 @@ |
| 82 |
|
| 83 |
ptr_t GC_unix_get_mem(word bytes) |
| 84 |
{ |
| 85 |
+#ifdef HAIKU |
| 86 |
+ void *memptr; |
| 87 |
+ int rt = posix_memalign(&memptr, GC_page_size, bytes); |
| 88 |
+ return memptr; |
| 89 |
+#else |
| 90 |
return GC_unix_sbrk_get_mem(bytes); |
| 91 |
+#endif |
| 92 |
} |
| 93 |
|
| 94 |
#endif |