size of large memory

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
blinkin

size of large memory

Post by blinkin »

Can anyone tell me how can i get/probe the size of core memory larger than 64MB?
CMOS and 15h report no more than 64MB.
Chris Giese

RE:size of large memory

Post by Chris Giese »

1. Call INT 15h AX=E820h. If that doesn't work,
2. Call INT 15h AX=E801h. If that doesn't work,
3. Call INT 15h AH=88h. If that doesn't work,
4. Read memory sizes from CMOS

For methods 2 and 3, get conventional memory size with INT 12h or by reading memory location 0x413

Or, boot your OS with GRUB, and get the memory sizes (or memory map) from GRUB.
Scalpel

RE:size of large memory

Post by Scalpel »

Could you give some C-code example on how to call these INT's? Or read from CMOS.
Chris Giese

RE:size of large memory

Post by Chris Giese »

I don't know of any OS that calls these interrupts from C. Some of the interrupts return status information in the carry bit, which is difficult to handle from C.

The interrupts run in 16-bit mode, so you need a 16-bit C compiler, or a virtual-8086 mode monitor, or you must switch to real mode before calling the interrupt, then switch back to protected mode when done. All of this is very ugly, which is a good reason to let GRUB do it for you. (GRUB calls these interrupts from file STAGE2/ASM.S, which is asm code.)

If you're interested, here is some NASM code that calls these interrupts:
http://my.execpc.com/~geezer/osd/boot/biosmem.asm
Post Reply