If possible, can you point to documentation or describe the kernel space memory layout?

When a device driver instantiates a variable does that variable live in the kernel space or does it live in user space with special permissions?


The kernel space memory layout is documented in the kernel, for x86_64 at least. On many architectures, this includes a direct physical mapping, with a fixed offset which doesn’t vary over one kernel instance’s lifetime. Since the kernel code runs on the CPU, using the MMU (on MMU-equipped architectures), all the addresses referenced by running code (for variable pointers, stacks etc.) are addresses understandable by the MMU, i.e. virtual addresses, normally allocated outside the direct physical mapping.

Variables in device drivers are mapped in kernel space by default. A device driver can also make data available from user space, in a variety of ways — sysfs, procfs, mapped to user space in the vDSO...

  • As far as I know, the kernel space is split into two types of addressing - 1) logical addressing (1-to-1 mapping) and 2) kernel virtual addressing. I assume that the kernel space heap and stack use kernel virtual addressing, but that's what I'm wondering about. Thank you for the documentation links and your time!
    – holeInAce
    Mar 9 at 17:49
  • Don’t you mean physical addressing? IME “logical addressing” is a synonym with “virtual addressing”. Mar 9 at 17:53

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.