aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2021-06-03 16:47:46 +0200
committerMarvin Borner2021-06-03 16:47:46 +0200
commitf7890c4b16b5d817db286119ac0a88630c3a1cf9 (patch)
treec991a512ac36e632b3a69a165ca556174d4063c7
parent98e15f73f090c32b5197ecec0845c408d4a54608 (diff)
Smashed some dumb bugs
aargh
-rw-r--r--apps/paint/main.c1
-rw-r--r--kernel/drivers/cpu.c13
-rw-r--r--kernel/drivers/int.c3
-rw-r--r--kernel/features/proc.c3
-rwxr-xr-xrun1
5 files changed, 11 insertions, 10 deletions
diff --git a/apps/paint/main.c b/apps/paint/main.c
index 464a925..aed784c 100644
--- a/apps/paint/main.c
+++ b/apps/paint/main.c
@@ -31,6 +31,7 @@ static void color_click(struct gui_event_mouse *event)
}
// TODO: Simplify using predefined widgets and utilities
+// TODO: Fix and improve paint without KVM
int main(void)
{
u32 win = gui_new_window(APPNAME);
diff --git a/kernel/drivers/cpu.c b/kernel/drivers/cpu.c
index 44091a3..93c2cf3 100644
--- a/kernel/drivers/cpu.c
+++ b/kernel/drivers/cpu.c
@@ -156,6 +156,9 @@ CLEAR void cpu_enable_features(void)
cpu_extended_information = cpuid(0x80000001);
cpu_extended_features = cpuid(0x7);
+ // Enable NMI
+ outb(0x70, inb(0x70) & 0x7F);
+
// Enable SSE
if (cpu_features.edx & CPUID_FEAT_EDX_SSE) {
__asm__ volatile("clts");
@@ -201,11 +204,11 @@ CLEAR void cpu_enable_features(void)
}
// Enable UMIP // TODO: QEMU support?!
- if (cpu_extended_features.ecx & CPUID_EXT_FEAT_ECX_UMIP) {
- cr4_set(cr4_get() | 0x800);
- } else {
- print("No UMIP support :(\n");
- }
+ /* if (cpu_extended_features.ecx & CPUID_EXT_FEAT_ECX_UMIP) { */
+ /* cr4_set(cr4_get() | 0x800); */
+ /* } else { */
+ /* print("No UMIP support :(\n"); */
+ /* } */
}
/**
diff --git a/kernel/drivers/int.c b/kernel/drivers/int.c
index 47a2699..39462fa 100644
--- a/kernel/drivers/int.c
+++ b/kernel/drivers/int.c
@@ -109,8 +109,8 @@ static void int_trap_handler(struct int_frame *frame)
frame->eip, frame->eip - proc->entry);
printf("\t\t-> Process: [entry: %x, kstack: %x, esp %x, ustack: %x]\n", proc->entry,
proc->stack.kernel, frame->esp, proc->stack.user);
- proc_exit(proc, 1);
faulting--;
+ proc_exit(proc, 1);
} else {
while (1)
__asm__ volatile("cli\nhlt");
@@ -129,7 +129,6 @@ CLEAR void int_event_handler_add(u32 int_no, void (*handler)(void))
int_event_handlers[int_no] = handler;
}
-#include <mm.h>
static u32 int_event_handler(struct int_frame *frame)
{
u32 int_no = frame->int_no - 32;
diff --git a/kernel/features/proc.c b/kernel/features/proc.c
index ce33495..b686823 100644
--- a/kernel/features/proc.c
+++ b/kernel/features/proc.c
@@ -25,7 +25,6 @@ PROTECTED static struct list *proc_list_running = NULL;
PROTECTED static struct list *proc_list_blocked = NULL;
PROTECTED static struct list *proc_list_idle = NULL;
-// TODO: Use less memcpy and only copy relevant registers
// TODO: 20 priority queues (https://www.kernel.org/doc/html/latest/scheduler/sched-nice-design.html)
HOT FLATTEN u32 scheduler(u32 esp)
{
@@ -57,7 +56,7 @@ HOT FLATTEN u32 scheduler(u32 esp)
}
memory_switch_dir(PROC(current)->page_dir);
- tss_set_stack(PROC(current)->stack.kernel_ptr);
+ tss_set_stack(PROC(current)->stack.kernel);
fpu_restore(PROC(current));
#if DEBUG_SCHEDULER
diff --git a/run b/run
index 980a6d3..900f0d4 100755
--- a/run
+++ b/run
@@ -25,7 +25,6 @@ mode="${1}"
no_ask="${2}"
# TODO: Support q35 chipset ('-machine q35')
-# TODO: Support -enable-kvm: GPF?!
qemu_with_flags() {
network="rtl8139"
[ -e /dev/kvm ] && [ -r /dev/kvm ] && [ -w /dev/kvm ] && accel="-enable-kvm" || echo "KVM acceleration not available. Make sure your PC supports it and that you're in the KVM group"