[Vm-dev] Cog FreeBSD patches

Eliot Miranda eliot.miranda at gmail.com
Mon Mar 21 17:42:31 UTC 2011


Hi David,

On Mon, Mar 21, 2011 at 6:50 AM, David Graham <dgraham at unthinkable.org>wrote:

>
> Hello,
>
> I've noticed a few emails about running Cog on FreeBSD on some of the other
> mailing lists and was wondering if it would be possible to get a few patches
> integrated into the main repository?  Sorry if I'm not following protocol
> for patch submission or style, I couldn't find any guidelines.  I'd be happy
> to resubmit if this isn't the place.
>

This'll do.  This is the place.  Thanks, but I have some reservations.


>
> With the following patches, Cog r2372 will compile and run on FreeBSD (and
> PCBSD) 8.2 i386.  I've been able to use Squeak, Pharo, and Seaside images.
>  Here is the configure line:
>
> ../../platforms/unix/config/configure CFLAGS="-g -O2 -msse2 -DNDEBUG
> -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DNOEXECINFO -DDEBUGVM=0"
> LIBS=-lpthread --without-npsqueak
>

Thanks.


>
> Here is the diff.
> Index: platforms/unix/plugins/SqueakFFIPrims/ffi-config
> ===================================================================
> --- platforms/unix/plugins/SqueakFFIPrims/ffi-config    (revision 2372)
> +++ platforms/unix/plugins/SqueakFFIPrims/ffi-config    (working copy)
> @@ -39,6 +39,7 @@
>
>  case ${abi} in
>     linux)             abi=sysv;;
> +    freebsd)           abi=sysv;;
>     darwin*)           abi=darwin;;
>     *)                 abi=libffi; lib="-lffi";;
>  esac
>

This should be irrelevant.  You should not be building the old plugin but
instead be using ReentrantFFIPlugin or ThreadedFFIPlugin.  Is this simply to
get the configure to run?  If so I'll try and excise support for the old FFI
plugin.



> Index: platforms/unix/vm/sqUnixMain.c
> ===================================================================
> --- platforms/unix/vm/sqUnixMain.c      (revision 2372)
> +++ platforms/unix/vm/sqUnixMain.c      (working copy)
> @@ -60,6 +60,9 @@
>  # include <execinfo.h>
>  # define BACKTRACE_DEPTH 64
>  #endif
> +#if __FreeBSD__
> +# include <sys/ucontext.h>
> +#endif
>
>  #if defined(__alpha__) && defined(__osf__)
>  # include <sys/sysinfo.h>
> @@ -777,6 +780,9 @@
>  # elif __linux__ && __i386__
>                        void *fp = (void *)(uap ?
> uap->uc_mcontext.gregs[REG_EBP]: 0);
>                        void *sp = (void *)(uap ?
> uap->uc_mcontext.gregs[REG_ESP]: 0);
> +# elif __FreeBSD__ && __i386__
> +                       void *fp = (void *)(uap ? uap->uc_mcontext.mc_ebp:
> 0);
> +                       void *sp = (void *)(uap ? uap->uc_mcontext.mc_esp:
> 0);
>  # else
>  #      error need to implement extracting pc from a ucontext_t on this
> system
>  # endif
>

Excellent.  Thanks.


> Index: platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c
> ===================================================================
> --- platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c        (revision
> 2372)
> +++ platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c        (working
> copy)
> @@ -10,7 +10,7 @@
>
>  *****************************************************************************/
>
>  #include <stdio.h>
> -#if !WIN32
> +#if !WIN32 && !__FreeBSD__
>  # include <alloca.h>
>  #endif
>  #include <string.h>


Great, thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20110321/87d5a67f/attachment-0001.htm


More information about the Vm-dev mailing list