Thread (5 messages) 5 messages, 3 authors, 2004-11-30

Re: Walking all the physical memory in an x86 system

From: linux-os <hidden>
Date: 2004-11-30 20:26:04

On Tue, 30 Nov 2004, Alan Cox wrote:
On Maw, 2004-11-30 at 17:34, Jan Engelhardt wrote:
quoted
	unsigned short p;
	fd = open("/dev/mem", O_RDONLY | O_BINARY);
	lseek(fd, 0x400, SEEK_SET);
	read(fd, &p, 2);
You want ports for that not mem, has always been the case since back
before Linux existed.
At offset 0 in the BIOS segment of 0x40, real address 0x400, are
the addresses of up to 4 ports for the serial communications
devices, followed by up to 4 port addresses of any parallel
communications devices found by the BIOS upon startup. This
is likely what he meant. The code shown will return the address
of the first RS-232 device (usually a 8250 UART) found.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
  Notice : All mail here is now cached for review by John Ashcroft.
                  98.36% of all statistics are fiction.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help