Commit 70635f1e by Jakub Jelinek Committed by Tom Tromey

<<<<<<< ChangeLog

2000-04-26  Jakub Jelinek  <jakub@redhat.com>

	* gcconfig.h (SPARC): Define ALIGNMENT to 8 for 64bit SPARC.
	(SPARC/LINUX): Use GC_SysVGetDataStart instead of LINUX_DATA_START
	- sparc glibc does not provide it.
	(SAVE_CALL_CHAIN, ASM_CLEAR_CODE): Define on sparc*-linux*.
	Make STACKBOTTOM depend on the wordsize.
	* os_dep.c (GC_SysVGetDataStart): Compile in on sparc*-linux*.
	(struct frame): Declare on sparc*-linux*.
	(GC_save_callers): Bias the frame pointers if needed (sparc64).
	* mach_dep.c (GC_save_regs_in_stack): Optimize on sparc32.
	Implement on sparc64.
	(GC_clear_stack_inner): Implement on sparc64.
	* gc_priv.h (GC_test_and_set): Implement for sparc.
	* linux_threads.c (GC_suspend_handler, GC_push_all_stacks): Use

From-SVN: r33452
parent f1acc01e
<<<<<<< ChangeLog
2000-04-26 Jakub Jelinek <jakub@redhat.com>
* gcconfig.h (SPARC): Define ALIGNMENT to 8 for 64bit SPARC.
(SPARC/LINUX): Use GC_SysVGetDataStart instead of LINUX_DATA_START
- sparc glibc does not provide it.
(SAVE_CALL_CHAIN, ASM_CLEAR_CODE): Define on sparc*-linux*.
Make STACKBOTTOM depend on the wordsize.
* os_dep.c (GC_SysVGetDataStart): Compile in on sparc*-linux*.
(struct frame): Declare on sparc*-linux*.
(GC_save_callers): Bias the frame pointers if needed (sparc64).
* mach_dep.c (GC_save_regs_in_stack): Optimize on sparc32.
Implement on sparc64.
(GC_clear_stack_inner): Implement on sparc64.
* gc_priv.h (GC_test_and_set): Implement for sparc.
* linux_threads.c (GC_suspend_handler, GC_push_all_stacks): Use
GC_save_regs_in_stack on sparc.
2000-04-23 Tom Tromey <tromey@cygnus.com> 2000-04-23 Tom Tromey <tromey@cygnus.com>
* gcconfig.h (DYNAMIC_LOADING): Define for PPC Linux. * gcconfig.h (DYNAMIC_LOADING): Define for PPC Linux.
......
...@@ -74,13 +74,11 @@ CXXINCLUDES = @CXXINCLUDES@ ...@@ -74,13 +74,11 @@ CXXINCLUDES = @CXXINCLUDES@
DLLTOOL = @DLLTOOL@ DLLTOOL = @DLLTOOL@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
INCLUDES = @INCLUDES@ INCLUDES = @INCLUDES@
LD = @LD@
LIBTOOL = @LIBTOOL@ LIBTOOL = @LIBTOOL@
LN_S = @LN_S@ LN_S = @LN_S@
MAINT = @MAINT@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MY_CFLAGS = @MY_CFLAGS@ MY_CFLAGS = @MY_CFLAGS@
NM = @NM@
OBJDUMP = @OBJDUMP@ OBJDUMP = @OBJDUMP@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
......
...@@ -307,7 +307,7 @@ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ ...@@ -307,7 +307,7 @@ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|| AC_MSG_ERROR([libtool configure failed]) || AC_MSG_ERROR([libtool configure failed])
# Reload cache, that may have been modified by ltconfig # Reload cache, that may have been modified by ltconfig
...@@ -339,6 +339,11 @@ AC_REQUIRE([AC_PROG_NM])dnl ...@@ -339,6 +339,11 @@ AC_REQUIRE([AC_PROG_NM])dnl
AC_REQUIRE([AC_PROG_LN_S])dnl AC_REQUIRE([AC_PROG_LN_S])dnl
dnl dnl
case "$target" in
NONE) lt_target="$host" ;;
*) lt_target="$target" ;;
esac
# Check for any special flags to pass to ltconfig. # Check for any special flags to pass to ltconfig.
libtool_flags="--cache-file=$cache_file" libtool_flags="--cache-file=$cache_file"
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
...@@ -357,7 +362,7 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" ...@@ -357,7 +362,7 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
# Some flags need to be propagated to the compiler or linker for good # Some flags need to be propagated to the compiler or linker for good
# libtool support. # libtool support.
case "$host" in case "$lt_target" in
*-*-irix6*) *-*-irix6*)
# Find out which ABI we are using. # Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext echo '[#]line __oline__ "configure"' > conftest.$ac_ext
...@@ -573,7 +578,6 @@ else ...@@ -573,7 +578,6 @@ else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_SUBST(LD)
AC_PROG_LD_GNU AC_PROG_LD_GNU
]) ])
...@@ -619,14 +623,13 @@ else ...@@ -619,14 +623,13 @@ else
fi]) fi])
NM="$ac_cv_path_NM" NM="$ac_cv_path_NM"
AC_MSG_RESULT([$NM]) AC_MSG_RESULT([$NM])
AC_SUBST(NM)
]) ])
# AC_CHECK_LIBM - check for math library # AC_CHECK_LIBM - check for math library
AC_DEFUN(AC_CHECK_LIBM, AC_DEFUN(AC_CHECK_LIBM,
[AC_REQUIRE([AC_CANONICAL_HOST])dnl [AC_REQUIRE([AC_CANONICAL_HOST])dnl
LIBM= LIBM=
case "$host" in case "$lt_target" in
*-*-beos* | *-*-cygwin*) *-*-beos* | *-*-cygwin*)
# These system don't have libm # These system don't have libm
;; ;;
......
...@@ -439,7 +439,7 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */); ...@@ -439,7 +439,7 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
# endif # endif
# if defined(LINUX_THREADS) # if defined(LINUX_THREADS)
# if defined(I386)|| defined(POWERPC) || defined(ALPHA) || defined(IA64) \ # if defined(I386)|| defined(POWERPC) || defined(ALPHA) || defined(IA64) \
|| defined(M68K) || defined(M68K) || defined(SPARC)
# include <pthread.h> # include <pthread.h>
# define USE_SPIN_LOCK # define USE_SPIN_LOCK
# if defined(I386) # if defined(I386)
...@@ -465,6 +465,16 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */); ...@@ -465,6 +465,16 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
} }
# define GC_CLEAR_DEFINED # define GC_CLEAR_DEFINED
# endif # endif
# ifdef SPARC
inline static int GC_test_and_set(volatile unsigned int *addr) {
int oldval;
__asm__ __volatile__("ldstub %1,%0"
: "=r"(oldval), "=m"(*addr)
: "m"(*addr));
return oldval;
}
# endif
# ifdef M68K # ifdef M68K
/* Contributed by Tony Mantler. I'm not sure how well it was */ /* Contributed by Tony Mantler. I'm not sure how well it was */
/* tested. */ /* tested. */
......
...@@ -326,8 +326,8 @@ ...@@ -326,8 +326,8 @@
/* RT ==> IBM PC/RT */ /* RT ==> IBM PC/RT */
/* HP_PA ==> HP9000/700 & /800 */ /* HP_PA ==> HP9000/700 & /800 */
/* HP/UX */ /* HP/UX */
/* SPARC ==> SPARC under SunOS */ /* SPARC ==> SPARC v7/v8/v9 */
/* (SUNOS4, SUNOS5, */ /* (SUNOS4, SUNOS5, LINUX, */
/* DRSNX variants) */ /* DRSNX variants) */
/* ALPHA ==> DEC Alpha */ /* ALPHA ==> DEC Alpha */
/* (OSF1 and LINUX variants) */ /* (OSF1 and LINUX variants) */
...@@ -595,7 +595,11 @@ ...@@ -595,7 +595,11 @@
# ifdef SPARC # ifdef SPARC
# define MACH_TYPE "SPARC" # define MACH_TYPE "SPARC"
# if defined(__arch64__) || defined(__sparcv9)
# define ALIGNMENT 8
# else
# define ALIGNMENT 4 /* Required by hardware */ # define ALIGNMENT 4 /* Required by hardware */
# endif
# define ALIGN_DOUBLE # define ALIGN_DOUBLE
extern int etext; extern int etext;
# ifdef SUNOS5 # ifdef SUNOS5
...@@ -656,15 +660,22 @@ ...@@ -656,15 +660,22 @@
# ifdef LINUX # ifdef LINUX
# define OS_TYPE "LINUX" # define OS_TYPE "LINUX"
# ifdef __ELF__ # ifdef __ELF__
# define LINUX_DATA_START
# define DYNAMIC_LOADING # define DYNAMIC_LOADING
# else # else
Linux Sparc non elf ? Linux Sparc/a.out not supported
# endif # endif
extern int _etext;
extern int _end; extern int _end;
# define DATAEND (&_end) # define DATAEND (&_end)
# define SVR4 # define SVR4
# ifdef __arch64__
# define STACKBOTTOM ((ptr_t) 0x80000000000ULL)
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x100000, &_etext)
# define CPP_WORDSZ 64
# else
# define STACKBOTTOM ((ptr_t) 0xf0000000) # define STACKBOTTOM ((ptr_t) 0xf0000000)
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
# endif
# endif # endif
# ifdef OPENBSD # ifdef OPENBSD
# define OS_TYPE "OPENBSD" # define OS_TYPE "OPENBSD"
...@@ -1331,7 +1342,7 @@ ...@@ -1331,7 +1342,7 @@
/* Use setjmp based hack to mark from callee-save registers. */ /* Use setjmp based hack to mark from callee-save registers. */
# define USE_GENERIC_PUSH_REGS # define USE_GENERIC_PUSH_REGS
# endif # endif
# if defined(SPARC) && !defined(LINUX) # if defined(SPARC)
# define SAVE_CALL_CHAIN # define SAVE_CALL_CHAIN
# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */ # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
/* include assembly code to do it well. */ /* include assembly code to do it well. */
......
...@@ -152,7 +152,7 @@ static inline ptr_t GC_linux_thread_top_of_stack(void) ...@@ -152,7 +152,7 @@ static inline ptr_t GC_linux_thread_top_of_stack(void)
return tos; return tos;
} }
#ifdef IA64 #if defined(SPARC) || defined(IA64)
extern word GC_save_regs_in_stack(); extern word GC_save_regs_in_stack();
#endif #endif
...@@ -177,7 +177,11 @@ void GC_suspend_handler(int sig) ...@@ -177,7 +177,11 @@ void GC_suspend_handler(int sig)
/* of a thread which holds the allocation lock in order */ /* of a thread which holds the allocation lock in order */
/* to stop the world. Thus concurrent modification of the */ /* to stop the world. Thus concurrent modification of the */
/* data structure is impossible. */ /* data structure is impossible. */
# ifdef SPARC
me -> stack_ptr = (ptr_t)GC_save_regs_in_stack();
# else
me -> stack_ptr = (ptr_t)(&dummy); me -> stack_ptr = (ptr_t)(&dummy);
# endif
# ifdef IA64 # ifdef IA64
me -> backing_store_ptr = (ptr_t)GC_save_regs_in_stack(); me -> backing_store_ptr = (ptr_t)GC_save_regs_in_stack();
# endif # endif
...@@ -425,7 +429,11 @@ void GC_push_all_stacks() ...@@ -425,7 +429,11 @@ void GC_push_all_stacks()
for (p = GC_threads[i]; p != 0; p = p -> next) { for (p = GC_threads[i]; p != 0; p = p -> next) {
if (p -> flags & FINISHED) continue; if (p -> flags & FINISHED) continue;
if (pthread_equal(p -> id, me)) { if (pthread_equal(p -> id, me)) {
# ifdef SPARC
lo = (ptr_t)GC_save_regs_in_stack();
# else
lo = GC_approx_sp(); lo = GC_approx_sp();
# endif
IF_IA64(bs_hi = (ptr_t)GC_save_regs_in_stack();) IF_IA64(bs_hi = (ptr_t)GC_save_regs_in_stack();)
} else { } else {
lo = p -> stack_ptr; lo = p -> stack_ptr;
......
...@@ -437,10 +437,16 @@ ptr_t cold_gc_frame; ...@@ -437,10 +437,16 @@ ptr_t cold_gc_frame;
asm(" .globl _GC_save_regs_in_stack"); asm(" .globl _GC_save_regs_in_stack");
asm("_GC_save_regs_in_stack:"); asm("_GC_save_regs_in_stack:");
# endif # endif
# if defined(__arch64__) || defined(__sparcv9)
asm(" save %sp,-128,%sp");
asm(" flushw");
asm(" ret");
asm(" restore %sp,2047+128,%o0");
# else
asm(" ta 0x3 ! ST_FLUSH_WINDOWS"); asm(" ta 0x3 ! ST_FLUSH_WINDOWS");
asm(" mov %sp,%o0");
asm(" retl"); asm(" retl");
asm(" nop"); asm(" mov %sp,%o0");
#endif
# ifdef SVR4 # ifdef SVR4
asm(" .GC_save_regs_in_stack_end:"); asm(" .GC_save_regs_in_stack_end:");
asm(" .size GC_save_regs_in_stack,.GC_save_regs_in_stack_end-GC_save_regs_in_stack"); asm(" .size GC_save_regs_in_stack,.GC_save_regs_in_stack_end-GC_save_regs_in_stack");
...@@ -488,6 +494,21 @@ ptr_t cold_gc_frame; ...@@ -488,6 +494,21 @@ ptr_t cold_gc_frame;
asm("GC_clear_stack_inner:"); asm("GC_clear_stack_inner:");
asm(".type GC_save_regs_in_stack,#function"); asm(".type GC_save_regs_in_stack,#function");
# endif # endif
#if defined(__arch64__) || defined(__sparcv9)
asm("mov %sp,%o2"); /* Save sp */
asm("add %sp,2047-8,%o3"); /* p = sp+bias-8 */
asm("add %o1,-2047-192,%sp"); /* Move sp out of the way, */
/* so that traps still work. */
/* Includes some extra words */
/* so we can be sloppy below. */
asm("loop:");
asm("stx %g0,[%o3]"); /* *(long *)p = 0 */
asm("cmp %o3,%o1");
asm("bgu,pt %xcc, loop"); /* if (p > limit) goto loop */
asm("add %o3,-8,%o3"); /* p -= 8 (delay slot) */
asm("retl");
asm("mov %o2,%sp"); /* Restore sp., delay slot */
#else
asm("mov %sp,%o2"); /* Save sp */ asm("mov %sp,%o2"); /* Save sp */
asm("add %sp,-8,%o3"); /* p = sp-8 */ asm("add %sp,-8,%o3"); /* p = sp-8 */
asm("clr %g1"); /* [g0,g1] = 0 */ asm("clr %g1"); /* [g0,g1] = 0 */
...@@ -502,6 +523,7 @@ ptr_t cold_gc_frame; ...@@ -502,6 +523,7 @@ ptr_t cold_gc_frame;
asm("add %o3,-8,%o3"); /* p -= 8 (delay slot) */ asm("add %o3,-8,%o3"); /* p -= 8 (delay slot) */
asm("retl"); asm("retl");
asm("mov %o2,%sp"); /* Restore sp., delay slot */ asm("mov %o2,%sp"); /* Restore sp., delay slot */
#endif
/* First argument = %o0 = return value */ /* First argument = %o0 = return value */
# ifdef SVR4 # ifdef SVR4
asm(" .GC_clear_stack_inner_end:"); asm(" .GC_clear_stack_inner_end:");
......
...@@ -1064,7 +1064,8 @@ void GC_register_data_segments() ...@@ -1064,7 +1064,8 @@ void GC_register_data_segments()
# else # else
# if (defined(SVR4) || defined(AUX) || defined(DGUX)) && !defined(PCR) # if (defined(SVR4) || defined(AUX) || defined(DGUX) \
|| (defined(LINUX) && defined(SPARC))) && !defined(PCR)
char * GC_SysVGetDataStart(max_page_size, etext_addr) char * GC_SysVGetDataStart(max_page_size, etext_addr)
int max_page_size; int max_page_size;
int * etext_addr; int * etext_addr;
...@@ -2580,7 +2581,20 @@ struct hblk *h; ...@@ -2580,7 +2581,20 @@ struct hblk *h;
* Call stack save code for debugging. * Call stack save code for debugging.
* Should probably be in mach_dep.c, but that requires reorganization. * Should probably be in mach_dep.c, but that requires reorganization.
*/ */
#if defined(SPARC) && !defined(LINUX) #if defined(SPARC)
# if defined(LINUX)
struct frame {
long fr_local[8];
long fr_arg[6];
struct frame *fr_savfp;
long fr_savpc;
# ifndef __arch64__
char *fr_stret;
# endif
long fr_argd[6];
long fr_argx[0];
};
# else
# if defined(SUNOS4) # if defined(SUNOS4)
# include <machine/frame.h> # include <machine/frame.h>
# else # else
...@@ -2594,6 +2608,7 @@ struct hblk *h; ...@@ -2594,6 +2608,7 @@ struct hblk *h;
# endif # endif
# endif # endif
# endif # endif
# endif
# if NARGS > 6 # if NARGS > 6
--> We only know how to to get the first 6 arguments --> We only know how to to get the first 6 arguments
# endif # endif
...@@ -2610,6 +2625,12 @@ struct hblk *h; ...@@ -2610,6 +2625,12 @@ struct hblk *h;
# define FR_SAVPC fr_savpc # define FR_SAVPC fr_savpc
#endif #endif
#if defined(SPARC) && (defined(__arch64__) || defined(__sparcv9))
#define BIAS 2047
#else
#define BIAS 0
#endif
void GC_save_callers (info) void GC_save_callers (info)
struct callinfo info[NFRAMES]; struct callinfo info[NFRAMES];
{ {
...@@ -2620,8 +2641,9 @@ struct callinfo info[NFRAMES]; ...@@ -2620,8 +2641,9 @@ struct callinfo info[NFRAMES];
frame = (struct frame *) GC_save_regs_in_stack (); frame = (struct frame *) GC_save_regs_in_stack ();
for (fp = frame -> FR_SAVFP; fp != 0 && nframes < NFRAMES; for (fp = (struct frame *)((long) frame -> FR_SAVFP + BIAS);
fp = fp -> FR_SAVFP, nframes++) { fp != 0 && nframes < NFRAMES;
fp = (struct frame *)((long) fp -> FR_SAVFP + BIAS), nframes++) {
register int i; register int i;
info[nframes].ci_pc = fp->FR_SAVPC; info[nframes].ci_pc = fp->FR_SAVPC;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment