Tuesday, February 22, 2022

[SOLVED] procfs is located in memory, but where? Is it possible to obtain its address for DMA?

Issue

I'm developing on an FPGA/SoC and need to access procfs via DMA. I understand it's a pseudo filesystem located in memory, and am wondering if it's possible to obtain its address (similar to how the syscall table address is accessible in System.map) I'd like to have access to memory utilization and other stats.


Solution

You already got the answer from @Barmar comment. I just want to add some more information about procfs.

Actually pesudo is something pretend to. It means pesudo filesystem that doesn't have actual files, it has virtual entries that the filesystem available to access.

Is it possible to obtain address of DMA?

Answer is yes.

  1. There are several kinds of addresses involved in the DMA API, and it’s important to understand the differences.

  2. The kernel normally uses virtual addresses. Any address returned by kmalloc(), vmalloc(), and similar interfaces is a virtual address and can be stored in a void *.

  3. From a device’s point of view, DMA uses the bus address space, but it may be restricted to a subset of that space. For example, even if a system supports 64-bit addresses for main memory and PCI BARs, it may use an IOMMU so devices only need to use 32-bit DMA addresses.

Read this kernel document for more info about DMA-API-HOWTO.txt



Answered By - danglingpointer
Answer Checked By - David Marino (WPSolving Volunteer)