Add: cursor & verbose output
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "gdt.h"
|
||||
#include "../libc/stdio.h"
|
||||
|
||||
struct gdt_entry
|
||||
{
|
||||
@@ -50,4 +51,5 @@ void gdt_install()
|
||||
gdt_set_gate(4, 0, 0xFFFFFFFF, 0xF2, 0xCF);
|
||||
|
||||
gdt_flush();
|
||||
printf("[kernel] GDT gates set (ring 0 and 3), gdt=0x%x\n", &gdt);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "idt.h"
|
||||
#include "system.h"
|
||||
#include "../libc/stdio.h"
|
||||
|
||||
struct idt_entry
|
||||
{
|
||||
@@ -39,4 +40,5 @@ void idt_install()
|
||||
memset(&idt, 0, sizeof(struct idt_entry)*256);
|
||||
|
||||
idt_load();
|
||||
printf("[kernel] loaded IDT at idt=0x%x\n", &idt);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "system.h"
|
||||
#include "io.h"
|
||||
#include "idt.h"
|
||||
#include "../libc/stdio.h"
|
||||
|
||||
extern void irq0();
|
||||
extern void irq1();
|
||||
@@ -69,6 +70,7 @@ void irq_install()
|
||||
idt_set_gate(45, (unsigned)irq13, 0x08, 0x8E);
|
||||
idt_set_gate(46, (unsigned)irq14, 0x08, 0x8E);
|
||||
idt_set_gate(47, (unsigned)irq15, 0x08, 0x8E);
|
||||
printf("[kernel] installed irq 0-15\n");
|
||||
}
|
||||
|
||||
void irq_handler(struct regs *r)
|
||||
|
||||
@@ -70,6 +70,7 @@ void isr_install()
|
||||
idt_set_gate(29, (unsigned)isr29, 0x08, 0x8E);
|
||||
idt_set_gate(30, (unsigned)isr30, 0x08, 0x8E);
|
||||
idt_set_gate(31, (unsigned)isr31, 0x08, 0x8E);
|
||||
printf("[kernel] set ISRs 0-31\n");
|
||||
}
|
||||
|
||||
char *exception_messages[] =
|
||||
|
||||
@@ -26,13 +26,6 @@ typedef struct {
|
||||
uint8_t tags[0];
|
||||
} multiboot2_info;
|
||||
|
||||
char* ascii_title =
|
||||
"\n"
|
||||
"*******************************\n"
|
||||
"| Blank OS version 0.3.68-dev |\n"
|
||||
"*******************************\n"
|
||||
"\n";
|
||||
|
||||
unsigned int g_multiboot_info_address;
|
||||
|
||||
uint32_t* framebuffer;
|
||||
@@ -73,7 +66,7 @@ uint8_t *tags = mb_info->tags;
|
||||
|
||||
uint32_t width = fb_info->framebuffer_width;
|
||||
uint32_t height = fb_info->framebuffer_height;
|
||||
uint32_t pitch = fb_info->framebuffer_pitch;
|
||||
//uint32_t pitch = fb_info->framebuffer_pitch;
|
||||
uint32_t bpp = fb_info->framebuffer_bpp;
|
||||
|
||||
|
||||
@@ -94,28 +87,18 @@ uint8_t *tags = mb_info->tags;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
printf("[kernel] multiboot2 info at 0x%x, size=%u\n", mb_info, mb_info->total_size);
|
||||
printf("[kernel] framebuffer discovered at 0x%x\n", fb_info->framebuffer_addr);
|
||||
printf("[kernel] fb0: width=%u, height=%u, pitch=%u, bpp=%u\n", fb_info->framebuffer_width, fb_info->framebuffer_height, fb_info->framebuffer_pitch, fb_info->framebuffer_bpp);
|
||||
|
||||
colorputs(ascii_title, green, black);
|
||||
|
||||
init_serial();
|
||||
log("serial connection established\n", 3);
|
||||
gdt_install();
|
||||
log("initialized GDT entries\n", 2);
|
||||
idt_install();
|
||||
log("initialized IDT\n", 2);
|
||||
isr_install();
|
||||
log("initialized ISRs\n", 2);
|
||||
irq_install();
|
||||
__asm__ __volatile__("sti");
|
||||
log("initialized IRQs\n", 2),
|
||||
|
||||
//clear();
|
||||
//colorputs(ascii_title, 10);
|
||||
//colorputs(" by @xamidev - star the repo for a cookie!\n\n", );
|
||||
|
||||
//init_paging();
|
||||
|
||||
//test_read_sector();
|
||||
@@ -124,10 +107,8 @@ uint8_t *tags = mb_info->tags;
|
||||
//uint32_t do_page_fault = *ptr;
|
||||
|
||||
timer_install();
|
||||
serial_printf(2, "%d\tinitialized timer handler", global_ticks);
|
||||
keyboard_install();
|
||||
serial_printf(2, "%d\tinitialized keyboard handler", global_ticks);
|
||||
keyboard_install();
|
||||
printf("[kernel] spawning shell...\n");
|
||||
shell_install();
|
||||
serial_printf(2, "%d\tstarted system shell", global_ticks);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,16 @@
|
||||
#define MAX_COMMANDS 16
|
||||
#define MAX_ARGS 64
|
||||
|
||||
|
||||
char* ascii_title =
|
||||
"\n"
|
||||
"----------------------------------------------\n"
|
||||
"Blank OS version 0.3.71-dev\n"
|
||||
"Author: @xamidev - star the repo for a cookie!\n"
|
||||
"----------------------------------------------\n"
|
||||
"\n";
|
||||
|
||||
|
||||
typedef void (*command_func_t)(int argc, char *argv[]);
|
||||
|
||||
typedef struct
|
||||
@@ -53,7 +63,9 @@ int parse_input(char* input, char* argv[], int max_args)
|
||||
}
|
||||
|
||||
void shell_install()
|
||||
{
|
||||
{
|
||||
colorputs(ascii_title, yellow, black);
|
||||
|
||||
register_command("help", program_help);
|
||||
register_command("panic", program_panic);
|
||||
register_command("words", program_words);
|
||||
@@ -73,7 +85,13 @@ void shell_install()
|
||||
{
|
||||
char input_buffer[BUFFER_SIZE];
|
||||
char* argv[MAX_ARGS];
|
||||
//colorputs("blankos> ", 9);
|
||||
|
||||
// Prompt
|
||||
colorputs("root", blue, black);
|
||||
colorputs("@", white, black);
|
||||
colorputs("blankos", green, black);
|
||||
colorputs("~$ ", white, black);
|
||||
|
||||
get_input(input_buffer, BUFFER_SIZE);
|
||||
puts("\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user