feat(arch): Add AArch64 / ARMv8i CPU support, cross-compilation & Linux Kconfig TUI

- Implement AArch64 HAL, vector table (16 aligned vectors), GICv2, Generic Timer, Stage-1 MMU (39-bit VA), PL011 UART
- Build unified multi-architecture abstraction layer in include/arch/arch.h
- Create interactive Linux-like Kconfig TUI menuconfig in scripts/kconfig/menuconfig.py
- Support make menuconfig, defconfig, x86_64_defconfig, aarch64_defconfig
- Update master Makefile for cross-compiling x86_64 (x86_64-elf-) and AArch64 (aarch64-linux-gnu-)
- Dynamic architecture awareness across printk, uname, neofetch, and LazyBox
This commit is contained in:
subhobhai943 committed 2026-08-18 10:50:58 +05:30
1 parent 125a891621
commit 70d5925b16
41 files changed
+1926 -187

No files matched your search

+20 -4
View File
@@ -1,8 +1,6 @@
#include <drivers/keyboard.h>
#include <drivers/tty.h>
#include <arch/x86_64/isr.h>
#include <arch/x86_64/pic.h>
#include <arch/x86_64/io.h>
#include <arch/arch.h>
#define KEYBOARD_DATA_PORT 0x60
#define KEYBOARD_STATUS_PORT 0x64
@@ -44,6 +42,7 @@ static void buffer_enqueue(uint16_t key) {
}
}
#if defined(__x86_64__)
static void keyboard_interrupt_handler(registers_t* regs) {
(void)regs;
uint8_t scancode = inb(KEYBOARD_DATA_PORT);
@@ -112,23 +111,40 @@ static void keyboard_interrupt_handler(registers_t* regs) {
buffer_enqueue((uint16_t)c);
}
}
#endif
void keyboard_init(void) {
buffer_head = 0;
buffer_tail = 0;
#if defined(__x86_64__)
isr_register_handler(33, keyboard_interrupt_handler); // IRQ1
pic_clear_mask(1);
#endif
}
#if defined(__aarch64__)
#include <arch/aarch64/uart.h>
#endif
bool keyboard_has_key(void) {
#if defined(__aarch64__)
if (uart_pl011_has_data()) return true;
#endif
return buffer_head != buffer_tail;
}
uint16_t keyboard_get_key(void) {
while (!keyboard_has_key()) {
hlt();
arch_halt();
}
#if defined(__aarch64__)
if (uart_pl011_has_data()) {
char c = uart_pl011_getc();
if (c == '\r') c = '\n';
return (uint16_t)(uint8_t)c;
}
#endif
uint16_t key = key_buffer[buffer_tail];
buffer_tail = (buffer_tail + 1) % KEYBOARD_BUFFER_SIZE;
return key;
+8 -3
View File
@@ -12,16 +12,17 @@ typedef struct {
static tty_t ttys[MAX_TTYS];
static int current_tty = 0;
static volatile uint16_t* const VGA_MEM = (uint16_t*)VGA_MEMORY;
static void tty_render_current(void) {
#if defined(__x86_64__)
volatile uint16_t* const vga_mem = (uint16_t*)VGA_MEMORY;
tty_t* t = &ttys[current_tty];
for (int y = 0; y < TTY_HEIGHT; y++) {
for (int x = 0; x < TTY_WIDTH; x++) {
VGA_MEM[y * TTY_WIDTH + x] = t->buffer[y][x];
vga_mem[y * TTY_WIDTH + x] = t->buffer[y][x];
}
}
vga_set_cursor(t->cursor_row, t->cursor_col);
#endif
}
void tty_switch(int index) {
@@ -62,7 +63,9 @@ void tty_set_cursor(int row, int col) {
tty_t* t = &ttys[current_tty];
t->cursor_row = row;
t->cursor_col = col;
#if defined(__x86_64__)
vga_set_cursor(row, col);
#endif
}
void tty_write(const char* data, size_t size) {
@@ -150,7 +153,9 @@ void tty_write_string(const char* data) {
}
void tty_init(void) {
#if defined(__x86_64__)
vga_init();
#endif
for (int i = 0; i < MAX_TTYS; i++) {
ttys[i].cursor_row = 0;
ttys[i].cursor_col = 0;