Memory Map using 0xe820
-
guest
Memory Map using 0xe820
I want to know how to display extended memory map of a computer i have used the INT 15h,0xe820 and have read that it returns memory map. how can i display this or use it. I read the Ralph interrupt list but cant understand it very well. Please help.
Also how to use more than 64Mb in BOCHS and test?
Also how to use more than 64Mb in BOCHS and test?
-
mr. xsism
Re:Memory Map using 0xe820
Code: Select all
push ds
pop es
mov di,0x500
xor ebx,ebx
get_e820:
mov eax,0x0000E820
mov ecx,0x20
mov edx,0x534D4150
int 0x15
jc e820_end
cmp eax,0x534D4150
jne e820_end
add dword di,20
cmp ebx,0
jne get_e820
e820_end:address,length,type
qword,qword,dword
IIRC. So take that data and read what is there. I'll let you figure out the rest.
Regards,
mr. xsism
-
Slasher
Re:Memory Map using 0xe820
And if you are using a 32bit system ie x86 then you only need to read the first double word (32bits) in each field increasing the map address by 8 to get to the next field
so if map at 0x0500
then
first :-
base 0x0500 (read 32 bits from this address)
length 0x0508 (read 32 bits from this address)
type 0x0510 (read 32 bits from this address)
second :-
base 0x0518 (read 32 bits from this address)
length 0x0520 (read 32 bits from this address)
type 0x0528 (read 32 bits from this address)
so if map at 0x0500
then
first :-
base 0x0500 (read 32 bits from this address)
length 0x0508 (read 32 bits from this address)
type 0x0510 (read 32 bits from this address)
second :-
base 0x0518 (read 32 bits from this address)
length 0x0520 (read 32 bits from this address)
type 0x0528 (read 32 bits from this address)
-
mr. xsism
Re:Memory Map using 0xe820
that would work, but could have problems if the address is over 32bits. i suggest using long longbecause base and size are 64bit vars. But that would work too, for most situantions.
Regards,
mr. xsism
Regards,
mr. xsism
-
Slasher
Re:Memory Map using 0xe820
long long is compiler specific ie its for gcc, so he'll have to find out the equivalent for a different compiler if he's not using gcc or similar. Also we are using 32 bit systems but if we were in a 64bit system then there would be a default 64bit type just as a dword is the 32bit type in current systems.
But I also agree with your suggestions, the more ways of doing things the better ;D
But I also agree with your suggestions, the more ways of doing things the better ;D
-
Tim
Re:Memory Map using 0xe820
Incidentally, long long is standard in C99 onwards. However, the Microsoft compiler still uses __int64.
Re:Memory Map using 0xe820
if only to add to the confusion, GCC now sees "long long" as a mistake and warns for uses (which is odd, if it is C99) and uses normal long for 64-bit ints, at least, on 64-bit processors. (seen in docs for AMD64)
Re:Memory Map using 0xe820
C99 compliance in gcc is still lacking.Candy wrote: GCC now sees "long long" as a mistake and warns for uses (which is odd, if it is C99)...
Every good solution is obvious once you've found it.
-
mr. xsism
Re:Memory Map using 0xe820
get a newer version of gcc. This error ocurred for me once too. But not this time for some reason. Make sure that you are declaring it as "long long" and nothing else. It might also help to post the error you got.

Regards,
mr. xsism
Regards,
mr. xsism
Re:Memory Map using 0xe820
GCC 3.3.1 manual:mr. xsism wrote: get a newer version of gcc. This error ocurred for me once too. But not this time for some reason. Make sure that you are declaring it as "long long" and nothing else. It might also help to post the error you got.
-Wlong-long
Warn if long long type is used. This is default. To inhibit the warning messages, use -Wno-long-long. Flags -Wlong-long and -Wno-long-long are taken into account only when -pedantic flag is used.
This kind of indicates that long long is deprecated (according to GCC), which shows it does support it (it is C99 compliant as far as long long is concerned) but it disadvises the use of it... which is odd to say the least.
-
Tim
Re:Memory Map using 0xe820
If you ask gcc to be ANSI-compilant, it assumes you're programming for C89; in C89, long long is a syntax error. If you don't ask for strict ANSI compliance, gcc lets you use all of its many extensions, some of which happen to be included in C99 (like long long). However, gcc doesn't fully support C99 yet.
