From ee31bd1ad70327e6c25d5a8e0b75dc24d56f192d Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Fri, 10 Sep 2021 18:16:51 +0200 Subject: [PATCH 1/4] Makefile error fix --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4c23ad8..a2d1365 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ drun: clean run grub: eOS.iso qemu-system-x86_64 eOS.iso -eOS.iso : kernel/kernel.bin grub/grub.cfg +eOS.iso : kernel.bin grub/grub.cfg mkdir -p boot/grub cp $< boot/eOS.bin cp grub/grub.cfg boot/grub/grub.cfg From 0e6ae465adade158079b052a5cf64696e9186af5 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Fri, 10 Sep 2021 18:17:23 +0200 Subject: [PATCH 2/4] README.md Update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d41b343..1f1bee4 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Use the `Makefile` in order to build the binaries/objects et cetera- with **To build the OS image run**: `$ make os-image`
-**To build the OS image (WITH GRUB) run**: `$ make grub` +**To build the OS image (WITH GRUB) run**: `$ make eOS.iso` #### Emulation You can launch eOS with a VM like
qemu. Launch *qemu* via *make* by running: `$ make run`. From 56c8319850a397715783616d97154831d0cdb807 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Sun, 12 Sep 2021 18:37:37 +0200 Subject: [PATCH 3/4] Bootloader refactor --- bootloader/bios.asm | 7 ------ bootloader/bootloader.asm | 45 +++++++++++++++++++++++++++++++++++++-- bootloader/pm.asm | 37 -------------------------------- 3 files changed, 43 insertions(+), 46 deletions(-) delete mode 100644 bootloader/bios.asm delete mode 100644 bootloader/pm.asm diff --git a/bootloader/bios.asm b/bootloader/bios.asm deleted file mode 100644 index 339a9dc..0000000 --- a/bootloader/bios.asm +++ /dev/null @@ -1,7 +0,0 @@ -; EQUs -%include "bootloader/equ/bios.asm" - -; SRs -%include "bootloader/bios/convert.asm" -%include "bootloader/bios/print.asm" -%include "bootloader/bios/disk.asm" diff --git a/bootloader/bootloader.asm b/bootloader/bootloader.asm index a5578fe..09432ff 100644 --- a/bootloader/bootloader.asm +++ b/bootloader/bootloader.asm @@ -21,8 +21,49 @@ jmp $ ; inf loop %include "bootloader/equ/ascii.asm" -%include "bootloader/bios.asm" -%include "bootloader/pm.asm" +%include "bootloader/equ/bios.asm" + +; BIOS SRs +%include "bootloader/bios/convert.asm" +%include "bootloader/bios/print.asm" +%include "bootloader/bios/disk.asm" + +; Protected Mode SRs +%include "bootloader/equ/vga.asm" +%include "bootloader/pm/vga/print.asm" + +; GDT & switching to PM +%include "bootloader/pm/gdt.asm" ; GDT defined here + +; Switching to PM +[bits 16] +pm_preinit: + cli ; Switch interupts + + lgdt [gdt_descriptor] ; Tell the CPU about the GDT + + mov eax, cr0 ; Set first bit of the CR0 register + or eax, 0x1 ; to 1 + mov cr0, eax ; Update the control register + + ; Initialize PM + jmp GDT_CODE_SEG:pm_init + +[bits 32] +; Init registers & stack when in PM +pm_init: + mov ax, GDT_DATA_SEG ; Point the segment registers to GDT_DATA_SEG + ; Segment registers + mov ds, ax + mov ss, ax + mov es, ax + mov fs, ax + mov gs, ax + + mov ebp, 0x900000 ; Update the stack pointer + mov esp, ebp + + call BEGIN_PM BEGIN_PM: ; Inform of mode switch diff --git a/bootloader/pm.asm b/bootloader/pm.asm deleted file mode 100644 index 1965d11..0000000 --- a/bootloader/pm.asm +++ /dev/null @@ -1,37 +0,0 @@ -; Utils -%include "bootloader/equ/vga.asm" -%include "bootloader/pm/vga/print.asm" - -; GDT & switching to PM -%include "bootloader/pm/gdt.asm" ; GDT defined here - -; Switching to PM -[bits 16] -pm_preinit: - cli ; Switch interupts - - lgdt [gdt_descriptor] ; Tell the CPU about the GDT - - mov eax, cr0 ; Set first bit of the CR0 register - or eax, 0x1 ; to 1 - mov cr0, eax ; Update the control register - - ; Initialize PM - jmp GDT_CODE_SEG:pm_init - -[bits 32] -; Init registers & stack when in PM -pm_init: - mov ax, GDT_DATA_SEG ; Point the segment registers to GDT_DATA_SEG - ; Segment registers - mov ds, ax - mov ss, ax - mov es, ax - mov fs, ax - mov gs, ax - - mov ebp, 0x900000 ; Update the stack pointer - mov esp, ebp - - call BEGIN_PM - From 55f3eb13b7f222be3e8e6ca0b4e395985a610ecd Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Sun, 12 Sep 2021 18:38:59 +0200 Subject: [PATCH 4/4] Makefile fix --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a2d1365..1f03904 100644 --- a/Makefile +++ b/Makefile @@ -35,4 +35,4 @@ kernel.bin: kernel/kernel_entry.o $(OBJ) clean: rm -fr *.bin *.dis *.o os-image *.map boot/ *.iso - rm -fr kernel/*.o boot/*.bin drivers/*.o + rm -fr kernel/*.o bootloader/*.bin drivers/*.o