Printed some nice text on the screen and serial

This commit is contained in:
lucic71 2022-06-28 19:40:51 +03:00
parent 87f174c728
commit 32f6426583
5 changed files with 43 additions and 4 deletions

View File

@ -9,3 +9,4 @@ clock: sync=realtime, time0=local
cpu: count=1, ips=1000000
magic_break: enabled=1
debug_symbols: file=./kernel/os.kernel.sym
com1: enabled=1, mode=file, dev=bochs/serial.txt

View File

@ -4,7 +4,10 @@
#include "i386/idt.h"
#include "i386/context.h"
#include "kernel/serial.h"
#include <stdio.h>
#include <string.h>
/* Extern symbol defined in idt.c */
@ -92,7 +95,13 @@ void irq_handler(context_t context) {
irq_t handler = intrpt_handlers[context.int_no];
if (handler)
handler(context);
else
puts("Unhandled interrupt");
else {
char unhandled_intrpt[] = "Unhandled interrupt request\n";
serial_write(COM1, unhandled_intrpt, strlen(unhandled_intrpt));
}
}

View File

@ -3,7 +3,10 @@
#include "i386/idt.h"
#include "i386/context.h"
#include "kernel/serial.h"
#include <stdio.h>
#include <string.h>
#include <stdint.h>
/* Extern symbol defined in idt.c */
@ -137,7 +140,9 @@ char *exception_messages[] = {
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);
}

View File

@ -1,8 +1,26 @@
#include <stdio.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) {
idt_init();
irq_init();
isr_init();
serial_init(COM1);
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:");
}

View File

@ -37,6 +37,11 @@ reg_dump:
push %ebp
mov %esp, %ebp
push $NL_STR
call printf
add $0x04, %esp
push prev_eax
push $EAX_FMT
call printf
@ -98,6 +103,7 @@ reg_dump:
.data
NL_STR: .string "\n"
EAX_FMT: .string "eax: 0x%x\n"
ECX_FMT: .string "ecx: 0x%x\n"
EDX_FMT: .string "edx: 0x%x\n"