kernelvirtual-memorypage-tablesaddressing

Do modern computer systems (x86 architecture) have virtual adressing independent of the OS?


Sorry if this question sounds a little confused or jumbled, but I feel quite a bit of confunsion over this concept.

What Im wondering is, if I were to write a kernel for "bare" computer hardware in C/ Assembly, would I be able to use virtual adressing? Ive been looking at source code for kernels, and it appears to use virtual adressing, but how is this possible? Isnt the page table something implemented by the OS?

Thanks for any help


Solution

  • "Modern architectures" have an MMU, but small controllers e.g. Arduino do not. If you look at the Linux kernel sources, it has implementations for both MMU and no-MMU architectures.

    There's code to specifically set up the page tables and address the page-faults arising from pages being in the swap area. This code may not be swapped out, and IIRC Linux never swaps itself out anyway, and so its own memory always remains in the page tables, thereby allowing the kernel space to run in virtual memory as well.