Added multiboot header, ports methods and added new part of libc(string)

This commit is contained in:
ice-bit
2019-07-03 12:15:40 +02:00
parent 7650b9b8a2
commit 79817e6610
7 changed files with 223 additions and 0 deletions

8
kernel/cpu/Makefile Normal file
View File

@@ -0,0 +1,8 @@
OBJS = multiboot.asm.o kernel_load.asm.o ports.asm.o
ASM = nasm
ASMFLAGS = -f elf
all: $(OBJS)
%.asm.o:
$(ASM) $(ASMFLAGS) $< -o $@

View File

@@ -0,0 +1,25 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; iceOS Kernel ;
; Developed by Marco 'icebit' Cetica ;
; (c) 2019 ;
; Released under GPLv3 ;
; https://github.com/ice-bit/iceOS ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
global kernel_loader
extern main
section .text
kernel_loader:
mov esp, kernel_stack + KERNEL_STACK_SZ ; Stack pointer
push ebx
call main ; jump to kernel's main function
.loop:
jmp .loop ; endless loop
KERNEL_STACK_SZ equ 4096 ; 4 KB for the stack
section .bss
align 4
kernel_stack:
resb KERNEL_STACK_SZ ; Reserver 4 KB

20
kernel/cpu/multiboot.asm Normal file
View File

@@ -0,0 +1,20 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; iceOS Kernel ;
; Developed by Marco 'icebit' Cetica ;
; (c) 2019 ;
; Released under GPLv3 ;
; https://github.com/ice-bit/iceOS ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
section .multiboot
head_s:
dd 0xe85250d6 ; Magic number
dd 0 ; Code for protected mode
dd head_e - head_s ; Header length
dd 0x100000000 - (0xe85250d6 + 0 + (head_e - head_s)) ; Checksum of above
; Various flags
dw 0 ; type
dw 0 ; flags
dd 0 ; size
head_e:

21
kernel/cpu/ports.asm Normal file
View File

@@ -0,0 +1,21 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; iceOS Kernel ;
; Developed by Marco 'icebit' Cetica ;
; (c) 2019 ;
; Released under GPLv3 ;
; https://github.com/ice-bit/iceOS ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
global outb ; Output from port
global inb ; Input to port
outb:
mov al, [esp + 3]
mov dx, [esp + 4]
out dx, al
ret
inb:
mov dx, [esp]
in al, dx
ret