feat: Redesign GUI desktop in Windows/KDE style with Start menu, Terminal, Task Manager, hardware mouse cursor, and IRQ 12 support
This commit is contained in:
@@ -108,7 +108,7 @@ servers: libc hal $(LVGL_LIB)
|
|||||||
@# Desktop GUI Server (LVGL v8.3)
|
@# Desktop GUI Server (LVGL v8.3)
|
||||||
@$(CXX) $(CXXFLAGS) -Ilib/lvgl -c $(SERVERS_DIR)/gui_server/main.cpp -o $(BUILD_DIR)/gui_main.o
|
@$(CXX) $(CXXFLAGS) -Ilib/lvgl -c $(SERVERS_DIR)/gui_server/main.cpp -o $(BUILD_DIR)/gui_main.o
|
||||||
@$(LD) -T $(CONFIG_DIR)/user.ld -nostdlib -static -o $(GUI_SERVER) \
|
@$(LD) -T $(CONFIG_DIR)/user.ld -nostdlib -static -o $(GUI_SERVER) \
|
||||||
$(BUILD_DIR)/gui_main.o $(BUILD_DIR)/ipc.o $(LVGL_LIB) $(LIBC_OBJS)
|
$(BUILD_DIR)/gui_main.o $(BUILD_DIR)/ipc.o $(NET_OBJS) $(LVGL_LIB) $(LIBC_OBJS)
|
||||||
|
|
||||||
# Download and build the Limine bootloader host tool
|
# Download and build the Limine bootloader host tool
|
||||||
limine-setup:
|
limine-setup:
|
||||||
|
|||||||
@@ -39,3 +39,44 @@ keyboard_isr_entry:
|
|||||||
pop rax
|
pop rax
|
||||||
|
|
||||||
iretq
|
iretq
|
||||||
|
|
||||||
|
.global mouse_isr_entry
|
||||||
|
.extern mouse_interrupt_handler
|
||||||
|
|
||||||
|
mouse_isr_entry:
|
||||||
|
push rax
|
||||||
|
push rbx
|
||||||
|
push rcx
|
||||||
|
push rdx
|
||||||
|
push rsi
|
||||||
|
push rdi
|
||||||
|
push rbp
|
||||||
|
push r8
|
||||||
|
push r9
|
||||||
|
push r10
|
||||||
|
push r11
|
||||||
|
push r12
|
||||||
|
push r13
|
||||||
|
push r14
|
||||||
|
push r15
|
||||||
|
|
||||||
|
call mouse_interrupt_handler
|
||||||
|
|
||||||
|
pop r15
|
||||||
|
pop r14
|
||||||
|
pop r13
|
||||||
|
pop r12
|
||||||
|
pop r11
|
||||||
|
pop r10
|
||||||
|
pop r9
|
||||||
|
pop r8
|
||||||
|
pop rbp
|
||||||
|
pop rdi
|
||||||
|
pop rsi
|
||||||
|
pop rdx
|
||||||
|
pop rcx
|
||||||
|
pop rbx
|
||||||
|
pop rax
|
||||||
|
|
||||||
|
iretq
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ extern "C" {
|
|||||||
fn default_isr_stub();
|
fn default_isr_stub();
|
||||||
fn timer_isr_entry();
|
fn timer_isr_entry();
|
||||||
fn keyboard_isr_entry();
|
fn keyboard_isr_entry();
|
||||||
|
fn mouse_isr_entry();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Global assembly ISR stub with vector ID pushed as separate stubs (0-31)
|
// Global assembly ISR stub with vector ID pushed as separate stubs (0-31)
|
||||||
@@ -153,6 +154,10 @@ pub unsafe fn init() {
|
|||||||
let kbd_addr = keyboard_isr_entry as *const () as usize as u64;
|
let kbd_addr = keyboard_isr_entry as *const () as usize as u64;
|
||||||
(*idt_ptr.add(33)).set_handler(kbd_addr, 0, 0);
|
(*idt_ptr.add(33)).set_handler(kbd_addr, 0, 0);
|
||||||
|
|
||||||
|
// Set Mouse Interrupt (Vector 44 / 0x2C - Slave PIC IRQ 12)
|
||||||
|
let mouse_addr = mouse_isr_entry as *const () as usize as u64;
|
||||||
|
(*idt_ptr.add(44)).set_handler(mouse_addr, 0, 0);
|
||||||
|
|
||||||
let descriptor = IdtDescriptor {
|
let descriptor = IdtDescriptor {
|
||||||
limit: (size_of::<[IdtEntry; 256]>() - 1) as u16,
|
limit: (size_of::<[IdtEntry; 256]>() - 1) as u16,
|
||||||
base: idt_ptr as u64,
|
base: idt_ptr as u64,
|
||||||
|
|||||||
@@ -145,8 +145,27 @@ pub fn init(screen_w: i32, screen_h: i32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn mouse_interrupt_handler() {
|
||||||
|
unsafe {
|
||||||
|
let status = inb(PS2_COMMAND_PORT);
|
||||||
|
if (status & 0x01) != 0 {
|
||||||
|
let data = inb(PS2_DATA_PORT);
|
||||||
|
if (status & 0x20) != 0 {
|
||||||
|
MOUSE_STATE.handle_byte(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
crate::drivers::timer::send_slave_eoi();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_mouse_info() -> (i32, i32, u32) {
|
pub fn get_mouse_info() -> (i32, i32, u32) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
// Drain any pending bytes in 8042 buffer
|
||||||
|
while (inb(PS2_COMMAND_PORT) & 0x21) == 0x21 {
|
||||||
|
let data = inb(PS2_DATA_PORT);
|
||||||
|
MOUSE_STATE.handle_byte(data);
|
||||||
|
}
|
||||||
(MOUSE_STATE.x, MOUSE_STATE.y, MOUSE_STATE.buttons)
|
(MOUSE_STATE.x, MOUSE_STATE.y, MOUSE_STATE.buttons)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,17 @@ unsafe fn io_wait() {
|
|||||||
outb(0x80, 0);
|
outb(0x80, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send End of Interrupt to PIC
|
/// Send End of Interrupt to Master PIC
|
||||||
pub unsafe fn send_eoi() {
|
pub unsafe fn send_eoi() {
|
||||||
outb(PIC1_COMMAND, PIC_EOI);
|
outb(PIC1_COMMAND, PIC_EOI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Send End of Interrupt to both Slave and Master PIC (for IRQs 8-15, including IRQ 12 mouse)
|
||||||
|
pub unsafe fn send_slave_eoi() {
|
||||||
|
outb(PIC2_COMMAND, PIC_EOI);
|
||||||
|
outb(PIC1_COMMAND, PIC_EOI);
|
||||||
|
}
|
||||||
|
|
||||||
/// Remap PIC offsets to 32 (0x20) and 40 (0x28)
|
/// Remap PIC offsets to 32 (0x20) and 40 (0x28)
|
||||||
unsafe fn remap_pic() {
|
unsafe fn remap_pic() {
|
||||||
// ICW1: Start initialization in cascade mode
|
// ICW1: Start initialization in cascade mode
|
||||||
@@ -41,7 +47,7 @@ unsafe fn remap_pic() {
|
|||||||
outb(PIC2_DATA, 0x28);
|
outb(PIC2_DATA, 0x28);
|
||||||
io_wait();
|
io_wait();
|
||||||
|
|
||||||
// ICW3: Cascade wiring
|
// ICW3: Cascade wiring (Master: IRQ2 has slave; Slave: cascade identity 2)
|
||||||
outb(PIC1_DATA, 0x04);
|
outb(PIC1_DATA, 0x04);
|
||||||
io_wait();
|
io_wait();
|
||||||
outb(PIC2_DATA, 0x02);
|
outb(PIC2_DATA, 0x02);
|
||||||
@@ -53,9 +59,14 @@ unsafe fn remap_pic() {
|
|||||||
outb(PIC2_DATA, 0x01);
|
outb(PIC2_DATA, 0x01);
|
||||||
io_wait();
|
io_wait();
|
||||||
|
|
||||||
// Mask all IRQs except IRQ 0 (Timer) and IRQ 1 (Keyboard)
|
// Enable IRQ 0 (Timer), IRQ 1 (Keyboard), and IRQ 2 (Cascade to Slave PIC) on Master:
|
||||||
outb(PIC1_DATA, 0xFC); // Enable IRQ0 and IRQ1
|
// 0xF8 = 11111000b (bits 0, 1, 2 unmasked)
|
||||||
outb(PIC2_DATA, 0xFF); // Disable all on Slave
|
outb(PIC1_DATA, 0xF8);
|
||||||
|
|
||||||
|
// Enable IRQ 12 (PS/2 Mouse) on Slave PIC:
|
||||||
|
// IRQ 12 is line 4 on Slave PIC (8 + 4 = 12):
|
||||||
|
// 0xEF = 11101111b (bit 4 unmasked)
|
||||||
|
outb(PIC2_DATA, 0xEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialize PIT to tick at target Hz (e.g. 100 Hz = 10 ms quantum)
|
/// Initialize PIT to tick at target Hz (e.g. 100 Hz = 10 ms quantum)
|
||||||
|
|||||||
+2
-2
@@ -363,9 +363,9 @@
|
|||||||
*https://fonts.google.com/specimen/Montserrat*/
|
*https://fonts.google.com/specimen/Montserrat*/
|
||||||
#define LV_FONT_MONTSERRAT_8 0
|
#define LV_FONT_MONTSERRAT_8 0
|
||||||
#define LV_FONT_MONTSERRAT_10 0
|
#define LV_FONT_MONTSERRAT_10 0
|
||||||
#define LV_FONT_MONTSERRAT_12 0
|
#define LV_FONT_MONTSERRAT_12 1
|
||||||
#define LV_FONT_MONTSERRAT_14 1
|
#define LV_FONT_MONTSERRAT_14 1
|
||||||
#define LV_FONT_MONTSERRAT_16 0
|
#define LV_FONT_MONTSERRAT_16 1
|
||||||
#define LV_FONT_MONTSERRAT_18 0
|
#define LV_FONT_MONTSERRAT_18 0
|
||||||
#define LV_FONT_MONTSERRAT_20 0
|
#define LV_FONT_MONTSERRAT_20 0
|
||||||
#define LV_FONT_MONTSERRAT_22 0
|
#define LV_FONT_MONTSERRAT_22 0
|
||||||
|
|||||||
+779
-286
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user