Difference between revisions of "Meminfo.c32"

From Syslinux Wiki
Jump to: navigation, search
(INT 15h e820)
(Add Category "Examples". Wiki formatting. Minor modifications to the text.)
Line 1: Line 1:
 
[[Category:Comboot]]
 
[[Category:Comboot]]
 +
[[Category:Examples]]
 
[[Category:Modules]]
 
[[Category:Modules]]
 
+
<!-- keywords: dump memory map -->
Meminfo.c32 displays the output of the various memory size/range functions.
+
Meminfo.c32 displays the range/size of various memory functions.
  
 
== Example ==
 
== Example ==
Here's an example from within bochs with 64 MiB of RAM.
+
Here's an example (with some extra formatting for clarity)
<pre>
+
from within bochs with 64 MiB of RAM.
boot: meminfo.c32
+
<!--
INT 15h = f000:f859  DOS RAM: 639K (0x9fc00)  INT 12h: 639K (0x9fc00)
+
--><!--
INT 15 88: 0xfc00 (64512K)  INT 15 E801: 0x3c00 (15360K) 0x0300 (49152K)
+
--><!--
       0 0000000000000000 000000000009f000 000000000009f000 1 [-] usable
+
--><!-- Original basic output, no "extra" formatting: --><!--
       1 000000000009f000 0000000000001000 00000000000a0000 2 [-] reserved
+
--><!--
       2 00000000000e8000 0000000000018000 0000000000100000 2 [-] reserved
+
--><!--
       3 0000000000100000 0000000003ef0000 0000000003ff0000 1 [-] usable
+
--><!-- <pre>
       4 0000000003ff0000 0000000000010000 0000000004000000 3 [-] ACPI reclaim
+
--><!-- boot: meminfo.c32
       5 00000000fffc0000 0000000000040000 0000000100000000 2 [-] reserved
+
--><!-- INT 15h = f000:f859  DOS RAM: 639K (0x9fc00)  INT 12h: 639K (0x9fc00)
</pre>
+
--><!-- INT 15 88: 0xfc00 (64512K)  INT 15 E801: 0x3c00 (15360K) 0x0300 (49152K)
 +
--><!--       0 0000000000000000 000000000009f000 000000000009f000 1 [-] usable
 +
--><!--       1 000000000009f000 0000000000001000 00000000000a0000 2 [-] reserved
 +
--><!--       2 00000000000e8000 0000000000018000 0000000000100000 2 [-] reserved
 +
--><!--       3 0000000000100000 0000000003ef0000 0000000003ff0000 1 [-] usable
 +
--><!--       4 0000000003ff0000 0000000000010000 0000000004000000 3 [-] ACPI reclaim
 +
--><!--       5 00000000fffc0000 0000000000040000 0000000100000000 2 [-] reserved
 +
--><!-- </pre>
 +
--><!--
 +
--><!--
 +
--><!-- --><!--
 +
--><!-- --><!--
 +
--><!--
 +
--><!--
 +
--><!-- Possible alternative wiki formatting (WIP / not completely finished): --><!--
 +
--><!--
 +
