Why modules start at address 0xbf000000
insmod hello.ko to start the module I built. And use
lsmod to find this module. Then I found a weird problem, I see that the module starts at address 0xbf000000. As far as I know, the kernel address starts from the 0xc0000000, and the driver module is part of the kernel. But its address is in user space. It’s weird.
By the way, it’s on the ARM platform.
The scenario where all kernel code resides at virtual address 0xc0000000 is really limited to x86, and even only when using the default configuration option of 3:1 memory address splitting between user space and the kernel.
On Arm, the virtual memory space addressing scheme is different, and the kernel loadable module maps from constant TASK_SIZE to PAGE_OFFSET-1, where PAGE_OFFSET is the address where physical memory starts directly with 1:1 mapping.
For a full look at what’s in Arm, see this document: http://www.arm.linux.org.uk/developer/memory.txt
It’s also located somewhere under the Arm subdirectory in the Linux kernel’s Documentation directory, which is a good place to find answers to such questions for other architectures 🙂