Messages in this thread | | | Date | Tue, 30 Nov 2004 21:46:11 +0100 (MET) | From | Jan Engelhardt <> | Subject | Re: Walking all the physical memory in an x86 system |
| |
>>> 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.
I want(ed) to find out which I/O port to use for inb() and stuff, and using the BIOS's provided data. If you are referring to "ports", I could not find a device node, but "port" maybe:
$ tailhex /dev/port [...] 0x00000400 | ffff ffff ffff ffff ffff ffff ffff ffff | [...]
Oh, look what /dev/mem found! (I retried haha)
$ tailhex /dev/mem ... 0x00000400 | f803 0000 0000 0000 7803 0000 0000 c09f | ...
0x3F8 and 0x378... we know those ones :) BTW: What the BIOS does not seem to recognize is that PCI card that provides more LPT ports (LPT2 and LPT3) (I literally fried the LPT1)
So, /dev/mem points to "physical" mem in a sense like DOS has. (Where, the BIOS, is blend into, as you can see)
>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.
Yes, (parallel / serial, I don't care, it's just something to show), or in DOS-style: *(unsigned short far *)0x400
Jan Engelhardt -- ENOSPC - 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/
| |