summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/hal
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/hal')
-rw-r--r--arch/x86_64/hal/gdt.c2
-rw-r--r--arch/x86_64/hal/idt.c3
-rw-r--r--arch/x86_64/hal/serial_com.c26
-rw-r--r--arch/x86_64/hal/serial_com.h8
-rw-r--r--arch/x86_64/hal/smp.c9
5 files changed, 18 insertions, 30 deletions
diff --git a/arch/x86_64/hal/gdt.c b/arch/x86_64/hal/gdt.c
index fc7aa8b..8bfe942 100644
--- a/arch/x86_64/hal/gdt.c
+++ b/arch/x86_64/hal/gdt.c
@@ -63,7 +63,7 @@ gdt_setup(processor_t *processor)
load_gdt(&gdtr);
uintptr_t tss_base = (uintptr_t)&processor->tss;
- size_t tss_limit = sizeof(struct tss);
+ size_t tss_limit = sizeof(struct tss) + 0x2000;
struct gdt_entry *tss_lo = &processor->gdt[GDT_TSS_LO];
struct gdt_entry *tss_hi = &processor->gdt[GDT_TSS_HI];
diff --git a/arch/x86_64/hal/idt.c b/arch/x86_64/hal/idt.c
index ff7a8a0..7b8bd52 100644
--- a/arch/x86_64/hal/idt.c
+++ b/arch/x86_64/hal/idt.c
@@ -20,8 +20,7 @@ struct int_user_handle __int_user_handles[IDT_ENTRIES];
static struct int_stackframe*
s_int_handle_stub(struct int_stackframe* frame)
{
- kprintf("Unhandled interrupt %i at %p\n", frame->int_num, frame->int_rip);
- hcf();
+ kpanic_istate(frame, "Unhandled interrupt %i at %p\n", frame->int_num, frame->int_rip);
}
struct int_stackframe*
diff --git a/arch/x86_64/hal/serial_com.c b/arch/x86_64/hal/serial_com.c
index 372a433..c571057 100644
--- a/arch/x86_64/hal/serial_com.c
+++ b/arch/x86_64/hal/serial_com.c
@@ -1,10 +1,8 @@
+#ifdef DEBUG_SERIAL
+
#include "serial_com.h"
#include "port.h"
#include "jove.h"
-#include "hal/obj.h"
-#include "proc/init.h"
-#include "lib/printf.h"
-#include "sys/objdir.h"
static int
serial_com_recv(uint16_t port)
@@ -67,27 +65,15 @@ serial_com_init(void)
if(serial_com_init_port(SERIAL_COM1, 3)) {
return;
}
-
- {
- jove_owned_obj_t *com_obj = objdir_getlocal(_rootdir_obj, INIT_ROOTDIR_SERIAL_COM_I);
- obj_settype(com_obj, JOVE_OBJ_SERIAL_COM);
- obj_setvalue(com_obj, SERIAL_COM1);
- obj_release(com_obj);
- }
-
- kprintf("Initialized COM1 on port %X for obj %X\n", SERIAL_COM1, INIT_ROOTDIR_SERIAL_COM_I);
}
int
-serial_com_write(
- jove_owned_obj_t *obj,
- const char *s, size_t len)
+serial_com_write(uint16_t port, const char *s, size_t len)
{
- if(obj_gettype(obj) != JOVE_OBJ_SERIAL_COM) {
- reterr(EBADOBJ);
- }
for(size_t i = 0; i < len; i++) {
- serial_com_putc((uint16_t)obj_getvalue(obj), s[i]);
+ serial_com_putc(port, s[i]);
}
return len;
}
+
+#endif
diff --git a/arch/x86_64/hal/serial_com.h b/arch/x86_64/hal/serial_com.h
index 2dbb0cd..cf0badc 100644
--- a/arch/x86_64/hal/serial_com.h
+++ b/arch/x86_64/hal/serial_com.h
@@ -2,7 +2,7 @@
#define _JOVE_SERIAL_COM_H 1
#include <stdint.h>
-#include "obj.h"
+#include <stddef.h>
#define SERIAL_COM1 0x3F8
@@ -19,8 +19,12 @@
#define SERIAL_COM_DLAB_BAUD_LO(com) (com)
#define SERIAL_COM_DLAB_BAUD_HI(com) (com + 1)
+#ifdef DEBUG_SERIAL
+
void serial_com_init(void);
-int serial_com_write(jove_owned_obj_t *obj, const char *s, size_t len);
+int serial_com_write(uint16_t port, const char *s, size_t len);
+
+#endif
#endif
diff --git a/arch/x86_64/hal/smp.c b/arch/x86_64/hal/smp.c
index 7d94340..931a89f 100644
--- a/arch/x86_64/hal/smp.c
+++ b/arch/x86_64/hal/smp.c
@@ -45,15 +45,14 @@ smp_init_bsp(void)
processor_t *bsp = &s_processors[0];
{
- jove_owned_obj_t *processor_objdir_obj = objdir_getlocal(_rootdir_obj, INIT_ROOTDIR_PROCESSORS_I);
- obj_settype(processor_objdir_obj, JOVE_OBJ_OBJDIR);
- obj_setvalue(processor_objdir_obj, (uintptr_t)&s_processor_objdir);
+ jove_owned_obj_t *processor_objdir = objdir_getlocal(_rootdir_obj, INIT_ROOTDIR_PROCESSORS_I);
+ obj_settype(processor_objdir, JOVE_OBJ_OBJDIR);
+ obj_setvalue(processor_objdir, (uintptr_t)&s_processor_objdir);
+ jove_obj_t *processor_objdir_obj = obj_release(processor_objdir);
jove_owned_obj_t *bsp_obj = objdir_getlocal(processor_objdir_obj, 0);
init_processor(bsp, bsp_obj);
-
obj_release(bsp_obj);
- obj_release(processor_objdir_obj);
}
idt_init();