I have 2GiB RAM, running Perl 5.8.8 on Linux 2.6.
Whenever I open /dev/mem the call succeeds (that is I can get a filehandle on it), but also error 25 "Inappropriate ioctl for device" is returned. I don't know what that is supposed to mean.
$ok = sysopen my $mem, '/dev/mem', O_RDWR;
Following some suggestions in the open(2) manpage I tried to get rid of it by |ing (binary or) the mode with O_DIRECT and O_NONBLOCK and variations thereof, but it only made it worse, I get 22 "Invalid argument" and the call fails.
sysread()ing works up to address hex 38000000 (only ~896 MiB), then fails with error 14 "Bad address". Experiment from the shell supports it:
$ sudo cat /dev/mem > memdump cat: /dev/mem: Bad address
However, I can successfully sysseek() to any address in the file (even though error 25 is set again).
sysread()ing from /proc/$pid/mem is totally useless, it always fails with error 3 "No such process", even though sysopen()ing and sysseek()ing do succeed.
How comes all that strange behaviour, and why is that so?
How do I know where each program is located, anyway? I had a look at /proc/$pid/maps, but it's impossible that dozens of processes occupy overlapping or even exact same space after hex 8000000. Reading from /dev/mem at that point also returns garbage, well, at least not the garbage I expect.
In reply to messing with memory by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |