Amount of RAM
Amount of RAM
I need to determine the amount of RAM that?s in my computer, and I need to know which areas that are available. How do I do that? I?ve read the FAQ but I didnt understand what was written there. I dont understand how you get a "map" from this code? Please help me!
Re:Amount of RAM
Henry wrote: I need to determine the amount of RAM that?s in my computer, and I need to know which areas that are available. How do I do that? I?ve read the FAQ but I didnt understand what was written there. I dont understand how you get a "map" from this code? Please help me!
... sometimes I'm amazed by the incomprehensibility of others behaviour.
Try RBIL, int15/e820 plus links from there. Try int88. Try the GRUB map. Try probing. Try to work something out at least, before you come here that the explanation is too complex.
The FAQ is probably the easiest way to learn those things. If you don't understand the faq, do a step down and first learn the stuff below it.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Amount of RAM
it would help us if you can better explain *what* you don't understand ... i.e. what question are still pending ...Henry wrote: I?ve read the FAQ but I didnt understand what was written there. I dont understand how you get a "map" from this code? Please help me!
I suggest you concentrate on "newer BIOSes - GET SYSTEM MEMORY MAP" as the first step. just call the INT with appropriated values in registers and you'll get an array of entry (e.g. the map) telling you the system configuration. An entry like
Code: Select all
0000-0000-0010-0000 0000-0000-00F0-0000 0000-0001
Re:Amount of RAM
Pype: I get the map using int 15, but my problem is to interpret it. I dont see how you get that MB 1-16 is available from that digits you wrote. That?s what I didnt understand
Re:Amount of RAM
Hi,
0000-0000-0010-0000 0000-0000-00F0-0000 0000-0001
In decimal this is:
1048576 15728640 1
Which means, after the first 1 Mb (1048576 bytes) there's 15 Mb (or 15728640 bytes) of RAM (which is type 1).
Are you using NASM?
Cheers,
Brendan
Pype's digits are in hexidecimal:Henry wrote: Pype: I get the map using int 15, but my problem is to interpret it. I dont see how you get that MB 1-16 is available from that digits you wrote. That?s what I didnt understand
0000-0000-0010-0000 0000-0000-00F0-0000 0000-0001
In decimal this is:
1048576 15728640 1
Which means, after the first 1 Mb (1048576 bytes) there's 15 Mb (or 15728640 bytes) of RAM (which is type 1).
Are you using NASM?
Code: Select all
;es:di = address of memory map data entry
mov ebx,[es:di]
mov ecx,[es:di+4] ;ecx:ebx = base address of area in bytes
mov edx,[es:di+8]
mov esi,[es:di+12] ;esi:edx = length of area in bytes
mov eax,[es:di+16] ;eax = memory area type (1 is RAM)
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:Amount of RAM
thank you brendan!
but what if ther? are gaps, so that the 1-2 mb is free, the 2-4 is in use, the 4-5 is free and so on?
And, do I only have to check the first 16 Mbytes? Is everything above "free to use"?
but what if ther? are gaps, so that the 1-2 mb is free, the 2-4 is in use, the 4-5 is free and so on?
And, do I only have to check the first 16 Mbytes? Is everything above "free to use"?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Amount of RAM
Note that the 'QWORDs' are mainly there for compatibility with systems that will have more than 4GB of physical memory (which you can only use with the appropriate extension on some of the x86 processors)
As a first step, you can simply check that the 'highest' 32 bits of the region is made of zeroes and work with DWords everywhere:
Hope That Helps
As a first step, you can simply check that the 'highest' 32 bits of the region is made of zeroes and work with DWords everywhere:
Code: Select all
;; looking for a region where we can put data
;; assuming that the whole MAP table has been read into [Map]
;; assuming that ECX contains the amount of entries used in [Map]
ScanBiosMap:
mov edi,Map
.loop:
cmp [edi+16],1
jne .nextEntry
cmp [edi+4],0
jne .PaeSupportRequired
cmp [edi+12],0
jne .PaeSupportRequired
;; we found a region that could interrest us ...
mov eax,[edi] ;; eax is the start of the region
mov edx,[edi+8]
add edx, eax ;; edx is the end of the region
call SetupFreeSpace
.nextEntry:
add edi,20
dec ecx
jne .loop