[Vm-dev] SIZEOF_VOID_P 8 and mprotect

Eliot Miranda eliot.miranda at gmail.com
Wed Jul 9 23:56:19 UTC 2014


On Wed, Jul 9, 2014 at 4:52 PM, David T. Lewis <lewis at mail.msen.com> wrote:

>
> On Wed, Jul 09, 2014 at 11:56:59AM -0700, gettimothy wrote:
> >
> > Hi All.
> >
> >
> > Don't spend brain cycles on this, but I want to mention it in passing.
>
> Hi tty,
>
> The Cog VMs cannot be compiled in 32-bit mode, so if you are on a 64-bit
> platform the
>

I think you mean "can only be compiled in 32-bit mode".


> CFLAGS will need to specify -m32 to tell the compiler to use the 32 bit
> memory model.
>

Right.


> If you pass the right CFLAGS (with "-m32") to
> platforms/unix/cmake/configure, you will
> find that the generated config.h will have the correct type definitions.
>
> CMake takes care of the rest. But if you want to explicitly tell it to use
> a 32-bit
> memory model (required for Cog), you will want this to happen at the
> "configure" step
> so that config.h is defined properly for a 32-bit build. That is the
> reason that the
> CFLAGS are specified as an option to unix/cmake/configure, and it is the
> reason that
> config.h is generated at this point in the configure/make process.
>
> Dave
>
> >
> >
> > I am working out integrating Ian's configuration approach into the
> CMakeVMakerSqueak and ran into this interesting thing.
> >
> >
> > Ian's code on my system will detect the SIZEOF_ stuff on my system
> >
> >
> >
> > #define SIZEOF_INT 4
> >
> > #define SIZEOF_LONG 8
> > #define SIZEOF_LONG_LONG 8
> > #define SIZEOF_VOID_P 8
> >
> >
> > When I go to run the cog, I get this error.
> >
> >
> >
> > mprotect(x,y,PROT_READ | PROT_WRITE | PROT_EXEC): Cannot allocate memory
> > Segmentation fault (core dumped)
> >
> >
> >
> >
> >
> > Changing SIZEOF_VOID_P to 4 makes that problem go away and the image
> launches.
> >
> >
> > I am thinking I am going to throw a conditional in the configuration
> such that if it is a 64 bit system with 32 bit libs, to work around this.
> >
> >
> > I mention this in passing in case there is a "magic"
> > #define mprotect_will_just_work 1
> >
> > flag or something.
> >
> >
> >
> >
> > cordially,
> >
> >
> > tty
> >
> >
> >
> >
> >
> >
> >
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20140709/1d7bb98a/attachment.htm


More information about the Vm-dev mailing list