Printed some nice text on the screen and serial
This commit is contained in:
parent
87f174c728
commit
32f6426583
|
@ -9,3 +9,4 @@ clock: sync=realtime, time0=local
|
||||||
cpu: count=1, ips=1000000
|
cpu: count=1, ips=1000000
|
||||||
magic_break: enabled=1
|
magic_break: enabled=1
|
||||||
debug_symbols: file=./kernel/os.kernel.sym
|
debug_symbols: file=./kernel/os.kernel.sym
|
||||||
|
com1: enabled=1, mode=file, dev=bochs/serial.txt
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
#include "i386/idt.h"
|
#include "i386/idt.h"
|
||||||
#include "i386/context.h"
|
#include "i386/context.h"
|
||||||
|
|
||||||
|
#include "kernel/serial.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/* Extern symbol defined in idt.c */
|
/* Extern symbol defined in idt.c */
|
||||||
|
|
||||||
|
@ -92,7 +95,13 @@ void irq_handler(context_t context) {
|
||||||
irq_t handler = intrpt_handlers[context.int_no];
|
irq_t handler = intrpt_handlers[context.int_no];
|
||||||
if (handler)
|
if (handler)
|
||||||
handler(context);
|
handler(context);
|
||||||
else
|
|
||||||
puts("Unhandled interrupt");
|
else {
|
||||||
|
|
||||||
|
char unhandled_intrpt[] = "Unhandled interrupt request\n";
|
||||||
|
serial_write(COM1, unhandled_intrpt, strlen(unhandled_intrpt));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,10 @@
|
||||||
#include "i386/idt.h"
|
#include "i386/idt.h"
|
||||||
#include "i386/context.h"
|
#include "i386/context.h"
|
||||||
|
|
||||||
|
#include "kernel/serial.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/* Extern symbol defined in idt.c */
|
/* Extern symbol defined in idt.c */
|
||||||
|
@ -137,7 +140,9 @@ char *exception_messages[] = {
|
||||||
|
|
||||||
void isr_handler(context_t context) {
|
void isr_handler(context_t context) {
|
||||||
|
|
||||||
printf("Unhandled exception: %s\n", exception_messages[context.int_no]);
|
serial_write(COM1, "Unhandled exception: ", strlen("Unhandled exception: "));
|
||||||
|
serial_write(COM1, exception_messages[context.int_no], strlen(exception_messages[context.int_no]));
|
||||||
|
serial_write(COM1, "\n", 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,26 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "kernel/screen.h"
|
#include "kernel/screen.h"
|
||||||
|
#include "kernel/serial.h"
|
||||||
|
#include "kernel/kb.h"
|
||||||
|
#include "i386/isr.h"
|
||||||
|
#include "i386/irq.h"
|
||||||
|
#include "i386/idt.h"
|
||||||
|
|
||||||
void kmain(void) {
|
void kmain(void) {
|
||||||
|
|
||||||
|
idt_init();
|
||||||
|
irq_init();
|
||||||
|
isr_init();
|
||||||
|
|
||||||
|
serial_init(COM1);
|
||||||
|
|
||||||
screen_init();
|
screen_init();
|
||||||
screen_write("aa", 2);
|
kb_init();
|
||||||
|
|
||||||
|
printf("Welcome to lucicOS\n\n");
|
||||||
|
printf("If you are using bochs as emulator, check bochs/serial.txt"
|
||||||
|
" to see info about the interrupts\n");
|
||||||
|
printf("Press CTRL + Backspace to dump registers:");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,11 @@ reg_dump:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
|
|
||||||
|
push $NL_STR
|
||||||
|
call printf
|
||||||
|
|
||||||
|
add $0x04, %esp
|
||||||
|
|
||||||
push prev_eax
|
push prev_eax
|
||||||
push $EAX_FMT
|
push $EAX_FMT
|
||||||
call printf
|
call printf
|
||||||
|
@ -98,6 +103,7 @@ reg_dump:
|
||||||
|
|
||||||
.data
|
.data
|
||||||
|
|
||||||
|
NL_STR: .string "\n"
|
||||||
EAX_FMT: .string "eax: 0x%x\n"
|
EAX_FMT: .string "eax: 0x%x\n"
|
||||||
ECX_FMT: .string "ecx: 0x%x\n"
|
ECX_FMT: .string "ecx: 0x%x\n"
|
||||||
EDX_FMT: .string "edx: 0x%x\n"
|
EDX_FMT: .string "edx: 0x%x\n"
|
||||||
|
|
Loading…
Reference in New Issue