Skip to content
  • Charlie Jacobsen's avatar
    static-cptr-cache: Changes cptr cache defs to use statically alloc'd bmaps. · 48ee0d11
    Charlie Jacobsen authored
    That is, the bitmaps are now arrays inside the cptr cache, rather
    than pointers. We need this for LCDs because the cptr cache needs
    to be up and running before we even initialize the page allocator
    and malloc.
    
    I need to tweak the code slightly next.
    
    Note: I considered using a packed struct for cptr's, with char
    fields. But I realized the allocation algorithm would become a little
    less efficient, due to extra required calculations. The advantage of
    the current algorithm is that, because the cnode table size is
    a power of 2 *and* the bits are packed (they would no longer be
    packed if we used chars, unless the cnode table size was 512), translating
    a bitmap index to a path in the cspace radix tree is really simple.
    If we switched to a struct with char's, such as:
    
        struct cptr {
           char level;
           char path[CAP_CSPACE_DEPTH];
           char slot;
        };
    
    we would need to do a handful of bit shifts and masks to set up
    these fields properly. (For the current algorithm, there's just
    one bitwise OR to set the level bits.)
    
    I also realized the bit-level ops we currently use are not that
    bad/obscure. We just sacrifice a slight amount of clarity.
    48ee0d11