aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2015-03-01 14:20:47 -0500
committerFranklin Wei <frankhwei536@gmail.com>2015-03-01 14:20:47 -0500
commitc7252588ebb95f97631e9470778c69afa00c35b5 (patch)
tree06d760878e18f6cddbe4305cddd4d5dfa74529f8
parentb8f54e63d2b8f8007c580adf2a6034c98a0f2eaa (diff)
downloadkappa-c7252588ebb95f97631e9470778c69afa00c35b5.zip
kappa-c7252588ebb95f97631e9470778c69afa00c35b5.tar.gz
kappa-c7252588ebb95f97631e9470778c69afa00c35b5.tar.bz2
kappa-c7252588ebb95f97631e9470778c69afa00c35b5.tar.xz
Huge restructure
-rw-r--r--Makefile6
-rw-r--r--OBJ34
-rw-r--r--arch/i686/boot/head.S (renamed from boot/head.S)0
-rw-r--r--arch/i686/drivers/gfx-as.S (renamed from drivers/gfx-as.S)0
-rw-r--r--arch/i686/drivers/gfx.c (renamed from drivers/gfx.c)0
-rw-r--r--arch/i686/drivers/pcspkr.c (renamed from drivers/pcspkr.c)0
-rw-r--r--arch/i686/drivers/ps2kbd.c (renamed from drivers/ps2kbd.c)0
-rw-r--r--arch/i686/drivers/vgatext.c (renamed from drivers/vgatext.c)0
-rw-r--r--arch/i686/fpu.c (renamed from kernel/fpu.c)0
-rw-r--r--arch/i686/gdt-as.S (renamed from kernel/gdt-as.S)0
-rw-r--r--arch/i686/gdt.c (renamed from kernel/gdt.c)0
-rw-r--r--arch/i686/idt-as.S (renamed from kernel/idt-as.S)0
-rw-r--r--arch/i686/idt.c (renamed from kernel/idt.c)0
-rw-r--r--arch/i686/irq-as.S (renamed from kernel/irq-as.S)0
-rw-r--r--arch/i686/irq.c (renamed from kernel/irq.c)0
-rw-r--r--arch/i686/isr-as.S (renamed from kernel/isr-as.S)0
-rw-r--r--arch/i686/isr.c (renamed from kernel/isr.c)0
-rw-r--r--arch/i686/linker.ld (renamed from kernel/linker.ld)0
-rw-r--r--arch/i686/paging-as.S (renamed from kernel/paging-as.S)0
-rw-r--r--arch/i686/paging.c (renamed from kernel/paging.c)0
-rw-r--r--include/arch/i686/drivers/gfx.h (renamed from drivers/include/gfx.h)0
-rw-r--r--include/arch/i686/drivers/gfx_font.h (renamed from drivers/include/gfx_font.h)0
-rw-r--r--include/arch/i686/drivers/pcspkr.h (renamed from drivers/include/pcspkr.h)0
-rw-r--r--include/arch/i686/drivers/ps2_keymaps.h (renamed from drivers/include/ps2_keymaps.h)0
-rw-r--r--include/arch/i686/drivers/ps2kbd.h (renamed from drivers/include/ps2kbd.h)0
-rw-r--r--include/arch/i686/drivers/vgatext.h (renamed from drivers/include/vgatext.h)0
-rw-r--r--include/arch/i686/fpu.h (renamed from kernel/include/fpu.h)0
-rw-r--r--include/arch/i686/gdt.h (renamed from kernel/include/gdt.h)0
-rw-r--r--include/arch/i686/idt.h (renamed from kernel/include/idt.h)0
-rw-r--r--include/arch/i686/irq.h (renamed from kernel/include/irq.h)0
-rw-r--r--include/arch/i686/isr.h (renamed from kernel/include/isr.h)0
-rw-r--r--include/arch/i686/paging.h (renamed from kernel/include/paging.h)0
-rw-r--r--include/arch/i686/timer.h (renamed from kernel/include/timer.h)0
-rw-r--r--include/kernel/heap.h (renamed from kernel/include/heap.h)0
-rw-r--r--include/kernel/io.h (renamed from kernel/include/io.h)0
-rw-r--r--include/kernel/log.h (renamed from kernel/include/log.h)0
-rw-r--r--include/kernel/multiboot.h (renamed from kernel/include/multiboot.h)0
-rw-r--r--include/kernel/panic.h (renamed from kernel/include/panic.h)0
-rw-r--r--include/kernel/task.c16
-rw-r--r--include/kernel/task.h10
-rw-r--r--include/kernel/version.h (renamed from kernel/include/version.h)0
-rw-r--r--include/stdio.h (renamed from libc/include/stdio.h)0
-rw-r--r--include/stdlib.h (renamed from libc/include/stdlib.h)0
-rw-r--r--include/string.h (renamed from libc/include/string.h)0
-rw-r--r--kernel/main.c2
-rw-r--r--kernel/ssp.c19
46 files changed, 48 insertions, 39 deletions
diff --git a/Makefile b/Makefile
index cfa96c0..f2a11a7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
OBJ := $(shell cat OBJ)
CC = gcc
LD = ld
-INCLUDES = -Idrivers/include -Ikernel/include -Ilibc/include -Iapps/
+INCLUDES = -Iinclude -Iapps -Iinclude/arch/i686 -Iinclude/arch/i686/drivers -Iinclude/kernel
CFLAGS = -std=gnu99 -ffreestanding -fno-stack-protector -nostdlib -Wall -Wextra -m32 $(INCLUDES) -g
OPTFLAGS = -fexpensive-optimizations -ftree-loop-vectorize -finline-functions -fomit-frame-pointer -ftree-vectorize -O1 -mtune=generic
@@ -35,10 +35,10 @@ kappa.iso: kappa.bin
@grub-mkrescue -o kappa.iso $(ISODIR) 2> /dev/null
kappa.bin: $(OBJ) $(SOURCES) Makefile
- @$(LD) -T kernel/linker.ld -o kappa.bin -melf_i386 $(OBJ) -L /usr/lib32 -lgcc_s -static
@echo "LD $@"
+ @$(LD) -T arch/i686/linker.ld -o kappa.bin -melf_i386 $(OBJ) -L /usr/lib32 -lgcc_s -static
-drivers/gfx.o: drivers/gfx.c Makefile
+arch/i686/drivers/gfx.o: arch/i686/drivers/gfx.c Makefile
@echo "CC $<"
@$(CC) $(CFLAGS) -O3 -msse -c $< -o $@
diff --git a/OBJ b/OBJ
index f8b9faa..ce6fff4 100644
--- a/OBJ
+++ b/OBJ
@@ -7,29 +7,29 @@ apps/xracer/map.o
apps/xracer/maps.o
apps/xracer/sprite.o
apps/xracer/util.o
-boot/head.o
-drivers/gfx-as.o
-drivers/gfx.o
+arch/i686/boot/head.o
+arch/i686/drivers/gfx-as.o
+arch/i686/drivers/gfx.o
+arch/i686/drivers/pcspkr.o
+arch/i686/drivers/ps2kbd.o
+arch/i686/drivers/vgatext.o
+arch/i686/fpu.o
+arch/i686/gdt-as.o
+arch/i686/gdt.o
+arch/i686/idt-as.o
+arch/i686/idt.o
+arch/i686/irq-as.o
+arch/i686/irq.o
+arch/i686/isr-as.o
+arch/i686/isr.o
+arch/i686/paging-as.o
+arch/i686/paging.o
drivers/gfx_font.o
-drivers/pcspkr.o
drivers/ps2_keymaps.o
-drivers/ps2kbd.o
-drivers/vgatext.o
-kernel/fpu.o
-kernel/gdt-as.o
-kernel/gdt.o
kernel/heap.o
-kernel/idt-as.o
-kernel/idt.o
kernel/io.o
-kernel/irq-as.o
-kernel/irq.o
-kernel/isr-as.o
-kernel/isr.o
kernel/log.o
kernel/main.o
-kernel/paging.o
-kernel/paging-as.o
kernel/panic.o
kernel/timer.o
libc/stdio.o
diff --git a/boot/head.S b/arch/i686/boot/head.S
index 9118c20..9118c20 100644
--- a/boot/head.S
+++ b/arch/i686/boot/head.S
diff --git a/drivers/gfx-as.S b/arch/i686/drivers/gfx-as.S
index a58fa12..a58fa12 100644
--- a/drivers/gfx-as.S
+++ b/arch/i686/drivers/gfx-as.S
diff --git a/drivers/gfx.c b/arch/i686/drivers/gfx.c
index 2f4864b..2f4864b 100644
--- a/drivers/gfx.c
+++ b/arch/i686/drivers/gfx.c
diff --git a/drivers/pcspkr.c b/arch/i686/drivers/pcspkr.c
index 33c0540..33c0540 100644
--- a/drivers/pcspkr.c
+++ b/arch/i686/drivers/pcspkr.c
diff --git a/drivers/ps2kbd.c b/arch/i686/drivers/ps2kbd.c
index 29d02dc..29d02dc 100644
--- a/drivers/ps2kbd.c
+++ b/arch/i686/drivers/ps2kbd.c
diff --git a/drivers/vgatext.c b/arch/i686/drivers/vgatext.c
index d0633af..d0633af 100644
--- a/drivers/vgatext.c
+++ b/arch/i686/drivers/vgatext.c
diff --git a/kernel/fpu.c b/arch/i686/fpu.c
index f5512d6..f5512d6 100644
--- a/kernel/fpu.c
+++ b/arch/i686/fpu.c
diff --git a/kernel/gdt-as.S b/arch/i686/gdt-as.S
index 5a481e3..5a481e3 100644
--- a/kernel/gdt-as.S
+++ b/arch/i686/gdt-as.S
diff --git a/kernel/gdt.c b/arch/i686/gdt.c
index 36a0cda..36a0cda 100644
--- a/kernel/gdt.c
+++ b/arch/i686/gdt.c
diff --git a/kernel/idt-as.S b/arch/i686/idt-as.S
index d1ab7e2..d1ab7e2 100644
--- a/kernel/idt-as.S
+++ b/arch/i686/idt-as.S
diff --git a/kernel/idt.c b/arch/i686/idt.c
index 0108991..0108991 100644
--- a/kernel/idt.c
+++ b/arch/i686/idt.c
diff --git a/kernel/irq-as.S b/arch/i686/irq-as.S
index 1d16392..1d16392 100644
--- a/kernel/irq-as.S
+++ b/arch/i686/irq-as.S
diff --git a/kernel/irq.c b/arch/i686/irq.c
index c6dbf4c..c6dbf4c 100644
--- a/kernel/irq.c
+++ b/arch/i686/irq.c
diff --git a/kernel/isr-as.S b/arch/i686/isr-as.S
index 858ce47..858ce47 100644
--- a/kernel/isr-as.S
+++ b/arch/i686/isr-as.S
diff --git a/kernel/isr.c b/arch/i686/isr.c
index e6887c6..e6887c6 100644
--- a/kernel/isr.c
+++ b/arch/i686/isr.c
diff --git a/kernel/linker.ld b/arch/i686/linker.ld
index c032991..c032991 100644
--- a/kernel/linker.ld
+++ b/arch/i686/linker.ld
diff --git a/kernel/paging-as.S b/arch/i686/paging-as.S
index cafaab4..cafaab4 100644
--- a/kernel/paging-as.S
+++ b/arch/i686/paging-as.S
diff --git a/kernel/paging.c b/arch/i686/paging.c
index 9d748ab..9d748ab 100644
--- a/kernel/paging.c
+++ b/arch/i686/paging.c
diff --git a/drivers/include/gfx.h b/include/arch/i686/drivers/gfx.h
index 5e97100..5e97100 100644
--- a/drivers/include/gfx.h
+++ b/include/arch/i686/drivers/gfx.h
diff --git a/drivers/include/gfx_font.h b/include/arch/i686/drivers/gfx_font.h
index f7db9d7..f7db9d7 100644
--- a/drivers/include/gfx_font.h
+++ b/include/arch/i686/drivers/gfx_font.h
diff --git a/drivers/include/pcspkr.h b/include/arch/i686/drivers/pcspkr.h
index 84e640f..84e640f 100644
--- a/drivers/include/pcspkr.h
+++ b/include/arch/i686/drivers/pcspkr.h
diff --git a/drivers/include/ps2_keymaps.h b/include/arch/i686/drivers/ps2_keymaps.h
index 0e8ae26..0e8ae26 100644
--- a/drivers/include/ps2_keymaps.h
+++ b/include/arch/i686/drivers/ps2_keymaps.h
diff --git a/drivers/include/ps2kbd.h b/include/arch/i686/drivers/ps2kbd.h
index 9e353ee..9e353ee 100644
--- a/drivers/include/ps2kbd.h
+++ b/include/arch/i686/drivers/ps2kbd.h
diff --git a/drivers/include/vgatext.h b/include/arch/i686/drivers/vgatext.h
index 1cfe4c4..1cfe4c4 100644
--- a/drivers/include/vgatext.h
+++ b/include/arch/i686/drivers/vgatext.h
diff --git a/kernel/include/fpu.h b/include/arch/i686/fpu.h
index 0eb448a..0eb448a 100644
--- a/kernel/include/fpu.h
+++ b/include/arch/i686/fpu.h
diff --git a/kernel/include/gdt.h b/include/arch/i686/gdt.h
index 4cf7c4f..4cf7c4f 100644
--- a/kernel/include/gdt.h
+++ b/include/arch/i686/gdt.h
diff --git a/kernel/include/idt.h b/include/arch/i686/idt.h
index 250ab82..250ab82 100644
--- a/kernel/include/idt.h
+++ b/include/arch/i686/idt.h
diff --git a/kernel/include/irq.h b/include/arch/i686/irq.h
index 13461e9..13461e9 100644
--- a/kernel/include/irq.h
+++ b/include/arch/i686/irq.h
diff --git a/kernel/include/isr.h b/include/arch/i686/isr.h
index 4cc7f1b..4cc7f1b 100644
--- a/kernel/include/isr.h
+++ b/include/arch/i686/isr.h
diff --git a/kernel/include/paging.h b/include/arch/i686/paging.h
index 0481069..0481069 100644
--- a/kernel/include/paging.h
+++ b/include/arch/i686/paging.h
diff --git a/kernel/include/timer.h b/include/arch/i686/timer.h
index 7a15949..7a15949 100644
--- a/kernel/include/timer.h
+++ b/include/arch/i686/timer.h
diff --git a/kernel/include/heap.h b/include/kernel/heap.h
index dfadf36..dfadf36 100644
--- a/kernel/include/heap.h
+++ b/include/kernel/heap.h
diff --git a/kernel/include/io.h b/include/kernel/io.h
index d1177ac..d1177ac 100644
--- a/kernel/include/io.h
+++ b/include/kernel/io.h
diff --git a/kernel/include/log.h b/include/kernel/log.h
index 1a28c0d..1a28c0d 100644
--- a/kernel/include/log.h
+++ b/include/kernel/log.h
diff --git a/kernel/include/multiboot.h b/include/kernel/multiboot.h
index e1f7cf0..e1f7cf0 100644
--- a/kernel/include/multiboot.h
+++ b/include/kernel/multiboot.h
diff --git a/kernel/include/panic.h b/include/kernel/panic.h
index db53e8e..db53e8e 100644
--- a/kernel/include/panic.h
+++ b/include/kernel/panic.h
diff --git a/include/kernel/task.c b/include/kernel/task.c
new file mode 100644
index 0000000..ecc0042
--- /dev/null
+++ b/include/kernel/task.c
@@ -0,0 +1,16 @@
+#include "task.h"
+
+void task_create(struct task_t *task, void (*func)(void), uint32_t flags, uint32_t *pagedir)
+{
+ task->regs.eax = 0;
+ task->regs.ebx = 0;
+ task->regs.ecx = 0;
+ task->regs.edx = 0;
+ task->regs.esi = 0;
+ task->regs.edi = 0;
+ task->regs.eflags = flags;
+ task->regs.eip = (uint32_t)main;
+ task->regs.cr3 = (uint32_t)pagedir;
+ task->regs.esp = kmalloc(0x1000) + 0x1000;
+ task->next = NULL;
+}
diff --git a/include/kernel/task.h b/include/kernel/task.h
new file mode 100644
index 0000000..86beed3
--- /dev/null
+++ b/include/kernel/task.h
@@ -0,0 +1,10 @@
+#include <stdint.h>
+
+struct taskregs_t {
+ uint32_t eax, ebx, ecx, edx, esi, edi, esp, ebp, eip, eflags, cr3;
+};
+
+struct task_t {
+ struct taskregs_t regs;
+ struct task_t *next;
+};
diff --git a/kernel/include/version.h b/include/kernel/version.h
index 8fff367..8fff367 100644
--- a/kernel/include/version.h
+++ b/include/kernel/version.h
diff --git a/libc/include/stdio.h b/include/stdio.h
index 49966cf..49966cf 100644
--- a/libc/include/stdio.h
+++ b/include/stdio.h
diff --git a/libc/include/stdlib.h b/include/stdlib.h
index f55f0f5..f55f0f5 100644
--- a/libc/include/stdlib.h
+++ b/include/stdlib.h
diff --git a/libc/include/string.h b/include/string.h
index 05050a0..05050a0 100644
--- a/libc/include/string.h
+++ b/include/string.h
diff --git a/kernel/main.c b/kernel/main.c
index 76c62f8..540bdcc 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -266,7 +266,9 @@ static void keyhandler(const struct ps2_keyevent *ev)
putchar(toupper(ev->ascii));
}
else
+ {
putchar(ev->ascii);
+ }
}
}
diff --git a/kernel/ssp.c b/kernel/ssp.c
deleted file mode 100644
index ad47bb4..0000000
--- a/kernel/ssp.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdint.h>
-#include "panic.h"
-
-#if UINT32_MAX == UINTPTR_MAX
-#define STACK_CHK_GUARD 0xdeadbeef
-#else
-#define STACK_CHK_GUARD 0x0ddc0ffeebadf00d
-#endif
-
-uintptr_t __stack_chk_guard = STACK_CHK_GUARD;
-
-__attribute__((noreturn)) void __stack_chk_fail(void)
-{
-#if __STDC_HOSTED__
- abort();
-#else
- panic("Stack smashing detected");
-#endif
-}