This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: revised gc changes for embedded target
- From: Anthony Green <green at cygnus dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Fri, 8 Feb 2002 06:41:27 -0800 (PST)
- Subject: Patch: revised gc changes for embedded target
Here's my revised patch from November. It takes into account Hans'
comments made here:
http://gcc.gnu.org/ml/java-patches/2001-q4/msg00226.html
Ok?
2001-02-08 Anthony Green <green@redhat.com>
* include/private/gcconfig.h: Add XSCALE NOSYS support for bare
board embedded targets.
* os_dep.c: Avoid signal handling code for NOSYS/ECOS targets.
Use GC_get_stack_base for NOSYS/ECOS targets. Clean up some
redundant uses of ECOS.
* misc.c: Use NOSYS where ECOS is being used.
Don't define GC_write twice for ECOS systems.
(GC_write): New function for NOSYS targets.
Index: boehm-gc/misc.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/misc.c,v
retrieving revision 1.19
diff -c -r1.19 misc.c
*** misc.c 2002/02/07 03:56:40 1.19
--- misc.c 2002/02/08 14:32:02
***************
*** 69,75 ****
# endif
# endif
! #ifdef ECOS
#undef STACKBASE
#endif
--- 69,75 ----
# endif
# endif
! #if defined(NOSYS) || defined(ECOS)
#undef STACKBASE
#endif
***************
*** 744,750 ****
# endif
#endif
! #if !defined(MSWIN32) && !defined(MSWINCE) && !defined(OS2) && !defined(MACOS)
int GC_write(fd, buf, len)
int fd;
GC_CONST char *buf;
--- 744,751 ----
# endif
#endif
! #if !defined(MSWIN32) && !defined(MSWINCE) && !defined(OS2) \
! && !defined(MACOS) && !defined(ECOS) && !defined(NOSYS)
int GC_write(fd, buf, len)
int fd;
GC_CONST char *buf;
***************
*** 767,776 ****
}
#endif /* UN*X */
! #if defined(ECOS)
int GC_write(fd, buf, len)
{
_Jv_diag_write (buf, len);
return len;
}
#endif
--- 768,785 ----
}
#endif /* UN*X */
! #ifdef ECOS
int GC_write(fd, buf, len)
{
_Jv_diag_write (buf, len);
+ return len;
+ }
+ #endif
+
+ #ifdef NOSYS
+ int GC_write(fd, buf, len)
+ {
+ /* No writing. */
return len;
}
#endif
Index: boehm-gc/os_dep.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/os_dep.c,v
retrieving revision 1.19
diff -c -r1.19 os_dep.c
*** os_dep.c 2001/10/16 09:01:35 1.19
--- os_dep.c 2002/02/08 14:32:04
***************
*** 333,339 ****
# if !defined(PCR) && !defined(AMIGA) && !defined(MSWIN32) \
&& !defined(MSWINCE) \
! && !defined(MACOS) && !defined(DJGPP) && !defined(DOS4GW)
# if defined(sigmask) && !defined(UTS4) && !defined(HURD)
/* Use the traditional BSD interface */
--- 333,340 ----
# if !defined(PCR) && !defined(AMIGA) && !defined(MSWIN32) \
&& !defined(MSWINCE) \
! && !defined(MACOS) && !defined(DJGPP) && !defined(DOS4GW) \
! && !defined(NOSYS) && !defined(ECOS)
# if defined(sigmask) && !defined(UTS4) && !defined(HURD)
/* Use the traditional BSD interface */
***************
*** 516,522 ****
# undef GC_AMIGA_SB
# endif /* AMIGA */
! # if defined(NEED_FIND_LIMIT) || (defined(UNIX_LIKE) && !defined(ECOS))
# ifdef __STDC__
typedef void (*handler)(int);
--- 517,523 ----
# undef GC_AMIGA_SB
# endif /* AMIGA */
! # if defined(NEED_FIND_LIMIT) || defined(UNIX_LIKE)
# ifdef __STDC__
typedef void (*handler)(int);
***************
*** 540,547 ****
handler h;
# endif
{
! # ifndef ECOS
! # if defined(SUNOS5SIGS) || defined(IRIX5) \
|| defined(OSF1) || defined(HURD)
struct sigaction act;
--- 541,547 ----
handler h;
# endif
{
! # if defined(SUNOS5SIGS) || defined(IRIX5) \
|| defined(OSF1) || defined(HURD)
struct sigaction act;
***************
*** 579,585 ****
old_bus_handler = signal(SIGBUS, h);
# endif
# endif
- # endif /* ECOS */
}
# endif /* NEED_FIND_LIMIT || UNIX_LIKE */
--- 579,584 ----
***************
*** 602,622 ****
void GC_reset_fault_handler()
{
! # ifndef ECOS
! # if defined(SUNOS5SIGS) || defined(IRIX5) \
! || defined(OSF1) || defined(HURD)
! (void) sigaction(SIGSEGV, &old_segv_act, 0);
! # if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
! || defined(HPUX) || defined(HURD)
! (void) sigaction(SIGBUS, &old_bus_act, 0);
! # endif
! # else
! (void) signal(SIGSEGV, old_segv_handler);
! # ifdef SIGBUS
! (void) signal(SIGBUS, old_bus_handler);
! # endif
! # endif
! # endif /* ECOS */
}
/* Return the first nonaddressible location > p (up) or */
--- 601,619 ----
void GC_reset_fault_handler()
{
! # if defined(SUNOS5SIGS) || defined(IRIX5) \
! || defined(OSF1) || defined(HURD)
! (void) sigaction(SIGSEGV, &old_segv_act, 0);
! # if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
! || defined(HPUX) || defined(HURD)
! (void) sigaction(SIGBUS, &old_bus_act, 0);
! # endif
! # else
! (void) signal(SIGSEGV, old_segv_handler);
! # ifdef SIGBUS
! (void) signal(SIGBUS, old_bus_handler);
! # endif
! # endif
}
/* Return the first nonaddressible location > p (up) or */
***************
*** 625,663 ****
ptr_t p;
GC_bool up;
{
! # ifndef ECOS
! static VOLATILE ptr_t result;
! /* Needs to be static, since otherwise it may not be */
! /* preserved across the longjmp. Can safely be */
! /* static since it's only called once, with the */
! /* allocation lock held. */
!
!
! GC_setup_temporary_fault_handler();
! if (setjmp(GC_jmp_buf) == 0) {
! result = (ptr_t)(((word)(p))
! & ~(MIN_PAGE_SIZE-1));
! for (;;) {
! if (up) {
! result += MIN_PAGE_SIZE;
! } else {
! result -= MIN_PAGE_SIZE;
! }
! GC_noop1((word)(*result));
! }
! }
! GC_reset_fault_handler();
! if (!up) {
result += MIN_PAGE_SIZE;
! }
! return(result);
! # else /* ECOS */
! abort();
! # endif /* ECOS */
}
# endif
! # ifndef ECOS
#ifdef LINUX_STACKBOTTOM
--- 622,662 ----
ptr_t p;
GC_bool up;
{
! static VOLATILE ptr_t result;
! /* Needs to be static, since otherwise it may not be */
! /* preserved across the longjmp. Can safely be */
! /* static since it's only called once, with the */
! /* allocation lock held. */
!
!
! GC_setup_temporary_fault_handler();
! if (setjmp(GC_jmp_buf) == 0) {
! result = (ptr_t)(((word)(p))
! & ~(MIN_PAGE_SIZE-1));
! for (;;) {
! if (up) {
result += MIN_PAGE_SIZE;
! } else {
! result -= MIN_PAGE_SIZE;
! }
! GC_noop1((word)(*result));
! }
! }
! GC_reset_fault_handler();
! if (!up) {
! result += MIN_PAGE_SIZE;
! }
! return(result);
}
# endif
+
+ # if defined(ECOS) || defined(NOSYS)
+ ptr_t GC_get_stack_base()
+ {
+ return STACKBOTTOM;
+ }
! #else
#ifdef LINUX_STACKBOTTOM
***************
*** 761,767 ****
#endif /* FREEBSD_STACKBOTTOM */
#if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \
! && !defined(MSWINCE) && !defined(OS2) && !defined(ECOS)
ptr_t GC_get_stack_base()
{
--- 760,766 ----
#endif /* FREEBSD_STACKBOTTOM */
#if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \
! && !defined(MSWINCE) && !defined(OS2)
ptr_t GC_get_stack_base()
{
***************
*** 815,821 ****
return(result);
# endif /* STACKBOTTOM */
}
! # endif /* ECOS */
# endif /* ! AMIGA, !OS 2, ! MS Windows, !BEOS */
--- 814,820 ----
return(result);
# endif /* STACKBOTTOM */
}
! # endif /* NOSYS ECOS */
# endif /* ! AMIGA, !OS 2, ! MS Windows, !BEOS */
Index: boehm-gc/include/private/gcconfig.h
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/include/private/gcconfig.h,v
retrieving revision 1.9
diff -c -r1.9 gcconfig.h
*** gcconfig.h 2002/01/25 18:06:24 1.9
--- gcconfig.h 2002/02/08 14:32:05
***************
*** 39,44 ****
--- 39,51 ----
# endif
/* Determine the machine type: */
+ # if defined(__XSCALE__)
+ # define ARM32
+ # if !defined(LINUX)
+ # define NOSYS
+ # define mach_type_known
+ # endif
+ # endif
# if defined(sun) && defined(mc68000)
# define M68K
# define SUNOS4
***************
*** 1494,1499 ****
--- 1501,1515 ----
# ifdef MSWINCE
# define OS_TYPE "MSWINCE"
# define DATAEND /* not needed */
+ # endif
+ # ifdef NOSYS
+ /* __data_start is usually defined in the target linker script. */
+ extern int __data_start;
+ # define DATASTART (ptr_t)(&__data_start)
+ # define USE_GENERIC_PUSH_REGS
+ /* __stack_base__ is set in newlib/libc/sys/arm/crt0.S */
+ extern void *__stack_base__;
+ # define STACKBOTTOM ((ptr_t) (__stack_base__))
# endif
#endif
AG