Hi Frank,<br><br><div class="gmail_quote">On Thu, Jan 31, 2013 at 1:06 PM, Frank Shearar <span dir="ltr"><<a href="mailto:frank.shearar@gmail.com" target="_blank">frank.shearar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Eliot,<br>
<br>
What can I do to help with this? Did making that custom sqUnixMemory.c<br>
give you enough info to solve the issue, or do you need me to write<br>
that test program?<br></blockquote><div><br></div><div>I already integrated the relevant change, moving pageSize and pageMask outside of HAVE_MMAP. So you should be able to build from the Cog sources directly. Apologies for not giving feedback.</div>
<div><br></div><div>cheers!</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
frank<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 13 January 2013 13:25, Frank Shearar <<a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>> wrote:<br>
> Hi Eliot,<br>
><br>
> Given that the custom sqUnixMemory.c compiled successfully on FreeBSD,<br>
> do you have sufficient information to fix the issue, or do you still<br>
> need me to write a test program for mprotect?<br>
><br>
> frank<br>
><br>
> On 11 January 2013 18:18, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br>
>> Hi Frank,<br>
>><br>
>> from configure's output can you tell if does mprotect work? If not,<br>
>> could you write a test program to test mprotect? I expect something like<br>
>> the attached is appropriate. Let me know.<br>
>><br>
>><br>
>> On Fri, Jan 11, 2013 at 3:29 AM, Frank Shearar <<a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>><br>
>>> OK, the -E version of the source looks like this:<br>
>>><br>
>>> void<br>
>>> sqMakeMemoryExecutableFromTo(unsigned long startAddr, unsigned long<br>
>>> endAddr)<br>
>>> {<br>
>>> unsigned long firstPage = ((startAddr)&pageMask);<br>
>>> if (mprotect((void *)firstPage,<br>
>>> endAddr - firstPage + 1,<br>
>>> PROT_READ | PROT_WRITE | PROT_EXEC) < 0)<br>
>>> perror("mprotect(x,y,PROT_READ | PROT_WRITE | PROT_EXEC)");<br>
>>> }<br>
>>><br>
>>> but now I see no definition for pageMask! grepping just shows this:<br>
>>><br>
>>> $ grep pageMask foo.i<br>
>>> unsigned long firstPage = ((startAddr)&pageMask);<br>
>>> unsigned long firstPage = ((startAddr)&pageMask);<br>
>>><br>
>>> which is the problem. So I think I don't HAVE_MMAP defined. And if I<br>
>>> look very carefully at configure's output, I see this:<br>
>>><br>
>>> checking for working mmap... Segmentation fault<br>
>>> no<br>
>>><br>
>>> frank<br>
>>><br>
>>> On 10 January 2013 23:59, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br>
>>> ><br>
>>> > Hi Frank,<br>
>>> ><br>
>>> > preprocess it using -P or -E and see what you get. i.e. run the<br>
>>> > compiler with all the same flags (except -c and/or -o) but suppling either<br>
>>> > -E or -P (if -P pipe the result into foo.i). Then you can see what source<br>
>>> > the compiler is actually compiling. Then grep for pageMask in the result.<br>
>>> > Let's see what mangling is actually happening.<br>
>>> ><br>
>>> > HTH<br>
>>> ><br>
>>> ><br>
>>> > On Thu, Jan 10, 2013 at 2:21 PM, Frank Shearar <<a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>><br>
>>> > wrote:<br>
>>> >><br>
>>> >><br>
>>> >> I didn't express myself properly. pageMask occurs in a #define (line<br>
>>> >> 293), but its definition is on line 100. But what confuses me is that<br>
>>> >> since it's outside the function definition, it should surely be<br>
>>> >> visible in the function. But the error I get says that on line 298,<br>
>>> >> "error: 'pageMask' undeclared (first use in this function)".<br>
>>> >><br>
>>> >> frank<br>
>>> >><br>
>>> >> On 10 January 2013 21:43, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>><br>
>>> >> wrote:<br>
>>> >> ><br>
>>> >> > Hi Frank,<br>
>>> >> ><br>
>>> >> > where's the #define of pageMask? There shouldn't be one<br>
>>> >> > pageMask is an unsigned int. i.e.<br>
>>> >> ><br>
>>> >> > McStalker.oscogvm$ grep -n pageMask platforms/unix/vm/*<br>
>>> >> > platforms/unix/vm/sqUnixMemory.c:100:static unsigned int pageMask =<br>
>>> >> > 0;<br>
>>> >> > platforms/unix/vm/sqUnixMemory.c:102:#define valign(x) ((x) &<br>
>>> >> > pageMask)<br>
>>> >> > platforms/unix/vm/sqUnixMemory.c:123: pageMask= ~(pageSize - 1);<br>
>>> >> > platforms/unix/vm/sqUnixMemory.c:125: DPRINTF(("uxAllocateMemory:<br>
>>> >> > pageSize 0x%x (%d), mask 0x%x\n", pageSize, pageSize, pageMask));<br>
>>> >> > platforms/unix/vm/sqUnixMemory.c:178: assert(0 == (newDelta &<br>
>>> >> > ~pageMask));<br>
>>> >> > platforms/unix/vm/sqUnixMemory.c:179: assert(0 == (newSize &<br>
>>> >> > ~pageMask));<br>
>>> >> > platforms/unix/vm/sqUnixMemory.c:196: assert(0 == (heapSize &<br>
>>> >> > ~pageMask));<br>
>>> >> > platforms/unix/vm/sqUnixMemory.c:213: assert(0 == (newDelta &<br>
>>> >> > ~pageMask));<br>
>>> >> > platforms/unix/vm/sqUnixMemory.c:214: assert(0 == (newSize &<br>
>>> >> > ~pageMask));<br>
>>> >> > platforms/unix/vm/sqUnixMemory.c:231: assert(0 == (heapSize &<br>
>>> >> > ~pageMask));<br>
>>> >> > platforms/unix/vm/sqUnixMemory.c:293:# define<br>
>>> >> > roundDownToPageBoundary(v) ((v)&pageMask)<br>
>>> >> > platforms/unix/vm/sqUnixMemory.c:294:# define<br>
>>> >> > roundUpToPageBoundary(v) (((v)+pageSize-1)&pageMask)<br>
>>> >> ><br>
>>> >> ><br>
>>> >> > On Thu, Jan 10, 2013 at 1:40 PM, Frank Shearar<br>
>>> >> > <<a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>> wrote:<br>
>>> >> >><br>
>>> >> >><br>
>>> >> >> First, thanks Eliot for fixing up the UUID plugin.<br>
>>> >> >><br>
>>> >> >> With that fixed, the next error I get when compiling (32 bit) on<br>
>>> >> >> FreeBSD is this:<br>
>>> >> >><br>
>>> >> >> sqUnixMemory.c<br>
>>> >> >><br>
>>> >> >> /usr/home/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2664-unofficial-src/platforms/unix/vm/sqUnixMemory.c:<br>
>>> >> >> In function 'sqMakeMemoryExecutableFromTo':<br>
>>> >> >><br>
>>> >> >> /usr/home/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2664-unofficial-src/platforms/unix/vm/sqUnixMemory.c:298:<br>
>>> >> >> error: 'pageMask' undeclared (first use in this function)<br>
>>> >> >><br>
>>> >> >> The line number looks a bit wrong, because pageMask is in a #define<br>
>>> >> >> on<br>
>>> >> >> line 293. (Ah, it's because line 298 uses the #define.) At any rate,<br>
>>> >> >> the relevant function + context looks like this:<br>
>>> >> >><br>
>>> >> >> #if COGVM<br>
>>> >> >> # define roundDownToPageBoundary(v) ((v)&pageMask)<br>
>>> >> >> # define roundUpToPageBoundary(v) (((v)+pageSize-1)&pageMask)<br>
>>> >> >> void<br>
>>> >> >> sqMakeMemoryExecutableFromTo(unsigned long startAddr, unsigned long<br>
>>> >> >> endAddr)<br>
>>> >> >> {<br>
>>> >> >> unsigned long firstPage =<br>
>>> >> >> roundDownToPageBoundary(startAddr);<br>
>>> >> >> if (mprotect((void *)firstPage,<br>
>>> >> >> endAddr - firstPage + 1,<br>
>>> >> >> PROT_READ | PROT_WRITE | PROT_EXEC)<br>
>>> >> >> < 0)<br>
>>> >> >> perror("mprotect(x,y,PROT_READ | PROT_WRITE |<br>
>>> >> >> PROT_EXEC)");<br>
>>> >> >> }<br>
>>> >> >><br>
>>> >> >> void<br>
>>> >> >> sqMakeMemoryNotExecutableFromTo(unsigned long startAddr, unsigned<br>
>>> >> >> long endAddr)<br>
>>> >> >> {<br>
>>> >> >> unsigned long firstPage =<br>
>>> >> >> roundDownToPageBoundary(startAddr);<br>
>>> >> >> if (mprotect((void *)firstPage,<br>
>>> >> >> endAddr - firstPage + 1,<br>
>>> >> >> PROT_READ | PROT_WRITE) < 0)<br>
>>> >> >> perror("mprotect(x,y,PROT_READ | PROT_WRITE)");<br>
>>> >> >> }<br>
>>> >> >> #endif /* COGVM */<br>
>>> >> >><br>
>>> >> >> A bit confusing, given that pageMask is declared on line 100, as<br>
>>> >> >> whatever C calls a top level form. A global?<br>
>>> >> >><br>
>>> >> >> What can I do to make things work?<br>
>>> >> >><br>
>>> >> >> The full ouput's viewable here:<br>
>>> >> >> <a href="http://squeakci.org/job/CogVM-FreeBSD/13/console" target="_blank">http://squeakci.org/job/CogVM-FreeBSD/13/console</a><br>
>>> >> >><br>
>>> >> >> frank<br>
>>> >> ><br>
>>> >> ><br>
>>> >> ><br>
>>> >> ><br>
>>> >> > --<br>
>>> >> > best,<br>
>>> >> > Eliot<br>
>>> >> ><br>
>>> ><br>
>>> ><br>
>>> ><br>
>>> ><br>
>>> > --<br>
>>> > best,<br>
>>> > Eliot<br>
>>> ><br>
>><br>
>><br>
>><br>
>><br>
>> --<br>
>> best,<br>
>> Eliot<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>