Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sergey@COMPUTER:~/Рабочий стол/myOS_8.0T$ make mykernel.bin
- make: Предупреждение: время изменения файла «interruptstubs.s» находится в будущем (10131)
- as --32 -o interruptstubs.o interruptstubs.s
- interruptstubs.s: Assembler messages:
- interruptstubs.s: Warning: конец файла не в конце строки; вставлен символ новой строки
- ld -melf_i386 -T linker.ld -o mykernel.bin loader.o gdt.o port.o interruptstubs.o interrupts.o kernel.o
- interrupts.o: In function `InterruptManager::InterruptManager(GlobalDescriptorTable*)':
- interrupts.cpp:(.text+0xc1): undefined reference to `InterruptManager::IgnoreInterruptRequest()'
- Makefile:15: ошибка выполнения рецепта для цели «mykernel.bin»
- make: *** [mykernel.bin] Ошибка 1
- sergey@COMPUTER:~/Рабочий стол/myOS_8.0T$
- #include "interrupts.h"
- void printf(char* str);
- InterruptManager::GateDescriptor InterruptManager::InterruptDescriptorTable[256];
- void InterruptManager::SetInterruptDescriptorTableEntry(
- uint8_t interruptNumber,
- uint16_t codeSegmentSelectorOffset,
- void (*handler)(),
- uint8_t DescriptorPrivilegeLevel,
- uint8_t DescriptorType)
- {
- const uint8_t IDT_DESC_PRESENT = 0x80;
- InterruptDescriptorTable[interruptNumber].handlerAddressLowBits = ((uint32_t)handler) & 0xFFFF;
- InterruptDescriptorTable[interruptNumber].handlerAddressHighBits = (((uint32_t)handler) >> 16) & 0xFFFF;
- InterruptDescriptorTable[interruptNumber].gdt_codeSegmentSelector = codeSegmentSelectorOffset;
- InterruptDescriptorTable[interruptNumber].access = IDT_DESC_PRESENT | DescriptorType | ((DescriptorPrivilegeLevel&3) << 5);
- InterruptDescriptorTable[interruptNumber].reserved = 0;
- }
- InterruptManager::InterruptManager(GlobalDescriptorTable* gdt)
- {
- uint16_t CodeSegment = gdt->CodeSegmentSelector();
- const uint8_t IDT_INTERRUPT_GATE = 0xE;
- for(uint16_t i = 0; i < 256; i++)
- SetInterruptDescriptorTableEntry(i, CodeSegment, &IgnoreInterruptRequest, 0, IDT_INTERRUPT_GATE);
- SetInterruptDescriptorTableEntry(0x20, CodeSegment, &HandleInterruptRequest0x00, 0, IDT_INTERRUPT_GATE);
- SetInterruptDescriptorTableEntry(0x21, CodeSegment, &HandleInterruptRequest0x01, 0, IDT_INTERRUPT_GATE);
- InterruptDescriptorTablePointer idt;
- idt.size = 256 * sizeof(GateDescriptor) - 1;
- idt.base = (uint32_t)InterruptDescriptorTable;
- asm volatile("lidt %0" : : "m" (idt));
- }
- InterruptManager::~InterruptManager()
- {
- }
- void InterruptManager::Activate()
- {
- asm("sti");
- }
- uint32_t InterruptManager::handleInterrupt(uint8_t interruptNumber, uint32_t esp)
- {
- printf(" INTERRUPT");
- return esp;
- }
Add Comment
Please, Sign In to add comment