Wtf is happening

master
E. Almqvist 3 years ago
parent 2ae646ede5
commit 29e3c5303d
  1. 13
      drivers/vga.c
  2. 1
      drivers/vga.h
  3. 17
      kernel/idt.c
  4. 4
      kernel/idt.h
  5. 4
      kernel/isr.asm
  6. 23
      kernel/kernel.c

@ -69,10 +69,19 @@ void print(char* str, int attribute_byte) {
cursor_col += strlen(str);
}
void new_line() {
cursor_row++;
cursor_col = 0;
}
void println(char* str, int attribute_byte) {
if( cursor_row > MAX_ROWS ) {
set_cursor_pos(0, MAX_ROWS);
println(str, attribute_byte);
return;
}
print(str, attribute_byte);
cursor_row++; // Increment to next y-pos (newline)
cursor_col = 0;
new_line();
}
void printint(int i, int attribute_byte) {

@ -20,6 +20,7 @@ void clear_row(unsigned int row);
void set_cursor_pos();
void print();
void println();
void new_line();
void printint(int i, int attribute_byte);
void printalign(char* str, int attribute_byte, enum align alignment);
void vga_init();

@ -18,13 +18,18 @@ static idt_entry IDT[IDT_MAX_DESCS];
static idtr IDTR;
void exception_handler() {
__asm__ __volatile__("cli; hlt");
}
uint* debug_ptr = 0xe222;
uint8 debug = *debug_ptr;
char* buf;
new_line();
print("Exception: ", INT_COLOR);
buf = itoa(debug, buf, 10);
println(buf, 0x0f);
void interupt_handler() {
__asm__("pusha");
// handle stuff
__asm__("popa; leave; iret");
//__asm__ __volatile__("cli; hlt");
}
void idt_set_desc(uint8 idx, void* isr, uint8 flags) {

@ -1,12 +1,10 @@
#include "../lib/types.h"
#define IDT_MAX_DESCS 256
#define INT_COLOR 0x08
__attribute__((noreturn))
void exception_handler();
__attribute__((noreturn))
void interupt_handler();
void idt_set_desc(uint8, void*, uint8);
void idt_init();

@ -1,13 +1,15 @@
; osdev crap
isr_debug_ptr equ 0xe222
%macro isr_err_stub 1
isr_stub_%+%1:
mov [isr_debug_ptr], byte %1
call exception_handler
iret
%endmacro
%macro isr_no_err_stub 1
isr_stub_%+%1:
mov [isr_debug_ptr], byte %1
call exception_handler
iret
%endmacro

@ -1,6 +1,7 @@
#include "kernel.h"
void print_kernel_motd() {
set_cursor_pos(0, 0);
printalign(" ___ ____ ", BANNER_COLOR, MIDDLE);
printalign(" ___ / _ \\/ ___| ", BANNER_COLOR, MIDDLE);
printalign(" / _ \\ | | \\___ \\ ", BANNER_COLOR, MIDDLE);
@ -50,15 +51,6 @@ void print_kernel_stats() {
buf = itoa(MAX_ROWS, buf, 10);
println(buf, DEFAULT_COLOR);
uint i = 0;
set_cursor_pos(0, 9);
printalign("[Ticks since boot]", 0xf0, MIDDLE);
while(true) {
set_cursor_pos(0, 10);
buf = itoa(i, buf, 10);
printalign(buf, 0x0f, MIDDLE);
++i;
}
}
void kernel_init() {
@ -73,5 +65,16 @@ void kernel_init() {
clear_screen();
print_kernel_motd();
print_kernel_stats();
char* buf;
uint i = 0;
set_cursor_pos(0, 9);
printalign("[Ticks since boot]", 0xf0, MIDDLE);
while(true) {
set_cursor_pos(0, 10);
buf = itoa(i, buf, 10);
printalign(buf, 0x0f, MIDDLE);
++i;
}
//print_kernel_stats();
}

Loading…
Cancel
Save