Page 1 of 1
Detecting the Total Amound of Installed Memory?
Posted: Tue Mar 23, 2004 9:34 pm
by astrocrep
I am reading Memory Management 1 by Tim Robinson, and its stated that we need to find out the total amount of installed ram in the system, we can get up to 64mb by reading cmos... or by intting 15 in realmode... well I am using GRUB, I check the multiboot header specs... but I honestly can make heads or tails out of it... Is there an absolute way to detect the total amound of ram installing in a system?
I was thinking someting along the lines of psuedo code:
pointer to 2mb mark...
write 'a'
read 'a'
failure break from loop
else add 1mb to pointer and try again...
but my code must be sloppy and it goes through an inft loop.
Thanks for the help.
Rich P.
Re:Detecting the Total Amound of Installed Memory?
Posted: Wed Mar 24, 2004 12:24 am
by cxsnew
Some newer bios call maybe can do some help for you when detect the installed RAM in the system,but this will depend on the mother board.
Another method is detect the RAM directly, you can get more details about this in
www.mega-tokyo.com/os
Hopes help for you.
Re:Detecting the Total Amound of Installed Memory?
Posted: Wed Mar 24, 2004 3:50 am
by bubach
but if your code goes to, let's say 128 mb and then tries to write to 129 mb (which we say don't exist), what happends then? doesn't your os hang or something?
/ Christoffer
Re:Detecting the Total Amound of Installed Memory?
Posted: Wed Mar 24, 2004 4:16 am
by Candy
bubach wrote:
but if your code goes to, let?s say 128 mb and then tries to write to 129 mb (witch we say don?t exist), what happends then? does?nt your os hang or something?
/ Christoffer
the method does work. The OS will not crash or anything. But, you DO have other things that may exhibit a memory function that you may never use as memory. Say, your acpi tables or your PCI configuration.
Use int15/e820 or int15/e801. Just about all computers have them and they're easy to code, let alone that I've heard grub provides e820-ish output anyway..
Re:Detecting the Total Amound of Installed Memory?
Posted: Wed Mar 24, 2004 12:14 pm
by ASHLEY4
I would not use probing memory at 1mb intervils,as i have read that it can DAMAGE your's or someone else's system.
"However, your BIOS knows things you ignore about your motherboard and PCI devices. Probing memory-mapped PCI devices may have unpredictable results and possibly damage your system, "
ASHLEY4.
Re:Detecting the Total Amound of Installed Memory?
Posted: Wed Mar 24, 2004 12:34 pm
by Neo
you can either write your own bootloader to get the memory map from the BIOS or, as you are using GRUB see the example kernel that comes with it to see how you can use the memory map info supplied by it.
I haven't tried this as yet as i use my own bootloader. but i read somewhere that GRUB comes with a simple kernel showing you its features.
Re:Detecting the Total Amound of Installed Memory?
Posted: Thu Mar 25, 2004 9:55 pm
by bradd
I found a nice little ASM program that detects memory, trying 3 different ways.. Right now it just prints the blocks, but I've adapted it to store the blocks somehwere in memory where my C program can then read the blocks and do whatnot with them.
Heres the link:
http://my.execpc.com/~geezer/osd/boot/biosmem.asm