AMC-OS Loader

From AMC-OS Developers
Jump to navigation Jump to search

Introduction

AMC-OS Loader is a module part of the boot process. Its task is to locate the kernel in the booting volume, load it in memory and prepare all the necessary structures to start it.

AMC-OS Loader gives us much more flexibility in boot process, as we no longer have the limitation of 512 bytes of code. However, the CPU is still running in real mode, implying limitations in the size of structures and files we have to manipulate.

Process

AMC-OS Loader splash screen

AMC-OS Loader follow this procedure :

  • Wait for options (typically F1 for debugging purposes if compiled with DEBUG support)
  • System check : Check that we have a 386+ running in real-mode
  • Check for EBDA and initialize first MB of memory to allow memory allocation
  • Ask BIOS information on the available RAM in the system
  • Precisely identify the CPU using either the CPUID instruction or a CPU reset, and calculates its running frequency
  • Check if we start from a MBR (removeable media) or a VBR and locate volume to boot
  • Identify the volume type (FAT12, FAT16...) and initialize according filesystem driver.
  • Locate and load the required kernel files
  • Identify the video graphics card, check VESA support to get best text resolution during kernel initialization
  • Prepare the CPU for protected mode (GDT and system descriptors)
  • Do a first switch to protected mode to decode kernel AMCX file and relocate it in memory
  • Do a second switch to protected mode to start kernel

Files

AMC-OS Loader is composed of two files :

  • AMCOSLDR.SYS contains raw code of AMC-OS Loader (no header nor relocation).
  • AMCOSLDR.IMG is a picture of AMC-OS Logo displayed during AMC-OS Loader execution.

Both files are loaded by the boot sector.

16-bit code and V86

AMC-OS Loader stays in memory to allow 16-bit code to be executed from Kernel in V86 mode, typically to call INT 10H (video)