This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
RE: Patch: gc changes for embedded target
- To: "'green at cygnus dot com'" <green at cygnus dot com>, "Boehm, Hans" <hans_boehm at hp dot com>, java-patches at gcc dot gnu dot org
- Subject: RE: Patch: gc changes for embedded target
- From: "Boehm, Hans" <hans_boehm at hp dot com>
- Date: Mon, 12 Nov 2001 11:23:10 -0800
Anthony -
Is XSCALE really different from ARM32, which is already treated as a
architecture by gcconfig.h? Intel's page makes it sounds like it's an
implementation of some flavor of the ARM instructions set? (If they're the
same, I would like to see them merged.)
Some of the ECOS or NOSYS conditional compilation seems redundant. (It was
already that way, and I think Tom and I agreed that some of it should
disappear.) Notably, in os_dep.c, NEED_FIND_LIMIT should presumably not be
defined for ECOS or NOSYS. And UNIX_LIKE is not defined. Thus testing for
ECOS and NOSYS inside a "#ifdef NEED_FIND_LIMIT" is/should be redundant.
(Or is NEED_FIND_LIMIT erroneously getting set?) This should be fixed
either now or later, since it's a point of divergence between my tree and
the gcc one.
Other than that, this looks good to me.
Hans
> -----Original Message-----
> From: Anthony Green [mailto:green@redhat.com]
> Sent: Sunday, November 11, 2001 9:06 AM
> To: hans_boehm@hp.com; java-patches@gcc.gnu.org
> Subject: Patch: gc changes for embedded target
>
>
>
> This patch adds two things to the collector:
>
> * Support for bare boards (no OS), using a library like newlib.
> Define "NOSYS" in this case.
> * Bare board Xscale support.
>
> This patch, combined with:
>
> http://gcc.gnu.org/ml/java-patches/2001-q4/msg00213.html
> http://sources.redhat.com/ml/newlib/2001/msg00578.html
> http://sources.redhat.com/ml/binutils/2001-11/msg00283.html
>
> Let you do:
>
> $ xscale-elf-gcj -o hw --main=hw hw.java
> $ xscale-elf-run hw
> Hello World!
>
>
> I've had this working before, but never took the time to get all of
> the patches in. Time to do it now that it's working again.
>
>
> 2001-11-11 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.
> * 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: include/private/gcconfig.h
> ===================================================================
> RCS file: /cvs/gcc/gcc/boehm-gc/include/private/gcconfig.h,v
> retrieving revision 1.7
> diff -c -r1.7 gcconfig.h
> *** gcconfig.h 2001/10/17 04:55:30 1.7
> --- gcconfig.h 2001/11/11 16:53:06
> ***************
> *** 39,44 ****
> --- 39,51 ----
> # endif
>
> /* Determine the machine type: */
> + # if defined(__XSCALE__)
> + # define XSCALE
> + # if !defined(LINUX)
> + # define NOSYS
> + # define mach_type_known
> + # endif
> + # endif
> # if defined(sun) && defined(mc68000)
> # define M68K
> # define SUNOS4
> ***************
> *** 1509,1514 ****
> --- 1516,1533 ----
> # define OS_TYPE "MSWINCE"
> # define ALIGNMENT 4
> # define DATAEND /* not needed */
> + # endif
> +
> + # if defined(XSCALE) && defined(NOSYS)
> + # define MACH_TYPE "XSCALE"
> + /* __data_start is usually defined in the target linker
> script. */
> + extern int __data_start;
> + # define DATASTART (ptr_t)(&__data_start)
> + # define ALIGNMENT 4
> + # 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
>
> #ifdef LINUX_DATA_START
>
> Index: misc.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/boehm-gc/misc.c,v
> retrieving revision 1.18
> diff -c -r1.18 misc.c
> *** misc.c 2001/10/16 09:01:35 1.18
> --- misc.c 2001/11/11 16:53:03
> ***************
> *** 69,75 ****
> # endif
> # endif
>
> ! #ifdef ECOS
> #undef STACKBASE
> #endif
>
> --- 69,75 ----
> # endif
> # endif
>
> ! #if defined(NOSYS) || defined(ECOS)
> #undef STACKBASE
> #endif
>
> ***************
> *** 739,745 ****
> # endif
> #endif
>
> ! #if !defined(MSWIN32) && !defined(MSWINCE) && !defined(OS2)
> && !defined(MACOS)
> int GC_write(fd, buf, len)
> int fd;
> GC_CONST char *buf;
> --- 739,746 ----
> # 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;
> ***************
> *** 762,771 ****
> }
> #endif /* UN*X */
>
> ! #if defined(ECOS)
> int GC_write(fd, buf, len)
> {
> _Jv_diag_write (buf, len);
> return len;
> }
> #endif
> --- 763,780 ----
> }
> #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: 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 2001/11/11 16:53:05
> ***************
> *** 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,524 ----
> # undef GC_AMIGA_SB
> # endif /* AMIGA */
>
> ! # if defined(NEED_FIND_LIMIT) \
> ! || (defined(UNIX_LIKE) && !defined(NOSYS) && !defined(ECOS))
>
> # ifdef __STDC__
> typedef void (*handler)(int);
> ***************
> *** 541,546 ****
> --- 543,549 ----
> # endif
> {
> # ifndef ECOS
> + # ifndef NOSYS
> # if defined(SUNOS5SIGS) || defined(IRIX5) \
> || defined(OSF1) || defined(HURD)
> struct sigaction act;
> ***************
> *** 579,584 ****
> --- 582,588 ----
> old_bus_handler = signal(SIGBUS, h);
> # endif
> # endif
> + # endif /* NOSYS */
> # endif /* ECOS */
> }
> # endif /* NEED_FIND_LIMIT || UNIX_LIKE */
> ***************
> *** 602,608 ****
>
> void GC_reset_fault_handler()
> {
> ! # ifndef ECOS
> # if defined(SUNOS5SIGS) || defined(IRIX5) \
> || defined(OSF1) || defined(HURD)
> (void) sigaction(SIGSEGV, &old_segv_act, 0);
> --- 606,612 ----
>
> void GC_reset_fault_handler()
> {
> ! # if !defined(NOSYS) && !defined(ECOS)
> # if defined(SUNOS5SIGS) || defined(IRIX5) \
> || defined(OSF1) || defined(HURD)
> (void) sigaction(SIGSEGV, &old_segv_act, 0);
> ***************
> *** 616,622 ****
> (void) signal(SIGBUS, old_bus_handler);
> # endif
> # endif
> ! # endif /* ECOS */
> }
>
> /* Return the first nonaddressible location > p (up) or
> */
> --- 620,626 ----
> (void) signal(SIGBUS, old_bus_handler);
> # endif
> # endif
> ! # endif /* NOSYS ECOS */
> }
>
> /* Return the first nonaddressible location > p (up) or
> */
> ***************
> *** 625,631 ****
> 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 */
> --- 629,635 ----
> ptr_t p;
> GC_bool up;
> {
> ! # if !defined(ECOS) && !defined(NOSYS)
> static VOLATILE ptr_t result;
> /* Needs to be static, since otherwise
> it may not be */
> /* preserved across the longjmp. Can
> safely be */
> ***************
> *** 651,664 ****
> result += MIN_PAGE_SIZE;
> }
> return(result);
> ! # else /* ECOS */
> abort();
> ! # endif /* ECOS */
> }
> # endif
>
> ! # ifndef ECOS
>
> #ifdef LINUX_STACKBOTTOM
>
> #include <sys/types.h>
> --- 655,674 ----
> result += MIN_PAGE_SIZE;
> }
> return(result);
> ! # else /* NOSYS ECOS */
> abort();
> ! # endif /* NOSYS ECOS */
> }
> # endif
>
> ! # if defined(ECOS) || defined(NOSYS)
> ! ptr_t GC_get_stack_base()
> ! {
> ! return STACKBOTTOM;
> ! }
>
> + #else
> +
> #ifdef LINUX_STACKBOTTOM
>
> #include <sys/types.h>
> ***************
> *** 761,767 ****
> #endif /* FREEBSD_STACKBOTTOM */
>
> #if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \
> ! && !defined(MSWINCE) && !defined(OS2) && !defined(ECOS)
>
> ptr_t GC_get_stack_base()
> {
> --- 771,777 ----
> #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 */
>
> --- 825,831 ----
> return(result);
> # endif /* STACKBOTTOM */
> }
> ! # endif /* NOSYS ECOS */
>
> # endif /* ! AMIGA, !OS 2, ! MS Windows, !BEOS */
>
>