This commit is contained in:
2025-03-15 00:02:33 +03:00
parent 0ea8fc59ef
commit bacba9abf1
6 changed files with 3 additions and 37 deletions
-2
View File
@@ -21,8 +21,6 @@ typedef struct {
static idtr_t idtr; static idtr_t idtr;
//void idt_init(void);
//void idt_set_descriptor(uint8_t vector, void* isr, uint8_t flags);
void idt_set_descriptor(uint8 vector, uint32 isr, uint8_t flags); void idt_set_descriptor(uint8 vector, uint32 isr, uint8_t flags);
void idt_set(); void idt_set();
+1 -1
View File
@@ -3,7 +3,7 @@
#include "../include/types.h" #include "../include/types.h"
uint8 inportb(uint16 _port); uint8 inportb(uint16 _port);
void outportb(uint16 _port, uint8 _data); void outportb(uint16 _port, uint8 _data);
#endif #endif
+1 -1
View File
@@ -5,7 +5,7 @@ section .text
dd 0x1BADB002 dd 0x1BADB002
dd 0x00 dd 0x00
dd - (0x1BADB002+0x00) dd - (0x1BADB002+0x00)
global start global start
extern kmain ; this function is gonna be located in our c code(kernel.c) extern kmain ; this function is gonna be located in our c code(kernel.c)
-16
View File
@@ -1,26 +1,11 @@
#include "../include/idt.h" #include "../include/idt.h"
#include <stdbool.h> #include <stdbool.h>
//IDT_MAX_DESCRIPTORS = 256
static bool vectors[sizeof(idt)]; static bool vectors[sizeof(idt)];
extern void* isr_stub_table[]; extern void* isr_stub_table[];
#define KERNEL_CS 0x08 #define KERNEL_CS 0x08
/*void idt_init() {
idtr.base = (uintptr_t)&idt[0];
idtr.limit = (uint16_t)sizeof(idt_entry_t) * sizeof(idt) - 1;
for (uint8_t vector = 0; vector < 32; vector++) {
idt_set_descriptor(vector, isr_stub_table[vector], 0x8E);
vectors[vector] = true;
}
__asm__ volatile ("lidt %0" : : "m"(idtr)); // load the new IDT
__asm__ volatile ("sti"); // set the interrupt flag
}*/
void idt_set() { void idt_set() {
idtr.base = (uint32) &idt; idtr.base = (uint32) &idt;
idtr.limit = sizeof(idt) * sizeof(idt_entry_t) - 1; idtr.limit = sizeof(idt) * sizeof(idt_entry_t) - 1;
@@ -28,7 +13,6 @@ void idt_set() {
} }
//void idt_set_descriptor(uint8_t vector, void* isr, uint8_t flags)
void idt_set_descriptor(uint8_t vector, uint32 isr, uint8_t flags) { void idt_set_descriptor(uint8_t vector, uint32 isr, uint8_t flags) {
idt_entry_t* descriptor = &idt[vector]; idt_entry_t* descriptor = &idt[vector];
-11
View File
@@ -4,17 +4,6 @@
#include "../include/stdio.h" #include "../include/stdio.h"
#include "../include/utils.h" #include "../include/utils.h"
/* Check if the compiler thinks you are targeting the wrong operating system. */
/*#if defined(__linux__)
#error "You are not using a cross-compiler, you will most certainly run into trouble"
#endif
*/
/* This tutorial will only work for the 32-bit ix86 targets. */
/*#if !defined(__i386__)
#error "This tutorial needs to be compiled with a ix86-elf compiler"
#endif
*/
void kmain() void kmain()
{ {
terminal_initialize(); terminal_initialize();
+1 -6
View File
@@ -44,11 +44,6 @@ void terminal_putentryat(char c, uint8_t color, size_t x, size_t y)
void terminal_putchar(char c) void terminal_putchar(char c)
{ {
/*if(c == '\n')
{
terminal_column = 0;
terminal_row++;
}*/
if(c != '\n') if(c != '\n')
terminal_putentryat(c, terminal_color, terminal_column, terminal_row); terminal_putentryat(c, terminal_color, terminal_column, terminal_row);
@@ -61,7 +56,7 @@ void terminal_putchar(char c)
if(terminal_row >= VGA_HEIGHT){ if(terminal_row >= VGA_HEIGHT){
terminal_row = 0; terminal_row = 0;
} }
if(c == '\n') if(c == '\n')
{ {
terminal_column = 0; terminal_column = 0;