From 57834666259af373d19b560108ed7bb322b68adb Mon Sep 17 00:00:00 2001 From: amlal Date: Sat, 23 Mar 2024 10:22:31 +0100 Subject: Kernel: PS2 mouse builtin works now. - But doesnt draw at the exact position, we need to fix that. Signed-off-by: amlal --- Private/HALKit/AMD64/HalDescriptorLoader.cpp | 34 ++++++++-------------------- 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'Private/HALKit/AMD64/HalDescriptorLoader.cpp') diff --git a/Private/HALKit/AMD64/HalDescriptorLoader.cpp b/Private/HALKit/AMD64/HalDescriptorLoader.cpp index a5f445e5..df6caf7a 100644 --- a/Private/HALKit/AMD64/HalDescriptorLoader.cpp +++ b/Private/HALKit/AMD64/HalDescriptorLoader.cpp @@ -15,35 +15,21 @@ STATIC ::HCore::Detail::AMD64::InterruptDescriptorAMD64 kInterruptVectorTable[kKernelIdtSize]; STATIC Void RemapPIC(Void) noexcept { - UInt8 a1, a2; - - a1 = HAL::In8(0x21); // save masks - a2 = HAL::In8(0xA1); - // Remap PIC. HAL::Out8(0x20, 0x10 | 0x01); - HAL::rt_wait_400ns(); HAL::Out8(0xA0, 0x10 | 0x01); - HAL::rt_wait_400ns(); - - HAL::Out8(0x21, 0x28); - HAL::rt_wait_400ns(); - HAL::Out8(0xA1, 0x30); - HAL::rt_wait_400ns(); + HAL::Out8(0x21, 32); + HAL::Out8(0xA1, 40); - HAL::Out8(0x21, 0x04); - HAL::rt_wait_400ns(); - HAL::Out8(0xA1, 0x02); + HAL::Out8(0x21, 4); + HAL::Out8(0xA1, 2); - HAL::rt_wait_400ns(); HAL::Out8(0x21, 0x01); - HAL::rt_wait_400ns(); HAL::Out8(0xA1, 0x01); - HAL::rt_wait_400ns(); - HAL::Out8(0x21, a1); - HAL::rt_wait_400ns(); - HAL::Out8(0xA1, a2); + + HAL::Out8(0x21, 0x00); + HAL::Out8(0xA1, 0x00); } } // namespace Detail @@ -64,7 +50,9 @@ Void IDTLoader::Load(Register64 &idt) { MUST_PASS(baseIdt); - for (UInt16 i = 0; i < kKernelIdtSize; i++) { + Detail::RemapPIC(); + + for (UInt16 i = 0; i < kKernelIdtSize; ++i) { MUST_PASS(baseIdt[i]); Detail::kInterruptVectorTable[i].Selector = kGdtCodeSelector; @@ -82,8 +70,6 @@ Void IDTLoader::Load(Register64 &idt) { (kKernelIdtSize - 1); hal_load_idt(Detail::kRegIdt); - - Detail::RemapPIC(); } void GDTLoader::Load(Ref &gdt) { GDTLoader::Load(gdt.Leak()); } -- cgit v1.2.3