This commit is contained in:
nub31
2025-09-03 17:43:23 +02:00
parent 0b8ee325aa
commit 0583c8c1a3
12 changed files with 10 additions and 135 deletions

View File

@@ -1,4 +1,5 @@
global _start
global pml4
extern entry
%define FLAGS 0b10

View File

@@ -1,11 +1,11 @@
#include "../../kernel/kernel.h"
#include "../arch.h"
#include "../api.h"
#include "interrupts/idt.h"
#include "interrupts/irq.h"
#include "mmap.h"
#include "memory/mmap.h"
#include "multiboot.h"
#include "util.h"
#include "vga.h"
#include "vga/vga.h"
#include <stdint.h>
#include <stdio.h>

View File

@@ -1,5 +1,5 @@
#include "exceptions.h"
#include "../../arch.h"
#include "../../api.h"
static const char* exception_messages[32] = {
"divide by zero",

View File

@@ -1,107 +0,0 @@
// #include "keyboard.h"
// #include "interrupts.h"
// #include "util.h"
// #include <stddef.h>
// #define SCANCODE_LEFT_SHIFT 42
// #define SCANCODE_RIGHT_SHIFT 54
// #define SCANCODE_CAPS_LOCK 58
// #define KEYBOARD_HANDLERS_LENGTH 32
// unsigned const char us_keymap[128] = {
// 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '\t', 'q', 'w',
// 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', 0, 'a', 's', 'd', 'f', 'g', 'h',
// 'j', 'k', 'l', ';', '\'', '`', 0, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',
// 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, '-', 0, 0, 0, '+', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// };
// unsigned const char us_keymap_shift[128] = {
// 0, 27, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '\b', '\t', 'Q', 'W',
// 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n', 0, 'A', 'S', 'D', 'F', 'G', 'H',
// 'J', 'K', 'L', ':', '"', '~', 0, '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',
// 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, '-', 0, 0, 0, '+', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// };
// bool shift = false;
// bool caps_lock = false;
// // todo(nub): make dynamic when a memory allocator is implemented
// static keyboard_handler_t keyboard_handlers[KEYBOARD_HANDLERS_LENGTH];
// static size_t handler_index = 0;
// char scan_code_to_ascii(uint8_t scan_code)
// {
// if (scan_code >= 128)
// {
// return 0;
// }
// if ((!caps_lock && shift) || (caps_lock && !shift))
// {
// return us_keymap_shift[scan_code];
// }
// else
// {
// return us_keymap[scan_code];
// }
// }
// void handle_keyboard(const isr_frame_t* frame)
// {
// uint8_t code = inb(0x60);
// uint8_t scan_code = code & 0x7F;
// bool pressed = (code & 0x80) == 0;
// switch (scan_code)
// {
// case SCANCODE_LEFT_SHIFT:
// case SCANCODE_RIGHT_SHIFT:
// {
// shift = pressed;
// break;
// }
// case SCANCODE_CAPS_LOCK:
// {
// if (pressed)
// {
// caps_lock = !caps_lock;
// }
// break;
// }
// default:
// {
// keyboard_event_t event = {
// .scan_code = scan_code,
// .pressed = pressed,
// .caps_lock = caps_lock,
// .shift = shift,
// .ascii = scan_code_to_ascii(scan_code),
// };
// for (size_t i = 0; i < handler_index; i++)
// {
// keyboard_handlers[i](&event);
// }
// }
// }
// }
// void register_keypress_handler(const keyboard_handler_t handler)
// {
// // todo(nub31): remove when a memory allocator is implemented and
// // keyboard_handlers is a dynamic list
// if (handler_index >= KEYBOARD_HANDLERS_LENGTH)
// {
// }
// keyboard_handlers[handler_index] = handler;
// handler_index += 1;
// }
// void keyboard_init()
// {
// register_irq_handler(1, handle_keyboard);
// }

View File

@@ -1,19 +0,0 @@
// #pragma once
// #include <stdbool.h>
// #include <stdint.h>
// typedef struct
// {
// uint8_t scan_code;
// bool pressed;
// bool shift;
// bool caps_lock;
// char ascii;
// } keyboard_event_t;
// typedef void (*keyboard_handler_t)(const keyboard_event_t*);
// void keyboard_init();
// void register_keypress_handler(keyboard_handler_t handler);
// char scan_code_to_ascii(uint8_t scan_code);

View File

@@ -1,5 +1,5 @@
#include "mmap.h"
#include "../arch.h"
#include "../../api.h"
#include <stddef.h>
#include <stdio.h>

View File

@@ -1,6 +1,6 @@
#pragma once
#include "../arch.h"
#include "multiboot.h"
#include "../../api.h"
#include "../multiboot.h"
void map_memory(multiboot_info_t* mbd);

View File

@@ -1,5 +1,5 @@
#include "pmm.h"
#include "../arch/arch.h"
#include "../arch/api.h"
#include <stddef.h>
#include <stdio.h>
#include <string.h>

View File

@@ -1,4 +1,4 @@
#include "../arch/arch.h"
#include "../arch/api.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>