Hi,
Brynet-Inc wrote:If you are unable to detect the memory on that 486 with all the conventional methods, perhaps the fault is in the system..
![Wink ;)](./images/smilies/icon_wink.gif)
Hehe, the fault is in the system. Don't you think it's strange that there's at least 5 different BIOS functions to detect RAM to begin with?
IIRC the specific 80486 I mentioned actually does have 16 MB of RAM, and some of the old "get extended memory size" functions probably do say that there's 16 MB of RAM installed. However, my OS can't assume that there's 16 MB of RAM when these BIOS functions say there's 16 MB of RAM because these older BIOS functions are dodgy and say there's 16 MB of RAM installed when there's more.
If the same 80486 had 8 MB of RAM then my OS would detect it with BIOS functions correctly (and wouldn't reject the BIOSs results). If the same 80486 had 32 MB of RAM the BIOS functions would probably still tell me there's 16 MB of RAM like they do now, and I'd have to do manual probing.
It is possible that all computers that don't support better "get extended memory size" functions aren't designed to handle more than 16 MB of RAM and can't have more than 16 MB installed. In this case, if better BIOS functions aren't present I would be able to trust the older BIOS functions when they say 16 MB of RAM is installed (instead of rejecting them).
However this is more complicated than it sounds - the computer might support more than 16 MB of RAM and provide "int 0x15, ax = 0xE802" (or any other BIOS function that the OS doesn't support) or better BIOS functions may be present but may have been rejected by the OS for some reason. There's also no way I can be sure that "better BIOS functions not present" does imply "maximum of 16 MB or less".
Again, I should point out I'm seeking perfection here. My existing code probably does work on 99.9% of all (80486 and later) computers, and is already much better than the memory detection code I've seen in any other OS and GRUB. It's the last 0.1% I'm worried about, because (unlike other OSs) I really do not want to provide kernel options so that users can get that last 0.1% working correctly...
B.E wrote:Have you tried
int 0x12, also the bios stores the amount of memory at 0x0040:0x0013
Yes, but Int 0x12 (and 0x0040:0x0013) only return the amount of usable RAM below 1 MB - even though it always works it can't tell the OS how much memory there is above 1 MB.
B.E wrote:Brendan wrote:Part of the problem is that if better BIOS functions aren't present, my OS falls back to worse BIOS functions, and can then reject the data returned due to BIOS limitations. For example, for "Int 0x15 AH = 0x88" my OS rejects the returned data if the BIOS says there's 65535 KB above 1 MB (the most this function can return) or if the BIOS says there's 15 MB above 1 MB (a value often returned when there's more that 16 MB of RAM).
Don't forget, these interrupts were around before the 32-bit processor was 'invented', and as such can only give you a sixteen bit answer.
It's worse than that. For example, "Int 0x15 ax = 0x88" returns "number of KB above 1 MB" as a 16-bit number. In theory this should work if there's up to 65535 KB at 1 MB. In practice often the BIOS limits this value to 15 MB or 63 MB (depending on the BIOS), and if there's an ISA hole at 0x000F00000 it won't return more than 14 MB regardless of how much more RAM is installed (because it's not contiguous RAM).
Cheers,
Brendan