clenup
This commit is contained in:
parent
5a371e3a03
commit
ebbbd92e36
13
boot.s
13
boot.s
@ -12,13 +12,14 @@
|
||||
|
||||
.section .bss
|
||||
.align 16
|
||||
stack_bottom:
|
||||
.skip 1024 * 32 # 32 KB
|
||||
stack_top:
|
||||
|
||||
.section .text
|
||||
.global _start
|
||||
.type _start, @function
|
||||
stack_bottom:
|
||||
.skip 1024 * 32 # 32 KB
|
||||
|
||||
stack_top:
|
||||
.section .text
|
||||
.global _start
|
||||
.type _start, @function
|
||||
_start:
|
||||
cli
|
||||
mov $stack_top, %esp
|
||||
|
2
gdt.c
2
gdt.c
@ -25,5 +25,5 @@ void gdt_install() {
|
||||
gdt_set_gate(1, 0, 0xFFFFFFFF, 0x9A, 0xCF); // Code segment
|
||||
gdt_set_gate(2, 0, 0xFFFFFFFF, 0x92, 0xCF); // Data segment
|
||||
|
||||
gdt_flush((uint32_t)&gdtp); //TODO: KERNEL PANIC
|
||||
gdt_flush((uint32_t)&gdtp);
|
||||
}
|
||||
|
12
kernel.c
12
kernel.c
@ -22,8 +22,8 @@ struct idt_entry idt[IDT_ENTRIES];
|
||||
struct idt_ptr idtp;
|
||||
|
||||
extern void idt_load();
|
||||
extern void isr_handler();
|
||||
extern void irq_handler();
|
||||
//extern void isr_handler();
|
||||
//extern void irq_handler();
|
||||
extern void pit_handler_asm();
|
||||
|
||||
static inline void outb(uint16_t port, uint8_t val) {
|
||||
@ -202,7 +202,7 @@ uint8_t vga_color_from_char(char color_code) {
|
||||
case 'b': return VGA_COLOR_LIGHT_CYAN;
|
||||
case 'c': return VGA_COLOR_LIGHT_RED;
|
||||
case 'd': return VGA_COLOR_LIGHT_MAGENTA;
|
||||
case 'e': return VGA_COLOR_LIGHT_BROWN;
|
||||
case 'e': return VGA_COLOR_LIGHT_BROWN; //LOL its actually yellow
|
||||
case 'f': return VGA_COLOR_WHITE;
|
||||
default: return VGA_COLOR_LIGHT_GREY;
|
||||
}
|
||||
@ -231,8 +231,6 @@ void pit_set_frequency(uint32_t frequency) {
|
||||
outb(PIT_CHANNEL_0, (divisor >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void kernel_main(void) {
|
||||
terminal_initialize();
|
||||
gdt_install();
|
||||
@ -241,9 +239,9 @@ void kernel_main(void) {
|
||||
pit_set_frequency(1000);
|
||||
idt_set_gate(32, (uint32_t)pit_handler_asm, 0x08, 0x8E);
|
||||
asm volatile("sti");
|
||||
terminal_writestring_with_colors("Hello, kernel World!\n&5Magenta String Example\nThis is a &4red string&7.\n");
|
||||
terminal_writestring_with_colors("Hello, &ekernel &7World!\n&5Magenta String Example\nThis is a &4red string&7.\n");
|
||||
for (int i = 0; i < 30; i++) {
|
||||
terminal_writestring_with_colors("Line ");
|
||||
terminal_writestring_with_colors("&cDead &7");
|
||||
terminal_putchar('0' + (i / 10));
|
||||
terminal_putchar('0' + (i % 10));
|
||||
terminal_writestring_with_colors("\n");
|
||||
|
Loading…
Reference in New Issue
Block a user