diff options
| author | Alexey Gavrilov <90127298+rebovas@users.noreply.github.com> | 2024-05-24 14:33:19 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-24 14:33:19 +0700 |
| commit | dc0b89fa63a181bd4add318bfd7a46344702f4e7 (patch) | |
| tree | 48e25b199ae3459e12c7202f7b18a37cd087bf9b /arch/x86/idt/Idt.cpp | |
| parent | 0a50b1758fd3da118408fd724825d0a50a9ecf17 (diff) | |
| parent | 5fbf41e967ed8e413ecf1e6abb72e8d285169df4 (diff) | |
Pic + Tuple + refactor PrimaryInitialization class
Diffstat (limited to 'arch/x86/idt/Idt.cpp')
| -rw-r--r-- | arch/x86/idt/Idt.cpp | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/arch/x86/idt/Idt.cpp b/arch/x86/idt/Idt.cpp index cd263fb..e24cbfe 100644 --- a/arch/x86/idt/Idt.cpp +++ b/arch/x86/idt/Idt.cpp @@ -30,7 +30,7 @@ DescInterrupt32::DescInterrupt32(uint32 offset, uint16 selector, uint8 attr) } }; -uint64 DescInterrupt32::getDescriptor() +uint64 DescInterrupt32::getDescriptor() const { uint64 desc = 0; @@ -42,6 +42,11 @@ uint64 DescInterrupt32::getDescriptor() return desc; }; +uint32 DescInterrupt32::getOffset() const +{ + return offsetLow | offsetHight << 16; +}; + DescInterrupt32 DescInterrupt32::InterruptKernelLong(uint32 offset, uint16 selector) { return DescInterrupt32( @@ -86,6 +91,7 @@ MngIdt::MngIdt() currIdx = NULL; idtLoaded = false; isInitialize = true; + irqInterruptStart = firstSystemIntNumber; } }; @@ -97,10 +103,24 @@ bool MngIdt::canDescriptorWrite(uint8 idx) bool MngIdt::addDescriptor(DescInterrupt32 desc) { - if(!canDescriptorWrite(currIdx) or isIntReserved(currIdx)) return false; + uint64 descqw = desc.getDescriptor(); + + if(!canDescriptorWrite(currIdx) or isIntReserved(currIdx) + or desc.getOffset() == NULL) return false; + + idt[currIdx] = descqw; + + uint8 attributes = descqw >> 40; + + if((attributes & RING_DRIVERSH or + attributes & RING_DRIVERSL) and + (irqInterruptStart == firstSystemIntNumber)) + { + irqInterruptStart = (uint8)(descqw >> 16); + } - idt[currIdx] = desc.getDescriptor(); while(isIntReserved(++currIdx)); + return true; }; @@ -168,3 +188,13 @@ void DescInterrupt32::setDpl(uint8 dpl) { attributes = (dpl & 0x03) << 5; }; + +bool MngIdt::isInterruptSet(uint8 numberInterrupt) +{ + return idt[numberInterrupt]; +}; + +uint8 MngIdt::getIrqInterruptStart() +{ + return irqInterruptStart; +}; |
