Brian
Brian

Reputation: 1723

How to know physical memory addresses which is accessed by CPUs in the Linux kernel?

I'm trying to trace memory access patterns by some benchmark application in Linux. Ultimately, I want to know physical memory address which is accessed by CPUs in the kernel(or user) space.

Is there a simple way to get it without modification the kernel source? I hope that it is possible to hook some MMU routine in my kernel module, and then translate the virtual address to the physical address, and write the physical addresses to kernel log or something like that. Is this possible?

Is it better to use some simulator like a Qemu?

Upvotes: 2

Views: 1638

Answers (1)

peeyush
peeyush

Reputation: 2921

Yeah go for QEMU, it is best suited for your requirement. You will have to tweak QEMU code to get the translation from Virtual addressed to physical addresses. Only thing is QEMU is for research purpose so you might not be able to get the exact mapping behavior as real system will do. But still, it will fulfill your purpose to some extent.

Upvotes: 1

Related Questions