AMC-OS Loader Memory management: Difference between revisions

From AMC-OS Developers
Jump to navigation Jump to search
(Created page with "=Memory used during AMC-OS Loader execution= AMC-OS Loader uses only the first megabyte of memory : *<code>00000-003FF</code> : Real-mode interrupt table *<code>00400-00500</c...")
 
No edit summary
Line 1: Line 1:
=Memory used during AMC-OS Loader execution=
=Memory used during AMC-OS Loader execution=
AMC-OS Loader uses only the first megabyte of memory :
AMC-OS Loader uses only the first megabyte of memory :
*<code>00000-003FF</code> : Real-mode interrupt table
{|-
*<code>00400-00500</code> : BIOS static data
|<code>00000-003FF</code>
*<code>00501-005FF</code> : Free (unused)
|Real-mode interrupt table
*<code>00600-007FF</code> : ''Master boot record''
|-
*<code>00800-[__A]</code> : Kernel static data (initialized by boot loader)
|<code>00400-00500</code>
*<code>[__A]-[__B]</code> : AMC-OS Loader code
|BIOS static data
*<code>[__B]-[__C]</code> : AMC-OS Loader picture
|-
*<code>[__C]-077FF</code> : ''Free for allocation''
|<code>00501-005FF</code>
*<code>077FF-07BFF</code> : AMC-OS Loader stack
|Free (unused)
*<code>07C00-07DFF</code> : Boot loader code (VBR or MBR for floppy disk)
|-
*<code>07E00-07FFF</code> : Free (unused)
|<code>00600-007FF</code>
*<code>08000-9[_D]</code> : ''Free for allocation''
|''Master boot record''
*<code>9[_D]-09FFF</code> : Extended BIOS data area (EBDA - optional)
|-
 
|<code>00800-[__A]</code>
|Kernel static data (initialized by boot loader)
|-
|<code>[__A]-[__B]</code>
|AMC-OS Loader code
|-
|<code>[__B]-[__C]</code>
|AMC-OS Loader picture
|-
|<code>[__C]-077FF</code>
|''Free for allocation''
|-
|<code>077FF-07BFF</code>
|AMC-OS Loader stack
|-
|<code>07C00-07DFF</code>
|Boot loader code (VBR or MBR for floppy disk)
|-
|<code>07E00-07FFF</code>
|Free (unused)
|-
|<code>08000-9[_D]</code>
|''Free for allocation''
|-
|<code>9[_D]-09FFF</code>
|Extended BIOS data area (EBDA - optional)
}
=Memory management=
=Memory management=
==Initialization==
==Initialization==

Revision as of 17:11, 13 April 2020

Memory used during AMC-OS Loader execution

AMC-OS Loader uses only the first megabyte of memory :

00000-003FF Real-mode interrupt table
00400-00500 BIOS static data
00501-005FF Free (unused)
00600-007FF Master boot record
00800-[__A] Kernel static data (initialized by boot loader)
[__A]-[__B] AMC-OS Loader code
[__B]-[__C] AMC-OS Loader picture
[__C]-077FF Free for allocation
077FF-07BFF AMC-OS Loader stack
07C00-07DFF Boot loader code (VBR or MBR for floppy disk)
07E00-07FFF Free (unused)
08000-9[_D] Free for allocation
9[_D]-09FFF Extended BIOS data area (EBDA - optional)

}

Memory management

Initialization

During memory initialization process (AMCOSLDR_InitFirstMegabyte), AMC-OS Loader :

  • looks for EBDA using interrupt 12H and value stored in 0040:000E to get highest pointer in memory [_D]
  • calculates the values of [__A] to get lowest pointer in memory
  • creates a linked list of available blocks of memory (AMCOSLDR_Malloc_Entry)
  • initializes two blocks of available memory (marked Free for allocation in previous table)

Allocation

Three functions are available to AMC-OS Loader for memory allocation :

  • AMCOSLDR_DefinitiveAlloc : Used to allocate memory that shall stay at this place at the end of the process (used by kernel afterwards). Memory will be taken from bottom of free memory.
  • AMCOSLDR_TempAlloc : Used to allocate memory that will be freed at the end of the process (eraseable by kernel afterwards). Memory will be taken from top of free memory.
  • AMCOSLDR_VolatileAlloc : Used to allocate memory for immediate use (valid only until a new call to any memory function is made). Memory will be taken from top of free memory.

The two first functions maintains the linked list of available blocks of memory.