Okay, time to see our kernel module in action! Let's build and deploy it on both a Raspberry Pi 4 (running the default Raspberry Pi OS) and on an x86_64 VM (running Fedora 31).
On the Raspberry Pi 4 Model B (here running Raspberry Pi kernel version 5.4.79-v7l+), we build and then insmod(8) our lowlevel_mem_lkm kernel module. The following screenshot shows the output:
Check it out! In step 0 of the output in Figure 8.6 our show_phy_pages() library routine clearly shows that KVA 0xc000 0000 has PA 0x0, KVA 0xc000 1000 has pa 0x1000, and so on, for five pages (along with the PFN on the right); you can literally see the 1:1 identity mapping of physical RAM page frames to kernel virtual pages (in the lowmem region of the kernel segment)!
Next, the initial memory allocation with the ...