Page 1 of 1

Get Memory Map without int15 ax=e820

Posted: Tue Sep 24, 2002 7:49 am
by PlayOS
Hi,

I know that the interrupt int15 ax=e820 will get the system memory map, and allow you to know where memory mapped devices are. But how do I do this without this function?

Thanks.

Re:Get Memory Map without int15 ax=e820

Posted: Tue Sep 24, 2002 9:44 am
by Pype.Clicker
why don't you want to use it ?

Well, i guess it uses PCI probing to know which devices are present and where in the memory area they are located, then it probably goes with a classical "ram detection routine" (read some address, try to write smthg else, read again, compare, re-write the previous value) in the "gaps" between memory-mapped devices ;)

Re:Get Memory Map without int15 ax=e820

Posted: Tue Sep 24, 2002 1:30 pm
by Tim
It's easy to bypass the BIOS memory map function. All you need to do is ring up the company that made your motherboard and ask them for the technical specs of the chipset. A disassembly of the BIOS source code might be useful too. Of course, you'll have to pay them for all this, and you'll have to do it for every type of motherboard you come across.

You mean you don't want to do all that? Hmm, better use int 15h/0e280h then... ;)

Re:Get Memory Map without int15 ax=e820

Posted: Tue Sep 24, 2002 4:28 pm
by PlayOS
Well Gee, I guess you have never heard of a BIOS that dont support this function :(, unfortunately I have, because I have one. I bought my computer a little over 2 years ago and when I try to access the function it dosen't work. I tried this a few times and could not get it to work, so I thought that I would post here, but no-one replied to the post so I thought I would ask if there was a way to do it without this function.

Maybe if someone could give me a small example to try so that I can be sure that I was not doing something wrong. :)

Thanks.

Re:Get Memory Map without int15 ax=e820

Posted: Tue Sep 24, 2002 4:54 pm
by Curufir
This isn't the only memory map function available to you.

There's e881, e801, e802 (For some specific motherboard), and last but not least (If you don't mind non-spefic information and you know ram is <64mb), 88.

From information on Ralf Brown's interrupt list, windows uses e881 as a fallback if e820 is unavailable.

From Ralf Brown's Intterupt List:
INT 15 - Phoenix BIOS v4.0 - GET MEMORY SIZE FOR >64M CONFIGURATIONS (32-bit)
   AX = E881h
Return: CF clear if successful
    EAX = extended memory between 1M and 16M, in K (max 3C00h = 15MB)
    EBX = extended memory above 16M, in 64K blocks
    ECX = configured memory 1M to 16M, in K
    EDX = configured memory above 16M, in 64K blocks
   CF set on error
Notes:   supported by AMI BIOSes dated 8/23/94 or later
   this interface is used by Windows NT 3.1, OS/2 v2.11/2.20, and is
    used as a fall-back by newer versions if AX=E820h is not supported
SeeAlso: AX=E801h"Phoenix",AX=E820h"Phoenix"


Most of the larger OSes try a few different ways to get the memory map, with the final resort being the (Almost) always available int 15, ah=88h. From memory this is one of the reasons early versions of Linux were limited to detecting 64mb of ram.

Curufir

Re:Get Memory Map without int15 ax=e820

Posted: Tue Sep 24, 2002 5:26 pm
by PlayOS
What happens about the memory mapped devices, when using these other methods. Could someone explain memory mapped devices, as I do not really understand how they work.

Thanks.

Re:Get Memory Map without int15 ax=e820

Posted: Wed Sep 25, 2002 12:30 am
by Pype.Clicker
basically they inform the bus logic to hook some of the memory address space to their own registers. for instance, your video card is the owner of the 0xb8000 .. 0xbfffff memory area. If you want to know the hooked areas, you have to send PCI probes (see a pci tutorial, maybe this draft) and get the list of locked regions.

Re:Get Memory Map without int15 ax=e820

Posted: Wed Sep 25, 2002 7:04 am
by PlayOS
OK Thanks, so is PCI probing highly reliable?

Re:Get Memory Map without int15 ax=e820

Posted: Fri Sep 27, 2002 2:37 pm
by Tim
No, because the system RAM isn't on the PCI bus, but on the front-side bus along with the CPU. The only system component that knows the layout of RAM (i.e. what DIMMs are installed) is the motherboard, and hence the BIOS/CMOS.

Re:Get Memory Map without int15 ax=e820

Posted: Mon Sep 30, 2002 12:48 am
by Pype.Clicker
my purpose was to
1) ask PCI for the list of reserved areas (memory-mapped devices)
2) in the remaining memory, perform a "classic" memory scanning

Code: Select all

for (megs=(int*)0; megs<HARD_LIMIT; 
       megs+=1024*1024/sizeof(int)) 
{
    int save;

    if (!mapped(megs)) {
        save = *megs;
        *megs=0x55555555;
        if (*megs!=0x55555555) break;
        *megs=save;
     }
}
print("we have %i MB installed",((int) megs)/(1024*1024));

Re:Get Memory Map without int15 ax=e820

Posted: Mon Sep 30, 2002 1:34 am
by PlayOS
Curufir wrote:From Ralf Brown's Intterupt List:
INT 15 - Phoenix BIOS v4.0 - GET MEMORY SIZE FOR >64M CONFIGURATIONS (32-bit)
???AX = E881h
Return: CF clear if successful
??? EAX = extended memory between 1M and 16M, in K (max 3C00h = 15MB)
??? EBX = extended memory above 16M, in 64K blocks
??? ECX = configured memory 1M to 16M, in K
??? EDX = configured memory above 16M, in 64K blocks
???CF set on error
Notes:???supported by AMI BIOSes dated 8/23/94 or later
???this interface is used by Windows NT 3.1, OS/2 v2.11/2.20, and is
??? used as a fall-back by newer versions if AX=E820h is not supported
SeeAlso: AX=E801h"Phoenix",AX=E820h"Phoenix"
Does this e881 function work if the system has < 64MB of RAM?