I'm seeing the virtual memory implementation and I have this code:
#define INDEX_FROM_BIT(a) (a / 8*4)
#define OFFSET_FROM_BIT(a)(a % (8*4))
static void set_frame(u32int frame_addr)
{
u32int frame = frame_addr/0x1000;
u32int idx = INDEX_FROM_BIT(frame);
u32int off = OFFSET_FROM_BIT(frame);
frames[idx] |=(0x1 << off);
}
static void clear_frame(u32int frame_addr)
{
u32int frame = frame_addr/0x1000;
u32int idx = INDEX_FROM_BIT(frame);
u32int off = OFFSET_FROM_BIT(frame);
frames[idx] &= ~(0x1 << off);
}
Why is this (0x01 << off)
so used as its context for virtual memory?