From: Carlos J. Puga Medina Date: Tue, 21 Jul 2015 06:44:41 +0000 (+0300) Subject: FreeBSD/arm support improvement X-Git-Tag: gc7_6_0~167 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d14cea44899d803c1fd7b6595068665c64d0b39;p=gc FreeBSD/arm support improvement Update the arm32 code to match arm64, powerpc and x86. * include/private/gc_priv.h: Include machine/trap.h if DATASTART_USES_BSDGETDATASTART (instead of checking for FREEBSD and particular CPUs). * include/private/gcconfig.h (ALIGNMENT, HEURISTIC2, SEARCH_FOR_DATA_START): Remove for FreeBSD/arm. * include/private/gcconfig.h (MPROTECT_VDB, SIG_SUSPEND, SIG_THR_RESTART, DATASTART, DATASTART_USES_BSDGETDATASTART): Define macro if FREEBSD and ARM32. * os_dep.c (CODE_OK): Define for FreeBSD/arm. --- diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index c9e021b3..1411b275 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -2483,13 +2483,12 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str, # define NEED_FIND_LIMIT #endif -#if defined(FREEBSD) && (defined(I386) || defined(X86_64) \ - || defined(AARCH64) || defined(POWERPC)) +#if defined(DATASTART_USES_BSDGETDATASTART) # include # if !defined(PCR) # define NEED_FIND_LIMIT # endif -#endif /* FREEBSD */ +#endif /* DATASTART_USES_BSDGETDATASTART */ #if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__) \ && !defined(NEED_FIND_LIMIT) diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index a1f497fe..73303a0f 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -2140,14 +2140,19 @@ # endif # ifdef FREEBSD /* FreeBSD/arm */ -# define ALIGNMENT 4 # define OS_TYPE "FREEBSD" +# ifndef GC_FREEBSD_THREADS +# define MPROTECT_VDB +# endif +# define SIG_SUSPEND SIGUSR1 +# define SIG_THR_RESTART SIGUSR2 +# define FREEBSD_STACKBOTTOM # ifdef __ELF__ # define DYNAMIC_LOADING # endif -# define HEURISTIC2 extern char etext[]; -# define SEARCH_FOR_DATA_START +# define DATASTART GC_FreeBSDGetDataStart(0x1000, (ptr_t)etext) +# define DATASTART_USES_BSDGETDATASTART # endif # ifdef DARWIN /* iOS */ diff --git a/os_dep.c b/os_dep.c index 2ea02813..c79058db 100644 --- a/os_dep.c +++ b/os_dep.c @@ -3060,7 +3060,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void) # ifndef SEGV_ACCERR # define SEGV_ACCERR 2 # endif -# if defined(AARCH64) +# if defined(AARCH64) || defined(ARM32) # define CODE_OK (si -> si_code == SEGV_ACCERR) # elif defined(POWERPC) # define AIM /* Pretend that we're AIM. */