Why does dd return an error with the wrong address in / dev / mem?

I am running embedded linux-3.10.29 on a PowerPC (big-endian) board. To debug my Ethernet controller, I need to check some system registers. SoC system registers are located at 0xe0000000(3584M). Therefore, I disabled CONFIG_STRICT_DEVMEM in the linux configuration and ran:

$ dd if=/dev/mem of=/home/mem.dump bs=1024 count=1k skip=3584k
dd: /dev/mem: Bad address

This command should skip the first (3584k * 1024B =) 3584MB from /dev/memand copy the master (1k * 1024B =) 1MB to /home/mem.dump. I also tried dropping the various 4 kB ranges inside the total 1 MB, which leads to the same problem.

This memory space is widely distributed by the kernel. Although I'm not quite sure that this is a problem.

# cat /proc/iomem 
00000000-0fffffff : System RAM
80000000-8fffffff : /pci@e0008500
  80000000-8007ffff : 0000:00:10.0
90000000-9fffffff : /pci@e0008500
  90000000-900003ff : 0000:00:10.0
    90000000-900003ff : sata_sil
e0004500-e0004507 : serial
e0004600-e0004607 : serial
f8000000-ffffffff : physmap-flash.0
  f8000000-ffffffff : physmap-flash.0

# cat /proc/vmallocinfo 
0xd1000000-0xd1002000    8192 ipic_init+0x98/0x198 phys=e0000000 ioremap
0xd1004000-0xd1006000    8192 mpc83xx_restart_init+0x1c/0x38 phys=e0000000 ioremap
0xd1006000-0xd1008000    8192 serial_dev_init+0x118/0x168 phys=e0004000 ioremap
0xd1008000-0xd100a000    8192 serial_dev_init+0x118/0x168 phys=e0004000 ioremap
0xd100a000-0xd100c000    8192 of_iomap+0x30/0x54 phys=e0005000 ioremap
0xd100c000-0xd100e000    8192 pcim_iomap+0x5c/0x7c phys=90000000 ioremap
0xd100e000-0xd1010000    8192 of_fsl_spi_probe+0x394/0x574 phys=e0007000 ioremap
0xd1010000-0xd1012000    8192 of_iomap+0x30/0x54 phys=e0024000 ioremap
0xd1012000-0xd1014000    8192 of_iomap+0x30/0x54 phys=e0025000 ioremap
0xd1014000-0xd1016000    8192 of_iomap+0x30/0x54 phys=e0024000 ioremap
0xd1016000-0xd1018000    8192 of_iomap+0x30/0x54 phys=e0025000 ioremap
0xd1018000-0xd101a000    8192 of_iomap+0x30/0x54 phys=e0003000 ioremap
0xd101a000-0xd101c000    8192 of_iomap+0x30/0x54 phys=e0003000 ioremap
0xd1080000-0xd9081000 134221824 devm_ioremap+0x44/0x9c phys=f8000000 ioremap

mem_util, @tangrs , devmem . bad address dd?

[EDIT]

$ strace dd if=/dev/mem of=/home/mem.dump bs=1024 count=1k skip=3584k
[...]
_llseek(0, 3758096384, [3758096384], SEEK_CUR) = 0
read(0, 0x100b1008, 1024)               = -1 EFAULT (Bad address)
+4

Source: https://habr.com/ru/post/1531439/


All Articles