The issue that I am experimenting is not related with
mmap() function, which are executed properly. I have disabled
CONFIG_STRICT_DEVMEM in the kernel so I can read from
/dev/mem without problems. Actually, I can do the following:
const char *path = "/dev/mem" int fd = open(path, O_RDWR); /* read and write flags*/ p = mmap(0, SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, BASE_ADDR); /* read and write flags*/
And the code does not fail. Nonetheless, I am using this code to write in the PCI address space. So, basically the
0xc000000, and the size is 256 MiB (
0x10000000, all the PCI address space).
Said that, when I try to write on these positions (with a specific offset, BDF format), nothing is written; again the code does not fail, it just does not write anything.
In case my code was wrong, I tried BusyBox, with the following parameters:
[horro@ ~]$ sudo busybox devmem 0xc00b0a8c w 0xffffffff [horro@ ~]$ sudo busybox devmem 0xc00b0a8c 0x00000000
So, basically it is not writing anything.
User contributions licensed under CC BY-SA 3.0