<div dir="ltr">Hi Frank,<div><br></div><div> preprocess it using -P or -E and see what you get. i.e. run the compiler with all the same flags (except -c and/or -o) but suppling either -E or -P (if -P pipe the result into foo.i). Then you can see what source the compiler is actually compiling. Then grep for pageMask in the result. Let's see what mangling is actually happening.</div>
<div><br></div><div>HTH</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 10, 2013 at 2:21 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"><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>
<span class="HOEnZb"><font color="#888888"><br>
frank<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 10 January 2013 21:43, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br>
><br>
> Hi Frank,<br>
><br>
> where's the #define of pageMask? There shouldn't be one 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 = 0;<br>
> platforms/unix/vm/sqUnixMemory.c:102:#define valign(x) ((x) & pageMask)<br>
> platforms/unix/vm/sqUnixMemory.c:123: pageMask= ~(pageSize - 1);<br>
> platforms/unix/vm/sqUnixMemory.c:125: DPRINTF(("uxAllocateMemory: pageSize 0x%x (%d), mask 0x%x\n", pageSize, pageSize, pageMask));<br>
> platforms/unix/vm/sqUnixMemory.c:178: assert(0 == (newDelta & ~pageMask));<br>
> platforms/unix/vm/sqUnixMemory.c:179: assert(0 == (newSize & ~pageMask));<br>
> platforms/unix/vm/sqUnixMemory.c:196: assert(0 == (heapSize & ~pageMask));<br>
> platforms/unix/vm/sqUnixMemory.c:213: assert(0 == (newDelta & ~pageMask));<br>
> platforms/unix/vm/sqUnixMemory.c:214: assert(0 == (newSize & ~pageMask));<br>
> platforms/unix/vm/sqUnixMemory.c:231: assert(0 == (heapSize & ~pageMask));<br>
> platforms/unix/vm/sqUnixMemory.c:293:# define roundDownToPageBoundary(v) ((v)&pageMask)<br>
> platforms/unix/vm/sqUnixMemory.c:294:# define roundUpToPageBoundary(v) (((v)+pageSize-1)&pageMask)<br>
><br>
><br>
> On Thu, Jan 10, 2013 at 1:40 PM, Frank Shearar <<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>
>> /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>
>> /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 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 endAddr)<br>
>> {<br>
>> unsigned long firstPage = roundDownToPageBoundary(startAddr);<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>
>> void<br>
>> sqMakeMemoryNotExecutableFromTo(unsigned long startAddr, unsigned long endAddr)<br>
>> {<br>
>> unsigned long firstPage = 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: <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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div>