Skip to content

Commit

Permalink
Rename main entry point to kernel_main(), Fix descriptor tables not g…
Browse files Browse the repository at this point in the history
…etting initialized, Disable stack protector (GCC)
  • Loading branch information
jonpas committed Jan 18, 2018
1 parent e8243ae commit 1c3a453
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
BIN = bin
SRC = src
CC = gcc
CFLAGS = -Wall -ffreestanding -m32 -std=gnu99 -ggdb3
CFLAGS = -Wall -ffreestanding -fno-stack-protector -m32 -std=gnu99 -ggdb3
LINK = ld
LINKFLAGS = -melf_i386 -Tlink.ld
CASM = nasm
Expand Down
2 changes: 1 addition & 1 deletion gdb.gdb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ define hook-stop
printf "\n"
end

break main
break kernel_main
continue
4 changes: 3 additions & 1 deletion src/gdt.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
; Sets up global descriptor table and interrupt descriptor table.
; Sets up global descriptor table and interrupt descriptor table

[BITS 32] ; All instructions 32-bit

[GLOBAL gdt_flush] ; Make 'gdt_flush' accessible from C

Expand Down
4 changes: 3 additions & 1 deletion src/interrupt.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
; Contains interrupt service routine wrappers.
; Contains interrupt service routine wrappers

[BITS 32] ; All instructions 32-bit

; Macro creating a stub for an ISR which does NOT pass it's own error code (adds a dummy errcode byte)
%macro ISR_NOERRCODE 1
Expand Down
5 changes: 4 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#include "monitor.h"
#include "descriptor_tables.h"

struct multiboot;

int kernel_main(struct multiboot *mboot_ptr) {
init_descriptor_tables();

monitor_clear();
monitor_write("Welcome to Tyr (");
monitor_write_hex(0x547972);
monitor_write("), the one-handed OS!\n");

asm volatile("int $0x3");
//asm volatile("int $0x4");
asm volatile("int $0x4");

return 0;
}

0 comments on commit 1c3a453

Please sign in to comment.