[Vm-dev] Compiling Cog on FreeBSD

Frank Shearar frank.shearar at gmail.com
Thu Jan 10 22:21:01 UTC 2013


I didn't express myself properly. pageMask occurs in a #define (line
293), but its definition is on line 100. But what confuses me is that
since it's outside the function definition, it should surely be
visible in the function. But the error I get says that on line 298,
"error: 'pageMask' undeclared (first use in this function)".

frank

On 10 January 2013 21:43, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>
> Hi Frank,
>
>     where's the #define of pageMask?  There shouldn't be one  pageMask is an unsigned int.  i.e.
>
> McStalker.oscogvm$ grep -n pageMask platforms/unix/vm/*
> platforms/unix/vm/sqUnixMemory.c:100:static unsigned int pageMask = 0;
> platforms/unix/vm/sqUnixMemory.c:102:#define valign(x)  ((x) & pageMask)
> platforms/unix/vm/sqUnixMemory.c:123:  pageMask= ~(pageSize - 1);
> platforms/unix/vm/sqUnixMemory.c:125:  DPRINTF(("uxAllocateMemory: pageSize 0x%x (%d), mask 0x%x\n", pageSize, pageSize, pageMask));
> platforms/unix/vm/sqUnixMemory.c:178:      assert(0 == (newDelta & ~pageMask));
> platforms/unix/vm/sqUnixMemory.c:179:      assert(0 == (newSize  & ~pageMask));
> platforms/unix/vm/sqUnixMemory.c:196:     assert(0 == (heapSize  & ~pageMask));
> platforms/unix/vm/sqUnixMemory.c:213:      assert(0 == (newDelta & ~pageMask));
> platforms/unix/vm/sqUnixMemory.c:214:      assert(0 == (newSize  & ~pageMask));
> platforms/unix/vm/sqUnixMemory.c:231:     assert(0 == (heapSize  & ~pageMask));
> platforms/unix/vm/sqUnixMemory.c:293:# define roundDownToPageBoundary(v) ((v)&pageMask)
> platforms/unix/vm/sqUnixMemory.c:294:# define roundUpToPageBoundary(v) (((v)+pageSize-1)&pageMask)
>
>
> On Thu, Jan 10, 2013 at 1:40 PM, Frank Shearar <frank.shearar at gmail.com> wrote:
>>
>>
>> First, thanks Eliot for fixing up the UUID plugin.
>>
>> With that fixed, the next error I get when compiling (32 bit) on
>> FreeBSD is this:
>>
>> sqUnixMemory.c
>> /usr/home/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2664-unofficial-src/platforms/unix/vm/sqUnixMemory.c:
>> In function 'sqMakeMemoryExecutableFromTo':
>> /usr/home/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2664-unofficial-src/platforms/unix/vm/sqUnixMemory.c:298:
>> error: 'pageMask' undeclared (first use in this function)
>>
>> The line number looks a bit wrong, because pageMask is in a #define on
>> line 293. (Ah, it's because line 298 uses the #define.) At any rate,
>> the relevant function + context looks like this:
>>
>> #if COGVM
>> # define roundDownToPageBoundary(v) ((v)&pageMask)
>> # define roundUpToPageBoundary(v) (((v)+pageSize-1)&pageMask)
>> void
>> sqMakeMemoryExecutableFromTo(unsigned long startAddr, unsigned long endAddr)
>> {
>>         unsigned long firstPage = roundDownToPageBoundary(startAddr);
>>         if (mprotect((void *)firstPage,
>>                                  endAddr - firstPage + 1,
>>                                  PROT_READ | PROT_WRITE | PROT_EXEC) < 0)
>>                 perror("mprotect(x,y,PROT_READ | PROT_WRITE | PROT_EXEC)");
>> }
>>
>> void
>> sqMakeMemoryNotExecutableFromTo(unsigned long startAddr, unsigned long endAddr)
>> {
>>         unsigned long firstPage = roundDownToPageBoundary(startAddr);
>>         if (mprotect((void *)firstPage,
>>                                  endAddr - firstPage + 1,
>>                                  PROT_READ | PROT_WRITE) < 0)
>>                 perror("mprotect(x,y,PROT_READ | PROT_WRITE)");
>> }
>> #endif /* COGVM */
>>
>> A bit confusing, given that pageMask is declared on line 100, as
>> whatever C calls a top level form. A global?
>>
>> What can I do to make things work?
>>
>> The full ouput's viewable here: http://squeakci.org/job/CogVM-FreeBSD/13/console
>>
>> frank
>
>
>
>
> --
> best,
> Eliot
>


More information about the Vm-dev mailing list