0

I'm studying how to enable paging in Linux kernel but I didn't understand how the kernel can address from 8 MB to 1 GB of virtual memory. I mean, in the boot phase the kernel comes with a very minimal page table encoded into the image. This page table (pointed by swapper_pg_dir) allows you to write only the first two entries of the page table. Each entry points to a page of 4 MB. So in total the kernel can address only 8 MB of virtual memory. Then the kernel has to instore the second level of the page table in order to drive all its 1 GB of virtual memory. In order to resolve that, it must rely in some memory allocator which allow to retrieve buffers where to put the entries of the second level page table: this is the bootmem allocator.

So my question is: how can the kernel address from 8 MB to 1 GB of virtual memory?

0

I'm not sure what the question is really - it's done using the paging unit - maybe see here: https://stackoverflow.com/questions/18431261/how-does-x86-paging-work

The page directory below 896MB is still stored in swapper_pg_dir, it just gets reinitialized after that first 8MB initialization. Things get more complicated above 896MB and below 4096MB, and get further complicated above 4096MB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.