--><!-- {|
 +
--><!-- |
 +
--><!--  boot: meminfo.c32
 +
--><!--  [[#INT 15h|INT 15h]] = f000:f859  [[#DOS RAM|DOS RAM]]: 639K (0x9fc00)  [[#INT 12h|INT 12h]]: 639K (0x9fc00)
 +
--><!--  [[#INT 15h 88|INT 15 88]]: 0xfc00 (64512K)  [[#INT 15h e801|INT 15 E801]]: 0x3c00 (15360K) 0x0300 (49152K)
 +
--><!--  <span style="background-color: yellow; color: blue; ">      0</span> <span style="background-color: lime; color: fuchsia; ">0000000000000000</span> <span style="background-color: aqua; color: red; ">000000000009f000</span> <span style="background-color: blue; color: yellow; ">000000000009f000</span> <span style="background-color: olive; color: white; ">1 [-]</span> <span style="background-color: black; color: white; ">usable</span>
 +
--><!--  <span style="background-color: yellow; color: blue; ">      1</span> <span style="background-color: lime; color: fuchsia; ">000000000009f000</span> <span style="background-color: aqua; color: red; ">0000000000001000</span> <span style="background-color: blue; color: yellow; ">00000000000a0000</span> <span style="background-color: olive; color: white; ">2 [-]</span> <span style="background-color: black; color: white; ">reserved</span>
 +
--><!--  <span style="background-color: yellow; color: blue; ">      2</span> <span style="background-color: lime; color: fuchsia; ">00000000000e8000</span> <span style="background-color: aqua; color: red; ">0000000000018000</span> <span style="background-color: blue; color: yellow; ">0000000000100000</span> <span style="background-color: olive; color: white; ">2 [-]</span> <span style="background-color: black; color: white; ">reserved</span>
 +
--><!--  <span style="background-color: yellow; color: blue; ">      3</span> <span style="background-color: lime; color: fuchsia; ">0000000000100000</span> <span style="background-color: aqua; color: red; ">0000000003ef0000</span> <span style="background-color: blue; color: yellow; ">0000000003ff0000</span> <span style="background-color: olive; color: white; ">1 [-]</span> <span style="background-color: black; color: white; ">usable</span>
 +
--><!--  <span style="background-color: yellow; color: blue; ">      4</span> <span style="background-color: lime; color: fuchsia; ">0000000003ff0000</span> <span style="background-color: aqua; color: red; ">0000000000010000</span> <span style="background-color: blue; color: yellow; ">0000000004000000</span> <span style="background-color: olive; color: white; ">3 [-]</span> <span style="background-color: black; color: white; ">ACPI reclaim</span>
 +
--><!--  <span style="background-color: yellow; color: blue; ">      5</span> <span style="background-color: lime; color: fuchsia; ">00000000fffc0000</span> <span style="background-color: aqua; color: red; ">0000000000040000</span> <span style="background-color: blue; color: yellow; ">0000000100000000</span> <span style="background-color: olive; color: white; ">2 [-]</span> <span style="background-color: black; color: white; ">reserved</span>
 +
--><!-- |}
 +
--><!--
 +
--><!--
 +
-->
 +
 
 +
{| style="text-align: left; white-space: nowrap; border: 1px dashed darkgray; font-family: monospace; " cellpadding="0" cellspacing="0" bgcolor="#f9f9f9"
 +
| colspan="6" | boot: meminfo.c32
 +
|-
 +
| colspan="6" | [[#INT 15h|INT 15h]] = f000:f859  [[#DOS RAM|DOS RAM]]: 639K (0x9fc00)  [[#INT 12h|INT 12h]]: 639K (0x9fc00)
 +
|-
 +
| colspan="6" | [[#INT 15h 88|INT 15 88]]: 0xfc00 (64512K)  [[#INT 15h e801|INT 15 E801]]: 0x3c00 (15360K) 0x0300 (49152K)
 +
|- style="text-align: right; "
 +
| style="background-color: yellow; color: blue; " | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0 <br />1 <br />2 <br />3 <br />4 <br />5
 +
| style="background-color: lime; color: fuchsia; " | &nbsp;0000000000000000 <br />000000000009f000 <br />00000000000e8000 <br />0000000000100000 <br />0000000003ff0000 <br />00000000fffc0000
 +
| style="background-color: aqua; color: red; " | &nbsp;000000000009f000 <br />0000000000001000 <br />0000000000018000 <br />0000000003ef0000 <br />0000000000010000 <br />0000000000040000
 +
| style="background-color: blue; color: yellow; " | &nbsp;000000000009f000 <br />00000000000a0000 <br />0000000000100000 <br />0000000003ff0000 <br />0000000004000000 <br />0000000100000000
 +
| style="background-color: olive; color: white; " | &nbsp;1 [-] <br />2 [-] <br />2 [-] <br />1 [-] <br />3 [-] <br />2 [-]
 +
| style="background-color: black; color: white; text-align: left; " | &nbsp;usable<br />&nbsp;reserved <br />&nbsp;reserved <br />&nbsp;usable <br />&nbsp;ACPI reclaim <br />&nbsp;reserved
 +
|}
  
 
== Meaning ==
 
== Meaning ==
 
=== INT 15h e820 ===
 
=== INT 15h e820 ===
Results from INT 15h AX=e820h. This is, for the most part, the most important of all of the memory functions as it provides a map of available memory. This is the last lines of output (in this instance, 6) starting with
+
Results from <code>INT 15h AX=e820h</code>.  
<pre>      0 0000000000000000 000000000009f000 000000000009f000 1 [-] usable</pre><!-- I can't get the spaces to show without pre -->
+
This is, for the most part, the most important of all of the memory functions,
Line numbers are printed in hex as 8 characters wide with a space prefix.  Each line represents the purpose/availability, address and length/size of a block of memory.
+
as it provides a map of available memory.  
 +
The information is displayed as the last few lines of the output  
 +
(in this instance, 6) starting (in the example) with:
 +
{|
 +
|
 +
        0 0000000000000000 000000000009f000 000000000009f000 1 [-] usable
 +
|}
  
The first 64 bit hex quantity is the start address. The second is the length/size. The third is the end address (exclusive of the mentioned byte; calculated as start plus length). The next number is decimal for the type of memory. The next column is bracketed and either a single hyphen or a hex number representing the extended attributes. The last column is the string representation of the type.
+
Line numbers are printed in
 +
<span style="background-color: yellow; color: blue; ">hex as 8 characters wide with a space prefix</span>.
 +
<!-- -->
 +
<!-- The above description of the output for "Line numbers" -->
 +
<!-- doesn't seem to match the actual output accurately. -->
 +
<!-- Either the description is slightly inaccurate, or there is a bug. -->
 +
<!-- -->
 +
Each line represents the
 +
<span style="background-color: black; color: white; ">purpose/availability</span>,
 +
<span style="background-color: lime; color: fuchsia; ">address</span> and
 +
<span style="background-color: aqua; color: red; ">length/size</span> of a block of memory.
 +
 
 +
The first 64 bit hex quantity is the  
 +
<span style="background-color: lime; color: fuchsia; ">start address</span>.  
 +
The second is the  
 +
<span style="background-color: aqua; color: red; ">length/size</span>.  
 +
The third is the  
 +
<span style="background-color: blue; color: yellow; ">end address</span>
 +
(excluding the listed byte;  
 +
calculated as start plus length).  
 +
The next number is  
 +
<span style="background-color: olive; color: white; ">decimal for the type of memory</span>.  
 +
The next column is  
 +
<span style="background-color: olive; color: white; ">bracketed, either a single hyphen or a hex number <!--
 +
--> representing the extended attributes</span>.  
 +
 
 +
The last column is the  
 +
<span style="background-color: black; color: white; ">string representation of the type</span>:
 +
 
 +
* 1: usable
 +
* 2: reserved
 +
* 3: ACPI reclaim
 +
<!-- The text "ACPI reclaim" seems to be "too long" for an output of 80 columns. -->
 +
* 4: ACPI NVS
 +
* 5: unusable
  
 
=== INT 15h ===
 
=== INT 15h ===
This lists the segment and offset of the INT 15h handler, as read from the interrupt vector table.
+
{|
 +
|
 +
[[#INT 15h|INT 15h]] = f000:f859  [[#DOS RAM|DOS RAM]]: 639K (0x9fc00)  [[#INT 12h|INT 12h]]: 639K (0x9fc00)
 +
|}
 +
List the segment and offset of the <code>INT 15h</code> handler,  
 +
as read from the interrupt vector table.
 +
 
 
=== DOS RAM ===
 
=== DOS RAM ===
 +
{|
 +
|
 +
[[#INT 15h|INT 15h]] = f000:f859  [[#DOS RAM|DOS RAM]]: 639K (0x9fc00)  [[#INT 12h|INT 12h]]: 639K (0x9fc00)
 +
|}
 
It appears that this reads a value directly from memory.
 
It appears that this reads a value directly from memory.
 +
 
=== INT 12h ===
 
=== INT 12h ===
The results from calling INT 12h. This lists the available low memory (under 640k)
+
{|
 +
|
 +
[[#INT 15h|INT 15h]] = f000:f859  [[#DOS RAM|DOS RAM]]: 639K (0x9fc00)  [[#INT 12h|INT 12h]]: 639K (0x9fc00)
 +
|}
 +
The results from calling <code>INT 12h</code>.  
 +
List the available low memory (under 640k).
 +
 
 
=== INT 15h 88 ===
 
=== INT 15h 88 ===
Results from INT 15h, AH=88h. This returns the size of extended memory (total RAM in KiB as a 16 bit quantity).
+
{|
=== INT 15h e801 ===
+
|
Results from INT 15h AX=e801h.  Extended memory size with a larger limit (superseding AH=88h).  The first is the return (in CX) and size of memory between 1 MiB and 16 MiB.  The second is the return (in DX) and size of memory above 16 MiB in 64 KiB pages.
+
[[#INT 15h 88|INT 15 88]]: 0xfc00 (64512K)  [[#INT 15h e801|INT 15 E801]]: 0x3c00 (15360K) 0x0300 (49152K)
 +
|}
 +
Results from <code>INT 15h, AH=88h</code>.  
 +
Return the size of extended memory (total RAM in KiB as a 16 bit quantity).
  
== Comments ==
+
=== INT 15h e801 ===
<!-- I think everything here is correct and clear. Please feel free to assist. -->
+
{|
 +
|
 +
[[#INT 15h 88|INT 15 88]]: 0xfc00 (64512K)  [[#INT 15h e801|INT 15 E801]]: 0x3c00 (15360K) 0x0300 (49152K)
 +
|}
 +
Results from <code>INT 15h AX=e801h</code>.
 +
Extended memory size with a larger limit (superseding <code>AH=88h</code>).
 +
The first pair of values is the return (in CX) and size of memory between 1 MiB and 16 MiB.  
 +
The second pair of values is the return (in DX) and size of memory above 16 MiB in 64 KiB pages.
  
 
== References ==
 
== References ==
 
* [http://wiki.osdev.org/Detecting_Memory_(x86) OS-Dev]
 
* [http://wiki.osdev.org/Detecting_Memory_(x86) OS-Dev]

Revision as of 14:25, 5 July 2019

Meminfo.c32 displays the range/size of various memory functions.

Example

Here's an example (with some extra formatting for clarity) from within bochs with 64 MiB of RAM.

boot: meminfo.c32
INT 15h = f000:f859 DOS RAM: 639K (0x9fc00) INT 12h: 639K (0x9fc00)
INT 15 88: 0xfc00 (64512K) INT 15 E801: 0x3c00 (15360K) 0x0300 (49152K)
       0
1
2
3
4
5
 0000000000000000
000000000009f000
00000000000e8000
0000000000100000
0000000003ff0000
00000000fffc0000
 000000000009f000
0000000000001000
0000000000018000
0000000003ef0000
0000000000010000
0000000000040000
 000000000009f000
00000000000a0000
0000000000100000
0000000003ff0000
0000000004000000
0000000100000000
 1 [-]
2 [-]
2 [-]
1 [-]
3 [-]
2 [-]
 usable
 reserved
 reserved
 usable
 ACPI reclaim
 reserved

Meaning

INT 15h e820

Results from INT 15h AX=e820h. This is, for the most part, the most important of all of the memory functions, as it provides a map of available memory. The information is displayed as the last few lines of the output (in this instance, 6) starting (in the example) with:

       0 0000000000000000 000000000009f000 000000000009f000 1 [-] usable

Line numbers are printed in hex as 8 characters wide with a space prefix. Each line represents the purpose/availability, address and length/size of a block of memory.

The first 64 bit hex quantity is the start address. The second is the length/size. The third is the end address (excluding the listed byte; calculated as start plus length). The next number is decimal for the type of memory. The next column is bracketed, either a single hyphen or a hex number representing the extended attributes.

The last column is the string representation of the type:

  • 1: usable
  • 2: reserved
  • 3: ACPI reclaim
  • 4: ACPI NVS
  • 5: unusable

INT 15h

INT 15h = f000:f859  DOS RAM: 639K (0x9fc00)  INT 12h: 639K (0x9fc00)

List the segment and offset of the INT 15h handler, as read from the interrupt vector table.

DOS RAM

INT 15h = f000:f859  DOS RAM: 639K (0x9fc00)  INT 12h: 639K (0x9fc00)

It appears that this reads a value directly from memory.

INT 12h

INT 15h = f000:f859  DOS RAM: 639K (0x9fc00)  INT 12h: 639K (0x9fc00)

The results from calling INT 12h. List the available low memory (under 640k).

INT 15h 88

INT 15 88: 0xfc00 (64512K)  INT 15 E801: 0x3c00 (15360K) 0x0300 (49152K)

Results from INT 15h, AH=88h. Return the size of extended memory (total RAM in KiB as a 16 bit quantity).

INT 15h e801

INT 15 88: 0xfc00 (64512K)  INT 15 E801: 0x3c00 (15360K) 0x0300 (49152K)

Results from INT 15h AX=e801h. Extended memory size with a larger limit (superseding AH=88h). The first pair of values is the return (in CX) and size of memory between 1 MiB and 16 MiB. The second pair of values is the return (in DX) and size of memory above 16 MiB in 64 KiB pages.

References