BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / commit / 08afe80d1ca157b9cddb31ee48ab0e6e1823f559 / kernel

// Related

Nucleus

Barry Object manager and heap in kernel library 08afe80 (3 years, 2 months ago)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index be56047..e7ab334 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -12,7 +12,7 @@
  */
 
 #include <nucleus/cpu.h>
-#include <nucleus/memory.h>
+#include <nucleus/lib.h>
 #include <nucleus/task.h>
 #include "desc.h"
 
diff --git a/kernel/idt.c b/kernel/idt.c
index dc596f4..0f2bdfd 100644
--- a/kernel/idt.c
+++ b/kernel/idt.c
@@ -43,13 +43,8 @@ void
 isr_handler(struct InterruptFrame frame)
 {
 	if (!interrupts[frame.intnum] && frame.intnum < 32)
-		panic("[CPU#%d] Failed to handle exception %d (%#.8x) @ %#.8x",
-		      cpu->id, frame.intnum, frame.err, frame.eip);
-
-	/* Run registered handler */
-	int_handler_t handler = interrupts[frame.intnum];
-	if (handler)
-		handler(&frame);
+		panic("Failed to handle exception %d (%#.8x) @ %#.8x",
+		      frame.intnum, frame.err, frame.eip);
 
 	/* Send EOI */
 	if (frame.intnum >= 40 && frame.intnum < 48)
@@ -60,6 +55,11 @@ isr_handler(struct InterruptFrame frame)
 	/* Send APIC EOI */
 	if (apic)
 		LAPIC(0xB0) = 0;
+
+	/* Run registered handler */
+	int_handler_t handler = interrupts[frame.intnum];
+	if (handler)
+		handler(&frame);
 }
 
 /* Register an exception handler */
diff --git a/kernel/main.c b/kernel/main.c
index 90c102d..ac38a8e 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -19,7 +19,6 @@
 #include "multiboot.h"
 
 extern char _bss[], _end[];
-void page_fault_handler(struct InterruptFrame *frame);
 void ipiq_handler(struct InterruptFrame *frame);
 void cpu_load(void);
 
@@ -39,25 +38,21 @@ kmain(struct MultibootInfo *mbinfo)
 	cpu_load();
 	register_ipi(0, ipiq_handler);
 
-	/* Initialise paging */
+	/* Initialise sub-systems */
 	init_paging();
-	/* Initialise multitasking */
 	init_tasking();
-	/* Initialise the VFS */
 	init_vfs();
 	/* Search ACPI tables */
 	init_acpi(ebda);
 	init_pci();
 
-	/* Enable userspace page-fault handler */
-	register_exception(14, page_fault_handler);
-
 	/* Mount drive */
 	mkdir("root", 0);
 	mount("/dev/hd0", "/root", "ext2fs", MS_RDONLY, NULL);
 	chroot("/root");
 	chdir("/");
 	mount("devfs", "/dev", "devfs", 0, NULL);
+	mount("tmpfs", "/tmp", "tmpfs", 0, NULL);
 
 	/* Start init */
 	char *argv[] = { "init", NULL };
diff --git a/kernel/uname.c b/kernel/uname.c
index a9ec735..c0bb421 100644
--- a/kernel/uname.c
+++ b/kernel/uname.c
@@ -9,7 +9,7 @@
 #include <nucleus/memory.h>
 
 static const char *SYSNAME = "Nucleus";
-static const char *RELEASE = "0.9.3";
+static const char *RELEASE = "0.9.4";
 static const char *VERSION = "SMP PREEMPT "__DATE__" "__TIME__;
 static const char *MACHINE = "x86";
 
@@ -17,17 +17,11 @@ static const char *MACHINE = "x86";
 int
 uname(struct utsname *buf)
 {
+	if (!buf || !verify_access(buf, sizeof(struct utsname), PROT_WRITE))
+		return -EFAULT;
 	strcpy(buf->sysname, SYSNAME);
 	strcpy(buf->release, RELEASE);
 	strcpy(buf->version, VERSION);
 	strcpy(buf->machine, MACHINE);
-}
-
-/* Kernel information system call */
-int
-sys_uname(struct utsname *buf)
-{
-	if (!buf || !verify_access(buf, sizeof(struct utsname), PROT_WRITE))
-		return -EFAULT;
-	uname(buf);
+	return 0;
 }