Boot process: Difference between revisions

From AMC-OS Developers
Jump to navigation Jump to search
(Add AMC-OS Loader information)
 
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:


AMC-OS booting process is done in three different phases :
AMC-OS booting process is done in three different phases :
* [[Boot process#The Boot Loader|The boot loader]] ''(also named master boot record (MBR) or boot sector)''
* [[Boot process#The Boot Loader|The boot loader]] ''(also named volume boot record (VBR) or master boot record (MBR) for removeable media)''
* [[Boot process#AMC-OS Loader|AMC-OS Loader]] - Checking system, loads and relocates Kernel in memory
* [[AMC-OS Loader]] - Check system, CPU, memory, loads and relocates Kernel in memory
* '''Kernel initialization''' - Initializes all structures to start the AMC-OS kernel
* '''Kernel initialization''' - Initializes all structures to start the AMC-OS kernel


Line 18: Line 18:
* Load the FAT and Root directory (\) listing in memory
* Load the FAT and Root directory (\) listing in memory
* Locate <tt>AMCOSLDR.IMG</tt> and <tt>AMCOSLDR.SYS</tt> files in the root directory
* Locate <tt>AMCOSLDR.IMG</tt> and <tt>AMCOSLDR.SYS</tt> files in the root directory
* Load the files to fixed memory addresses
* Load the files in memory
* Switch execution to AMC-OS Loader
* Switch execution to AMC-OS Loader
   
   
The boot loader uses BIOS support through <tt>INT 13H</tt> for I/O functions.
The boot loader uses BIOS support through <tt>INT 13H</tt> for I/O functions.
In case of error during execution, the boot loader will display :
In case of error during execution, the boot loader will display :
* <tt>FIL?</tt> if one of the required files hasn't been found in the root directory
* <tt>FIL?</tt> or <tt>File not found</tt> if one of the required files hasn't been found in the root directory
* <tt>DSK?</tt> if a read error occured (probably defective disk)
* <tt>DSK?</tt> or <tt>Read error</tt> if a read error occured (probably defective disk)


==AMC-OS Loader==
==AMC-OS Loader==
AMC-OS Loader gives us much more flexibility to continue boot process, as we no longer have the limitation of 512 bytes of code. However, the CPU is still running in real mode, causing some difficulties to load more than 640KB (not enough available memory)
''See complete article : '' [[AMC-OS Loader]]
AMC-OS Loader follow this procedure :
* System check : Check that we have a 386+ running in real-mode
* Load and compare the disk FATs, converts them to FAT16 for simpler management (for FAT12 floppy disks)
* Locate the <tt>MODULES</tt> directory containing all kernel files required for boot
* Load all kernel files in memory using the contents of the <tt>AMCOS.MOD</tt> file
* Precisely identify the CPU using either the CPUID instruction or a CPU reset, and calculates its running frequency
* 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

Latest revision as of 12:46, 16 May 2017

Introduction

AMC-OS booting process is done in three different phases :

  • The boot loader (also named volume boot record (VBR) or master boot record (MBR) for removeable media)
  • AMC-OS Loader - Check system, CPU, memory, loads and relocates Kernel in memory
  • Kernel initialization - Initializes all structures to start the AMC-OS kernel

At power up, and after BIOS initialization, for historical/compatibility reasons, the processor runs in real adressing mode. In this mode, the CPU runs a 16-byte memory adressing scheme, meaning that we can only address 16 segments of 64KB of memory (ie 1MB), divided in "user" memory (640KB - the so-called "conventional memory" in MS-DOS) and Video RAM+System ROMS (384KB).

We have to switch the processor to 32-bit protected mode to run a 32-byte memory adressing scheme and adress 4GB of physical memory. It is even possible, starting with the Pentium Pro, to run a 36-byte memory addressing, called PAE (Physical Address Extension), allowing the adressing of 64GB of memory.

Switching to protected mode requires some preparation and resources, and most BIOS functions are no longer available (ie. disk read, changing video mode...), meaning that we must have loaded all kernel required files in memory before switching.

The Boot Loader

The boot loader is the first sector (512 bytes) of the source media (typically the floppy disk). The BIOS automatically loads the first sector of the specified media during system boot process, at physical memory address 00007C00, checks that the last word value is 55AA, and if so, jump execution to first byte.

AMC-OS 1.44M Boot Floppy disks are in standard FAT12 format and contains the adequate header. There lasts only 451 bytes to :

  • Load the FAT and Root directory (\) listing in memory
  • Locate AMCOSLDR.IMG and AMCOSLDR.SYS files in the root directory
  • Load the files in memory
  • Switch execution to AMC-OS Loader

The boot loader uses BIOS support through INT 13H for I/O functions. In case of error during execution, the boot loader will display :

  • FIL? or File not found if one of the required files hasn't been found in the root directory
  • DSK? or Read error if a read error occured (probably defective disk)

AMC-OS Loader

See complete article : AMC-OS Loader