Nyanix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit e3330369a3c6220d233cebb937ce59304622a9b7
parent 6d3f065c62a3099c26de4128e68777dae9dc1774
Author: Dani Frisk <dani@silverskin.fi>
Date:   Fri,  3 Aug 2018 13:41:30 +0300

Added file kernel_loader for loading kernel.

Diffstat:
src/kernel_loader.s | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+), 0 deletions(-)

diff --git a/src/kernel_loader.s b/src/kernel_loader.s @@ -0,0 +1,61 @@ +; ========================================================================== ; +; This file contains code responsible for rest of the loading process. ; +; At this point, usage of A20 line has been enabled, we've loaded a little ; +; GDT, swapped to 32-bit protected mode, and saved Real mode Data segment & ; +; Boot device to: ; +; BOOT_DEV_DB ; +; REALMODE_DB ; +; ========================================================================== ; + +%ifndef KERNEL_LOADER_S +%define KERNEL_LOADER_S 1 + +%define V8086_MODE_ON 1 +%define V8086_MODE_OFF 0 + +[ BITS 32 ] +; ========================================================================== ; +; The main function of this file. All rest of the functions are called from ; +; this function. ; +; Referring to cs.emu.edu(1), many of bootloaders do achieve ; +; high-memory disk read by constantly swapping between 16 and 32 bit mode. ; +; The constant swaps allows us to use both BIOS interrupts, and 32-bit ; +; addressing. ; +; ========================================================================== ; +kernel_loader: + push ebp + mov ebp, esp + + + + mov esp, ebp + pop ebp + +; ========================================================================== ; +; The memory area reserved for different sort of variables we'll use between ; +; 16 and 32 bit modes. ; +; ========================================================================== ; +KERNEL_LOCATION dw 0 +KERNEL_SIZE dw 0 +KERNEL_ENTRY dw 0 +SECTORS_LOADED db 0 +MULTIBOOT_LOCATION dw 0 +RUNMODE db 0 ; v8086 MODE + +; ========================================================================== ; +; Functions used by kernel_loader for different purposes. ; +; Helper functions for these functions can be found belowe these. ; +; NOTE: Define bitness for every function belove this line! ; +; ========================================================================== ; + + + +; ========================================================================== ; +; Helper functions for kernel loading process. ; +; ========================================================================== ; + + +times SECTOR_COUNT * 1024 - ($-$$) db 0 + +%endif +