summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--asm/asm_gdt.h7
-rw-r--r--asm/asm_gdt.s (renamed from asm/gdt.s)3
-rw-r--r--asm/asm_mp.asm (renamed from asm/mp.asm)0
-rw-r--r--asm/asm_mp.h (renamed from asm/mp.h)0
-rw-r--r--asm/gdt.h1
-rw-r--r--kernel/gdt.c2
-rw-r--r--kernel/kernel.c2
-rw-r--r--kernel/mp.c5
-rw-r--r--kernel/scheduler.c33
-rw-r--r--kernel/usermode.c45
-rw-r--r--kernel/usermode.h0
12 files changed, 45 insertions, 57 deletions
diff --git a/Makefile b/Makefile
index 75e5059..d450745 100644
--- a/Makefile
+++ b/Makefile
@@ -214,3 +214,7 @@ gitweb_readme:
### DOC ###
doxygen: clean
doxygen doxy.cfg
+
+## headers ##
+list_headers:
+ find asm/ driver/ fs/ kernel/ lib/ -iname *.h -exec basename {} \; | sort | uniq -c
diff --git a/asm/asm_gdt.h b/asm/asm_gdt.h
new file mode 100644
index 0000000..523b783
--- /dev/null
+++ b/asm/asm_gdt.h
@@ -0,0 +1,7 @@
+/**
+ * @file
+ * http://wiki.osdev.org/GDT_Tutorial
+ */
+
+/** call as asm_setup_gdt(GDT,sizeof(GDT)) */
+void asm_setup_gdt(uint32_t addr, uint32_t size)
diff --git a/asm/gdt.s b/asm/asm_gdt.s
index c155ce9..0e163fc 100644
--- a/asm/gdt.s
+++ b/asm/asm_gdt.s
@@ -1,8 +1,5 @@
-//http://wiki.osdev.org/GDT_Tutorial
.global asm_setup_gdt
-//.global tss_flush
-// call as setup_gdt(GDT,sizeof(GDT))
asm_setup_gdt:
// re-fill gdt_descriptor with new GDT location and size
diff --git a/asm/mp.asm b/asm/asm_mp.asm
index f0eb9c0..f0eb9c0 100644
--- a/asm/mp.asm
+++ b/asm/asm_mp.asm
diff --git a/asm/mp.h b/asm/asm_mp.h
index 3ace14a..3ace14a 100644
--- a/asm/mp.h
+++ b/asm/asm_mp.h
diff --git a/asm/gdt.h b/asm/gdt.h
deleted file mode 100644
index f5bcbd3..0000000
--- a/asm/gdt.h
+++ /dev/null
@@ -1 +0,0 @@
-void asm_setup_gdt(uint32_t addr, uint32_t size)
diff --git a/kernel/gdt.c b/kernel/gdt.c
index 562fbd5..d1ed382 100644
--- a/kernel/gdt.c
+++ b/kernel/gdt.c
@@ -2,8 +2,6 @@
#include "kernel/kernel.h"
#include "kernel/gdt.h"
-#include "usermode.h"
-
#include <stdint.h>
#define GDT_SIZE 6
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 9381091..7058a8a 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -58,7 +58,7 @@ void kernel_main(uint32_t eax,uint32_t ebx)
// https://wiki.osdev.org/Symmetric_Multiprocessing
klog("Symmetric Multi Processing (SMP) start ... ");
smp_log_procdata(&procdata);
- smp_start_aps(&procdata);
+ //smp_start_aps(&procdata);
klog("Vritual Memory / Paging init ... ");
pdirectory *dir=vmem_init(kernel_blocks,(uint32_t)info->framebuffer_addr);
diff --git a/kernel/mp.c b/kernel/mp.c
index e03f224..5cd58ac 100644
--- a/kernel/mp.c
+++ b/kernel/mp.c
@@ -1,13 +1,10 @@
#include "kernel/kernel.h"
-
#include <stdbool.h>
#include "asm/x86.h"
#include "smp.h"
-
-
typedef struct mp_fps_struct
{
uint32_t sig; //signature "_MP_"
@@ -49,8 +46,6 @@ typedef struct mp_config_struct
}mp_config;
-
-
typedef struct proc_struct
{
uint8_t type; //0=processor
diff --git a/kernel/scheduler.c b/kernel/scheduler.c
index cfd0fcd..5316438 100644
--- a/kernel/scheduler.c
+++ b/kernel/scheduler.c
@@ -292,3 +292,36 @@ volatile void task_set_brk(uint32_t brk)
{
task_list[current_task].brk=brk;
}
+
+void userfunc()
+{
+
+ // we need enable here again (since the pushed eflags have it disabled)!
+ x86_sti();
+
+ // if we are pid 0, replace ourselves with /bin/init and enter usermode
+ if(task_get_current_pid()==0)
+ {
+ uint32_t alloc;
+ uint32_t entry_global=load_elf(BIN_INIT,&alloc);
+ task_set_brk(alloc);
+ asm_usermode(entry_global);
+ }
+
+ // kernel worker thread: SLEEPER
+ if(task_get_current_pid()==1)
+ {
+ while(1)
+ {
+ __asm__("hlt");
+ }
+ }
+
+ // kernel worker thread: SYSCALL CHECKER
+ if(task_get_current_pid()==2)
+ {
+ task_syscall_worker();
+ }
+}
+
+
diff --git a/kernel/usermode.c b/kernel/usermode.c
deleted file mode 100644
index ee8b9db..0000000
--- a/kernel/usermode.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "usermode.h"
-
-#include "syscalls.h"
-#include "kmalloc.h"
-
-#include "asm/usermode.h"
-#include "asm/x86.h"
-#include "scheduler.h"
-#include "kernel.h"
-#include "fs/elf.h"
-
-#include <stddef.h>
-
-void userfunc()
-{
-
- // we need enable here again (since the pushed eflags have it disabled)!
- x86_sti();
-
- // if we are pid 0, replace ourselves with /bin/init and enter usermode
- if(task_get_current_pid()==0)
- {
- uint32_t alloc;
- uint32_t entry_global=load_elf(BIN_INIT,&alloc);
- task_set_brk(alloc);
- asm_usermode(entry_global);
- }
-
- // kernel worker thread: SLEEPER
- if(task_get_current_pid()==1)
- {
- while(1)
- {
- __asm__("hlt");
- }
- }
-
- // kernel worker thread: SYSCALL CHECKER
- if(task_get_current_pid()==2)
- {
- task_syscall_worker();
- }
-}
-
-
diff --git a/kernel/usermode.h b/kernel/usermode.h
deleted file mode 100644
index e69de29..0000000
--- a/kernel/usermode.h
+++ /dev/null