Page 1 of 1

Determining useable RAM w/o Int 15h?

Posted: Thu Dec 19, 2002 3:04 am
by Zer
I am trying to develop using Bochs, and it doesn't appear to support the Int 15h calls regarding memory size at all. As such, I was wondering if any of you knew a way to determine the amount of RAM (and preferrably, the ranges) which are useable without these calls.

I've tried writing to RAM with various values and then writing the original value back, thinking that an invalid portion would not read back what was written, read-only and silently failing or somesuch. Alas, it seems this is not so (at least in Bochs).

So, any suggestions for this? I'm a bit stuck. :-)

Re:Determining useable RAM w/o Int 15h?

Posted: Thu Dec 19, 2002 3:52 am
by whyme_t
try pskyboy's mem check code posted in another thread,http://www.mega-tokyo.com/forum/index.php?board=1;action=display;threadid=2292, it's the 9th post down.

I've checked this code under bochs 1.4.1 and pre 2 and 3, and it worked perfectly.

Re:Determining useable RAM w/o Int 15h?

Posted: Thu Dec 19, 2002 12:04 pm
by Zer
That is more or less what I'm already doing, except I was checking for each 4 KB block, starting at 2 GB and working downward. My reasoning was that I was filling up a free page stack which is going upward, so the two can't overwrite then. However it seems to find memory at 2 GB, etc. and keep going down. The only difference I see in what I am doing other than that is that I have the memory marked as volatile. :-/ Perhaps it's a bug in the code then... :(

Re:Determining useable RAM w/o Int 15h?

Posted: Thu Dec 19, 2002 2:19 pm
by K.J.
I am trying to develop using Bochs, and it doesn't appear to support the Int 15h calls regarding memory size at all.
1.4.1 and under didn't support them, but I got sick and tired of that, so I coded a patch that adds in support. It was compiled into all the Bochs 2.0pre-releases(which are super-fast and rock solid pretty much):
http://bochs.sourceforge.net/release2_0.html

K.J.

Re:Determining useable RAM w/o Int 15h?

Posted: Fri Dec 20, 2002 3:55 am
by DarylD
Does this finally mean that bochs will work correctly with grub memory detection?

That always drove me mad, if you try and use the memory_map structures that grub produces, basically it doesn't generate them with bochs because its bios doesn't support them. Very frustrating!

Re:Determining useable RAM w/o Int 15h?

Posted: Fri Dec 20, 2002 7:06 am
by Tim
What if someone tries to run your OS on a machine that doesn't support the newer BIOS calls? Bochs is doing you a favour by making sure you've got something to fall back on.

Re:Determining useable RAM w/o Int 15h?

Posted: Fri Dec 20, 2002 3:11 pm
by K.J.
Does this finally mean that bochs will work correctly with grub memory detection?
Yes.

K.J.

Re:Determining useable RAM w/o Int 15h?

Posted: Tue Jan 14, 2003 7:18 am
by Perica
..

Re:Determining useable RAM w/o Int 15h?

Posted: Tue Jan 14, 2003 11:23 am
by df
either page fault, or it returns zero

Re:Determining useable RAM w/o Int 15h?

Posted: Wed Jan 15, 2003 10:04 am
by Tim
If you access physical memory that doesn't exist (e.g. you don't have paging enabled or you map a virtual address to a non-existent physical address), something wrong happens. What actually happens depends on the motherboard chipset, and not the processor; I've only ever seen 0xFFFFFFFF come from non-existent RAM.

If you access a non-existent (unmapped) virtual address, you get a page fault.

Re:Determining useable RAM w/o Int 15h?

Posted: Wed Jan 15, 2003 3:12 pm
by df
iave had zero come back from ram that didnt exist :) tho i would expoect -1 to be 'correct' instead of zero...