Skip to Content.
Sympa Menu

svadev - Re: [svadev] Fwd: BBC _barebone_boundscheck function

svadev AT lists.siebelschool.illinois.edu

Subject: Svadev mailing list

List archive

Re: [svadev] Fwd: BBC _barebone_boundscheck function


Chronological Thread 
  • From: John Criswell <criswell AT illinois.edu>
  • To: Baozeng <sploving1 AT gmail.com>
  • Cc: svadev AT cs.illinois.edu
  • Subject: Re: [svadev] Fwd: BBC _barebone_boundscheck function
  • Date: Fri, 25 May 2012 13:44:07 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/svadev>
  • List-id: <svadev.cs.uiuc.edu>
  • Organization: University of Illinois

On 5/24/12 9:52 AM, Baozeng wrote:

2012/5/24 Baozeng <sploving1 AT gmail.com>
Another thing, I change BBRuntime.h as the following:
#if defined(i386) || defined(__i386__)
  #define UNSET_MASK 0xbfffffff
  #define SET_MASK 0xc0000000
#else
  #define UNSET_MASK 0x7fffffffffff
  #define SET_MASK 0xffff800000000000
#endif
Then
 Dest = (Dest | SET_MASK); should works like this:
if Dest = 0x891234; then after the above statement it should be 0xc0891234. But it does not work. The result is not changed, 0x891234, why?
I use printf("SET_MASK is %d", SET_MASK); It prints
SET_MASK is 0. any suggestion?





I've realized that there's a slight problem with these values on some platforms:

1) The 64-bit values should work on any x86_64 machine, regardless of OS, because the processor doesn't even support the use of that part of the virtual address space.

2) The 32-bit values work on Linux because the kernel is typically mapped in the upper 1 GB of the address space (starting at 0xc0000000).

3) The 32-bit values don't work on Mac OS X because that part of the address space can be used (Mac OS X, unlike other systems, doesn't map the kernel memory into the address space when running in user mode).  The range 0xc0000000-0xebffffff can be used for application framework or other code, and 0xf0000000-0xfdffffff is available for thread stacks or other application use.

There are multiple solutions to that, but one would be to try to mmap() an unused region of memory like SAFECode does now.

4) The 32-bit values may not work on other operating systems (e.g., FreeBSD, Solaris, Windows), but I don't know since I haven't looked at those systems yet (and have no immediate plans to either).  If we don't know what OS we're compiling on, then we should probably use mmap() like we would on 32-bit Mac OS X if we're doing a 32-bit compile.

So, the logic would be:

if (64-bit)
    set mask value as we do now
else
    if (32-bit)
        if (Linux)
            set mask value as we do now
    else
        mmap region dynamically and use that

-- John T.




Archive powered by MHonArc 2.6.16.

Top of Page