Have a boehm-gc patch for gcj/rtems
Jie Liu
lj8175 at gmail.com
Sun Jun 12 16:10:09 UTC 2011
Hi,
For Java(GCJ) being supported on RTEMS, there should be a patch on
RTEMS for boehm-gc which is a component of libgcj.
I add libgcj/boehm-gcsupp.c in cpukit directory under the guidance of
Joel, the content is:
#include <rtems.h>
void *rtems_get_stack_bottom(void)
{
return (void*)((char *)_Thread_Executing->Start.Initial_stack.area+
_Thread_Executing->Start.Initial_stack.size);
}
It should be compiled and archived to librtemscpu.a.
As Java HelloWorld compiled by cross gcj for RTEMS can be run without
problem, I think it's time to get this patch reviewed and merged. :)
Best Regards,
Jie
2011/6/12 Jie Liu <lj8175 at gmail.com>:
> Hi,
>
> Java HelloWorld compiled by cross gcj for RTEMS can run without
> problem now, I think it's time for get the boehm-gc patch reviewed and
> merged. :) Here is the patch:
>
> Index: mach_dep.c
> ===================================================================
> --- mach_dep.c (revision 172224)
> +++ mach_dep.c (working copy)
> @@ -411,7 +411,8 @@
> word dummy;
>
> # if defined(USE_GENERIC_PUSH_REGS)
> -# ifdef HAVE_BUILTIN_UNWIND_INIT
> +# if defined(HAVE_BUILTIN_UNWIND_INIT)\
> + &&!(defined(I386) && defined(RTEMS))
> /* This was suggested by Richard Henderson as the way to */
> /* force callee-save registers and register windows onto */
> /* the stack. */
> @@ -437,8 +438,8 @@
> for (; (char *)i < lim; i++) {
> *i = 0;
> }
> -# if defined(MSWIN32) || defined(MSWINCE) \
> - || defined(UTS4) || defined(LINUX) || defined(EWS4800)
> +# if defined(MSWIN32) || defined(MSWINCE) || defined(UTS4) \
> + || defined(LINUX) || defined(EWS4800) || defined(RTEMS)
> (void) setjmp(regs);
> # else
> (void) _setjmp(regs);
> Index: include/private/gcconfig.h
> ===================================================================
> --- include/private/gcconfig.h (revision 172224)
> +++ include/private/gcconfig.h (working copy)
> @@ -315,6 +315,11 @@
> # define mach_type_known
> # endif
> # endif
> +# if defined(__rtems__) && (defined(i386) || defined(__i386__))
> +# define I386
> +# define RTEMS
> +# define mach_type_known
> +# endif
> # if defined(NeXT) && defined(mc68000)
> # define M68K
> # define NEXT
> @@ -1297,6 +1302,17 @@
> # define STACKBOTTOM ((ptr_t)0xc0000000)
> # define DATAEND /* not needed */
> # endif
> +# ifdef RTEMS
> +# define OS_TYPE "RTEMS"
> +# include <sys/unistd.h>
> + extern int etext[];
> + extern int end[];
> + void *rtems_get_stack_bottom();
> +# define InitStackBottom rtems_get_stack_bottom()
> +# define DATASTART ((ptr_t)etext)
> +# define DATAEND ((ptr_t)end)
> +# define STACKBOTTOM ((ptr_t)InitStackBottom)
> +# endif
> # ifdef DOS4GW
> # define OS_TYPE "DOS4GW"
> extern long __nullarea;
> @@ -2370,7 +2386,8 @@
> # else
> # if defined(NEXT) || defined(DOS4GW) || \
> (defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) || \
> - (defined(SUNOS5) && !defined(USE_MMAP))
> + (defined(SUNOS5) && !defined(USE_MMAP)) || \
> + defined(RTEMS)
> # define GET_MEM(bytes) HBLKPTR((size_t) \
> calloc(1, (size_t)bytes
> + GC_page_size) \
> + GC_page_size-1)
> Index: configure
> ===================================================================
> --- configure (revision 172224)
> +++ configure (working copy)
> @@ -14867,6 +14867,8 @@
> $as_echo "#define _REENTRANT 1" >>confdefs.h
>
> ;;
> + rtems)
> + ;;
> decosf1 | irix | mach | os2 | dce | vxworks)
> as_fn_error "thread package $THREADS not yet supported" "$LINENO" 5
> ;;
> Index: os_dep.c
> ===================================================================
> --- os_dep.c (revision 172224)
> +++ os_dep.c (working copy)
> @@ -1507,7 +1507,7 @@
>
> # if !defined(OS2) && !defined(PCR) && !defined(AMIGA) \
> && !defined(MSWIN32) && !defined(MSWINCE) \
> - && !defined(MACOS) && !defined(DOS4GW)
> + && !defined(MACOS) && !defined(DOS4GW) && !defined(RTEMS)
>
> # ifdef SUNOS4
> extern caddr_t sbrk();
>
> Best Regards,
> Jie
>
> 2011/6/4 Jie Liu <lj8175 at gmail.com>:
>> Hi,
>>
>> I am working on porting gcj to rtems now, it's a project of GSoC2011.[1]
>> And now, the first step: boehm-gc have been ported, so I want to get
>> this patch reviewed and merged.
>>
>> And I have filed the FSF Paperwork, the patch has been attached.
>> Thank you for your time.
>>
>> Best Regards,
>> Jie
>>
>> [1]http://socghop.appspot.com/gsoc/org/google/gsoc2011/rtems
>>
>
More information about the users
mailing list