Reading /dev/mem by dd
Quoted 5 lines · Alan Cox
Quoted 1 line
Is that the only valid use of
/dev/mem, or even its main use?These days it is the primary use. Things like X11 were historically probably the biggest user of it, and things like LRMI sometimes need that sort of stuff.
how does X11 get now direct access to the physical memory (instead of /dev/mem) ?
Quoted 9 lines · Nameer Yarkon
Quoted 5 lines · Alan Cox
Quoted 1 line
Is that the only valid use of
/dev/mem, or even its main use?These days it is the primary use. Things like X11 were historically probably the biggest user of it, and things like LRMI sometimes need that sort of stuff.
how does X11 get now direct access to the physical memory (instead of
/dev/mem) ?
The classic X server doesn't use main memory, typically just mapped graphic card resources
(if you don't count BIOS tables and memory accessed by the video bios running in emulation, but that is typically excluded by the check)
In fact it can't because it doesn't know the physical addresses of its process memory.
Modern X does it through kernel modules (DRM, GEM etc.)
One reason it's needed to do it this way is IOMMUs.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
Quoted 1 line · Andi Kleen
Modern X does it through kernel modules (DRM, GEM etc.)
is it done by an mmap call (to the device) ?
Quoted 1 line
One reason it's needed to do it this way is IOMMUs.
why would it care about IOMMUs ? do graphic cards manipulate the memory too ?
thank you!
Quoted 6 lines
-Andi
--
[email protected] -- Speaking for myself only.
Quoted 2 lines
how does X11 get now direct access to the physical memory (instead of
/dev/mem) ?
Via frame buffer devices.
If you think about things like hot-plug it's rather hard to do frame buffer access any other way. The rules on memory types and aliasing also make it nearly impossible to do properly with /dev/mem on a modern CPU.
Alan