Counting system memory size....

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
viral

Counting system memory size....

Post by viral »

Hi .......
I am using E820 'SMAP' int 15h to determine the size of system memory. It is working on Bochs but fails on real pc. what is wrong then?
BTW my kernel is in "asm"+"c++" and i am using int 15h int bootloader in real mode and then switch to protected mode.
AR

Re:Counting system memory size....

Post by AR »

Presumeably the computer you are trying to run it on was built in 1995 and doesn't support the interrupt. Either that or your code expects the Bochs memory layout without reading the map properly.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Counting system memory size....

Post by Pype.Clicker »

you might want to write the same code for MS-DOS 16 bits and run it step by step (e.g. using tdebug.exe which should now be abandonware) on that machine to find out if "SMAP" is supported or not.
viral

Re:Counting system memory size....

Post by viral »

My PC is
Intel original 845GLLY motherboard
1.7 GHz CPU
256 MB RAM.

Its 2002 model ,so not that old. but dont know why its not getting int 15h.
smiddy

Re:Counting system memory size....

Post by smiddy »

Hi,

I have written a utility to check RAM. Here is a sample output of Bochs:

Code: Select all

GETMEM - 0.14.0217 Attempt to see what memory is installed... -smiddy

BIOS:
   15h:
     E820:   Base Address   -  Memory Length    - Type
         : 0000000000000000 - 000000000009FC00h -  01 <<   Available to OS   >>
         : 0000000000100000 - 000000003FF00000h -  01 <<   Available to OS   >>
         ----------------------------------------------------------------
         : Total Memory     :         3FF9FC00h -  1,073,347,584 bytes.
         ----------------------------------------------------------------
   12h:
         : Lower Memory     :         0009FC00h -        654,336 bytes.
   15h:
     E801: 
         : Extended Memory  :         3FF00000h -  1,072,693,248 bytes.
         ----------------------------------------------------------------
         : Total Memory     :         3FF9FC00h -  1,073,347,584 bytes.
         ----------------------------------------------------------------
   12h:
         : Lower Memory     :         0009FC00h -        654,336 bytes.
   15h:
     88  :   
         : Extended Memory  :         00F00000h -     15,728,640 bytes.
         ----------------------------------------------------------------
         : Total Memory     :         00F9FC00h -     16,382,976 bytes.
         ----------------------------------------------------------------
CMOS:
         : Lower Memory     :         000A0000h -        655,360 bytes.
         : Extended Memory  :         03F00000h -     66,060,288 bytes.
         ----------------------------------------------------------------
         : Total Memory     :         03FA0000h -     66,715,648 bytes.
Note that INT 15h in Bochs is only showning what is available. Here is a shot from my PC:

Code: Select all

GETMEM - 0.16.0219 Attempt to see what memory is installed... -smiddy

BIOS:
   15h:
     E820:   Base Address   -  Memory Length    - Type
         : 0000000000000000 - 000000000009FC00h -  01 <<   Available to OS   >>
         : 000000000009FC00 - 0000000000000400h -  02 <<   Reserved Memory   >>
         : 00000000000F0000 - 0000000000010000h -  02 <<   Reserved Memory   >>
         : 0000000000100000 - 0000000027EF0000h -  01 <<   Available to OS   >>
         : 0000000027FF0000 - 0000000000008000h -  03 << ACPI Reclaim Memory >>
         : 0000000027FF8000 - 0000000000008000h -  04 <<   ACPI NVS Memory   >>
         : 00000000FEC00000 - 0000000000001000h -  02 <<   Reserved Memory   >>
         : 00000000FEE00000 - 0000000000001000h -  02 <<   Reserved Memory   >>
         : 00000000FFF80000 - 0000000000080000h -  02 <<   Reserved Memory   >>
         ----------------------------------------------------------------
         : Total Memory     :         27F8FC00h -    670,628,864 bytes.
         ----------------------------------------------------------------
   12h:
         : Lower Memory     :         0009FC00h -        654,336 bytes.
   15h:
     E801: 
         : Extended Memory  :         27EF0000h -    669,974,528 bytes.
         ----------------------------------------------------------------
         : Total Memory     :         27F8FC00h -    670,628,864 bytes.
         ----------------------------------------------------------------
   12h:
         : Lower Memory     :         0009FC00h -        654,336 bytes.
   15h:
     88  :   
         : Extended Memory  :         03FFFC00h -     67,107,840 bytes.
         ----------------------------------------------------------------
         : Total Memory     :         0409F800h -     67,762,176 bytes.
         ----------------------------------------------------------------
CMOS:
         : Lower Memory     :         000A0000h -        655,360 bytes.
         : Extended Memory  :         03FFFC00h -     67,107,840 bytes.
         ----------------------------------------------------------------
         : Total Memory     :         0409FC00h -     67,763,200 bytes.
         ----------------------------------------------------------------
PROBE:
         : Extended Memory  :         27F00000h -    670,040,064 bytes.
         ----------------------------------------------------------------
         : Total Memory     :         27F9FC00h -    670,694,400 bytes.
Note the difference? If there is something wrong, I suspect that you may not be checking the type of RAM perhaps correctly? What are your indications?
viral

Re:Counting system memory size....

Post by viral »

hello....
poor me... I dint made it yet. Still I cant count system memory size on real pc (works in bochs!!!) using int 15h and following sub functions:

AH=C7h
AH=8Ah"Phoenix"
AX=E801h
AX=E802h
AX=E820h
AX=E881h"Phoenix"

btw my bios no is : LY84510A.86A.0023.P09

Is there nobody who can help me ( ??? ).......
Ushma

Re:Counting system memory size....

Post by Ushma »

viral wrote: hello....
poor me... I dint made it yet. Still I cant count system memory size on real pc (works in bochs!!!) using int 15h and following sub functions:

AH=C7h
AH=8Ah"Phoenix"
AX=E801h
AX=E802h
AX=E820h
AX=E881h"Phoenix"

btw my bios no is : LY84510A.86A.0023.P09

Is there nobody who can help me ( ??? ).......
Try dumping the memory map. A routine to do that is useful for debugging a memory counter.
Post Reply