From f7deeb1e37cb09d026025ea6762444328d10b0b1 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 22 Apr 2019 17:19:53 +0200 Subject: [PATCH] Cursor is better --- include/kernel/cpu.h | 7 +++++++ kaleid/kernel/cpu/idt.c | 13 +++++++------ kaleid/kernel/io/cursor.c | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/include/kernel/cpu.h b/include/kernel/cpu.h index 29ebc8f..b5f7963 100644 --- a/include/kernel/cpu.h +++ b/include/kernel/cpu.h @@ -92,6 +92,13 @@ enum { FEAT_EDX_PBE = 1 << 31 }; +// -------------------------------------------------------------------------- // + +typedef struct { + ushort length; + void* base; + } __attribute__((packed)) Idtr_t; + // -------------------------------------------------------------------------- // #endif diff --git a/kaleid/kernel/cpu/idt.c b/kaleid/kernel/cpu/idt.c index cdcf44c..64c2606 100644 --- a/kaleid/kernel/cpu/idt.c +++ b/kaleid/kernel/cpu/idt.c @@ -22,17 +22,18 @@ // along with OS/K. If not, see . // //----------------------------------------------------------------------------// #include +#include + +extern void lidt(Idtr_t reg); // // Registers the new idt in the idtr register. // -static inline void lidt(void* idtAddr, ushort size) +static inline void loadIdt(void* idtAddr, ushort size) { // The IDTR register structure that will be sent - struct { - ushort length; - void* base; - } __attribute__((packed)) IDTR = { size, idtAddr }; + Idtr_t IDTR = { size, idtAddr }; - asm volatile( "lidt %0" : : "m"(IDTR) ); + lidt(IDTR); } + diff --git a/kaleid/kernel/io/cursor.c b/kaleid/kernel/io/cursor.c index ed336bb..78cb1be 100644 --- a/kaleid/kernel/io/cursor.c +++ b/kaleid/kernel/io/cursor.c @@ -29,7 +29,7 @@ void IoEnableCursor(void) { IoWriteByteOnPort(0x3D4, 0xA); - IoWriteByteOnPort(0x3D5, (IoReadByteFromPort(0x3D5) & 0xC0)); + IoWriteByteOnPort(0x3D5, (IoReadByteFromPort(0x3D5) & 0xC0) | 15); IoWriteByteOnPort(0x3D4, 0xB); IoWriteByteOnPort(0x3D5, (IoReadByteFromPort(0x3D5) & 0xE0) | 15);