aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMarvin Borner2021-02-21 15:45:41 +0100
committerMarvin Borner2021-02-21 15:45:41 +0100
commitafeb7e4f00eff33e9e1cfcb766825e7c87f5f1d1 (patch)
tree87572c38c6cfd3bf49119ecb63de2e8c3ad4fb02 /kernel
parent17b83714ecc713f3faebf668a3d286e531f41859 (diff)
Activated SSE/FPU features for better performance
Diffstat (limited to 'kernel')
-rw-r--r--kernel/drivers/fpu.c24
-rw-r--r--kernel/drivers/mouse.c4
-rw-r--r--kernel/features/proc.c4
-rw-r--r--kernel/inc/proc.h2
-rw-r--r--kernel/main.c1
5 files changed, 10 insertions, 25 deletions
diff --git a/kernel/drivers/fpu.c b/kernel/drivers/fpu.c
deleted file mode 100644
index e61e267..0000000
--- a/kernel/drivers/fpu.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// MIT License, Copyright (c) 2020 Marvin Borner
-
-#include <def.h>
-
-void set_fpu_cw(const u16 cw)
-{
- __asm__ volatile("fldcw %0" ::"m"(cw));
-}
-
-void fpu_install(void)
-{
- __asm__ volatile("clts");
- u32 t = 0;
- __asm__ volatile("mov %%cr0, %0" : "=r"(t));
- t &= (u32) ~(1 << 2);
- t |= (1 << 1);
- __asm__ volatile("mov %0, %%cr0" ::"r"(t));
-
- __asm__ volatile("mov %%cr4, %0" : "=r"(t));
- t |= 3 << 9;
- __asm__ volatile("mov %0, %%cr4" ::"r"(t));
-
- __asm__ volatile("fninit");
-}
diff --git a/kernel/drivers/mouse.c b/kernel/drivers/mouse.c
index 6f329aa..e2f7311 100644
--- a/kernel/drivers/mouse.c
+++ b/kernel/drivers/mouse.c
@@ -116,6 +116,10 @@ void mouse_install(void)
mouse_serial_wait(1);
outb(0x60, status);
+ // Use default settings
+ mouse_serial_write(0xF6);
+ mouse_serial_read();
+
// Enable mousewheel
mouse_serial_write(0xF2);
mouse_serial_read();
diff --git a/kernel/features/proc.c b/kernel/features/proc.c
index 0c8f75c..d5cc82c 100644
--- a/kernel/features/proc.c
+++ b/kernel/features/proc.c
@@ -68,6 +68,9 @@ void scheduler(struct regs *regs)
regs->eflags = EFLAGS_ALWAYS | EFLAGS_INTERRUPTS;
}
+ if (current == idle_proc)
+ quantum = 0;
+
/* printf("{%d}", ((struct proc *)current->data)->pid); */
}
@@ -481,6 +484,7 @@ void proc_init(void)
((u32 *)_esp)[0] = argc; // First argument (argc)
((u32 *)_esp)[1] = (u32)argv; // Second argument (argv)
+ printf("Jumping to userspace!\n");
proc_jump_userspace();
while (1) {
};
diff --git a/kernel/inc/proc.h b/kernel/inc/proc.h
index a727210..cd74b40 100644
--- a/kernel/inc/proc.h
+++ b/kernel/inc/proc.h
@@ -9,7 +9,7 @@
#include <stack.h>
#include <sys.h>
-#define PROC_QUANTUM 42 // Milliseconds or something // TODO
+#define PROC_QUANTUM 10 // Milliseconds or something // TODO
#define EFLAGS_ALWAYS 0x2 // Always one
#define EFLAGS_INTERRUPTS 0x200 // Enable interrupts
diff --git a/kernel/main.c b/kernel/main.c
index 5216401..dea92d7 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -27,6 +27,7 @@ void kernel_main(struct vid_info *vid_info)
serial_print("\nKernel was compiled at " __TIME__ " on " __DATE__ "\n");
serial_print("Serial connected.\n");
+ cpu_enable_features();
cpu_print();
// Install drivers