Messages in this thread | | | Date | Tue, 30 Nov 2004 15:25:40 -0500 (EST) | From | linux-os <> | Subject | Re: Walking all the physical memory in an x86 system |
| |
On Tue, 30 Nov 2004, Alan Cox wrote:
> On Maw, 2004-11-30 at 17:34, Jan Engelhardt wrote: >> 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. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |