Determining useable RAM w/o Int 15h?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Zer

Determining useable RAM w/o Int 15h?

Post 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. :-)
whyme_t

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

Post 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.
Zer

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

Post 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... :(
K.J.

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

Post 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.
DarylD

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

Post 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!
Tim

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

Post 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.
K.J.

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

Post by K.J. »

Does this finally mean that bochs will work correctly with grub memory detection?
Yes.

K.J.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

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

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:11 pm, edited 1 time in total.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

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

Post by df »

either page fault, or it returns zero
-- Stu --
Tim

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

Post 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.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

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

Post by df »

iave had zero come back from ram that didnt exist :) tho i would expoect -1 to be 'correct' instead of zero...
-- Stu --
Post Reply