Merge pull request #34 from E-Almqvist/dev

Refactor & cleanup
malloc
Elias Almqvist 3 years ago committed by GitHub
commit 2329765779
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      Makefile
  2. 2
      README.md
  3. 7
      bootloader/bios.asm
  4. 45
      bootloader/bootloader.asm
  5. 37
      bootloader/pm.asm

@ -12,7 +12,7 @@ drun: clean run
grub: eOS.iso grub: eOS.iso
qemu-system-x86_64 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 mkdir -p boot/grub
cp $< boot/eOS.bin cp $< boot/eOS.bin
cp grub/grub.cfg boot/grub/grub.cfg cp grub/grub.cfg boot/grub/grub.cfg
@ -35,4 +35,4 @@ kernel.bin: kernel/kernel_entry.o $(OBJ)
clean: clean:
rm -fr *.bin *.dis *.o os-image *.map boot/ *.iso 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

@ -7,7 +7,7 @@ Use the `Makefile` in order to build the binaries/objects et cetera- with <a hre
<br> <br>
**To build the OS image run**: `$ make os-image` **To build the OS image run**: `$ make os-image`
<br> <br>
**To build the OS image (WITH GRUB) run**: `$ make grub` **To build the OS image (WITH GRUB) run**: `$ make eOS.iso`
#### Emulation #### Emulation
You can launch eOS with a VM like <a href="https://www.qemu.org/documentation/" target="_blank">qemu</a>. Launch *qemu* via *make* by running: `$ make run`. You can launch eOS with a VM like <a href="https://www.qemu.org/documentation/" target="_blank">qemu</a>. Launch *qemu* via *make* by running: `$ make run`.

@ -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"

@ -21,8 +21,49 @@
jmp $ ; inf loop jmp $ ; inf loop
%include "bootloader/equ/ascii.asm" %include "bootloader/equ/ascii.asm"
%include "bootloader/bios.asm" %include "bootloader/equ/bios.asm"
%include "bootloader/pm.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: BEGIN_PM:
; Inform of mode switch ; Inform of mode switch

@ -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
Loading…
Cancel
Save