Go to the source code of this file.
Functions | |
| when irq is not run this code for exit and switch to curent process mov cmp | if (OsTaskSwitch==1) do task switch jne L_IrqExitNoSwitchTask |
Variables | |
| define | PIC_MASTER_PORT |
| master define | PIC_MASTER_PORT2 |
| master define | PIC_SLAVE_PORT |
| slave define | PIC_SLAVE_PORT2 |
| slave define | PIC_EOI |
| end of interrupt define | INT_VECTOR_IRQ0 |
| irq0 | |
| irq8 | ~f |
| _Main _PicInit | _InterruptIdtTableFill |
| _OsTaskSwitch _OsTaskCurrent _OsTaskNext _OsIntNesting _OsRunning | _OsHasIntNesting |
| global _OsRootTaskStart global _OsTaskSwitchOut global _OutByte global | _InByte |
| global _IdtTable global _GdtTable global _IrqHandlersTable global _IrqExecutorTable global _CpuIntHandlersTable global _CpuIntExecutorTable global _SoftwareIntHandlersTable global _SoftwareIntExecutorTable | bits [SECTION.bss] |
| bss section for uninitialized data | KernelStackSpace |
| stack size | KernelStackTop |
| these byte is | important [section.data] |
| data section for initialized data | _IdtTable |
| bytes for interrupt descriptors | _IdtLoader |
| idt size base | _IdtBase |
| idt table address | align |
| align this to bytes boundary address | _GdtTable |
| global description table | NullGdt |
| The gdt content limit | GdtBase |
| The gdt base linear | address |
| divide by | CpuInt1Handler |
| single step | CpuInt2Handler |
| nmi | CpuInt3Handler |
| breakpoint | CpuInt4Handler |
| overflow | CpuInt5Handler |
| bound | CpuInt6Handler |
| invalid opcode | CpuInt7Handler |
| no fpu | CpuInt8Handler |
| double fault | CpuInt9Handler |
| fpu segment overflow | CpuInt10Handler |
| invalid tss | CpuInt11Handler |
| invalid segment | CpuInt12Handler |
| stack overflow | CpuInt13Handler |
| general protect | CpuInt14Handler |
| page fault | CpuInt15Handler |
| undefine just | undefine |
| undefine just not cpu fault | CpuInt16Handler |
| fpu error | CpuInt17Handler |
| correction error | CpuInt18Handler |
| machine error | CpuInt19Handler |
| simd | error |
| IntelReserveInt20Handler | __pad2__ |
| intel | reserved |
| IntelReserveInt21Handler | __pad3__ |
| IntelReserveInt22Handler | __pad4__ |
| IntelReserveInt23Handler | __pad5__ |
| IntelReserveInt24Handler | __pad6__ |
| IntelReserveInt25Handler | __pad7__ |
| IntelReserveInt26Handler | __pad8__ |
| IntelReserveInt27Handler | __pad9__ |
| IntelReserveInt28Handler | __pad10__ |
| IntelReserveInt29Handler | __pad11__ |
| IntelReserveInt30Handler | __pad12__ |
| IntelReserveInt31Handler | __pad13__ |
| intel reserved | _CpuIntExecutorTable |
| handlers in total | Irq0Handler |
| timer | Irq1Handler |
| keyboard | Irq2Handler |
| slave pic | Irq3Handler |
| com2 | Irq4Handler |
| com1 | Irq5Handler |
| lpt2 | Irq6Handler |
| fdc | Irq7Handler |
| lpt1 | Irq8Handler |
| rtc | Irq9Handler |
| redir irq2 | Irq10Handler |
| user | Irq11Handler |
| user | Irq12Handler |
| user | Irq13Handler |
| fpu | Irq14Handler |
| hdc | Irq15Handler |
| reserve | _IrqExecutorTable |
| executor for irqs dd Irq0Executor dd Irq1Executor dd Irq2Executor dd Irq3Executor dd Irq4Executor dd Irq5Executor dd Irq6Executor dd Irq7Executor dd Irq8Executor dd Irq9Executor dd Irq10Executor dd Irq11Executor dd Irq12Executor dd Irq13Executor dd Irq14Executor dd Irq15Executor | _SoftwareIntHandlersTable |
| executor for irqs dd | SoftwareInt48Executor |
| software int for OsContextSwitch | use [section.text] |
| code section for instructions | _EntryStart |
| clear i flag in cpu disable all maskable interrupt | lgdt [_GdtLoader] |
| setup global description table mov | ax |
| setup global description table mov mov | ds |
| data segment gdt entry is at of _GdtTable mov ss gdt offset mov | ss |
| stack segment gdt entry is at of _GdtTable mov | esp |
| re iniital esp mov ss and mov esp must set together mov es gdt offset mov | es |
| extra segment gdt entry is at of GdtTable mov | fs |
| flag segment is not | used |
| flag segment is not set it to extra segment gdt entry is at of GdtTable mov gs gdt offset mov | gs |
| graphics segment is not set it to extra segment gdt entry is at of GdtTable jmp | SELECTOR_KERNEL_CS |
| use jump to enter new protection mode | L_SetupIdt |
| setup interrupt description table | lidt [_IdtLoader] |
| setup interrupt description table call | _PicInit |
| programable interrupt controler initialization mov | eax |
| programable interrupt controler initialization mov | _Main |
| _OutByte | __pad14__ |
| _OutByte esp push eax push edx mov | edx |
| _OutByte esp push eax push edx mov port mov | al |
| _OutByte esp push eax push edx mov port mov value out | dx |
| _OutByte esp push eax push edx mov port mov value out al pop edx pop eax pop ebp | ret |
| _InByte | __pad15__ |
| _OsRootTaskStart | __pad16__ |
| only executes at main for task running mov | mov [_OsRunning] |
| only executes at main for task running mov eax mov get current process address mov get value of pCurrentProcess Esp | popad |
| popad is of popa pop out | edi |
| popad is of popa pop out | esi |
| popad is of popa pop out | ebp |
| popad is of popa pop out | ebx |
| popad is of popa pop out | ecx |
| popad is of popa pop out eax | iretd |
| _OsTaskSwitchOut | __pad17__ |
| IrqExit | __pad18__ |
| when irq is not | reenter |
| when irq is not run this code for exit | irq |
| else no do task switch | L_IrqExitSwitchTask |
| _OsTaskSwitch = 0 | |
| update to current task pointer mov get value of pCurrentProcess Esp dec | dword [_OsIntNesting] |
| leave this | interrupt |
| popad is of popa pop out eax iretd | L_IrqExitNoSwitchTask |
| popad is of popa pop out eax iretd | IrqExitForIrqReenter |
| when irq is | reentered |
| when irq is no need to run code above mov | byte [_OsHasIntNesting] |
| Irq0Executor | __pad19__ |
| OsIntNesting cmp check if | _OsIntNesting |
| switch to kernel | stack |
| switch to kernel s t irqs use kernel no use task s stack push | IrqExit |
| return address for interrupt handler jmp | L_Irq0Execution |
| jump to execution irq code | L_Irq0Reenter |
| write end of interrupt to pic master | sti |
| irq handler execution | cli |
| reti | ans |
| return address for interrupt handler jmp | L_Irq1Execution |
| jump to execution irq code | L_Irq1Reenter |
| return address for interrupt handler jmp | L_Irq2Execution |
| jump to execution irq code | L_Irq2Reenter |
| return address for interrupt handler jmp | L_Irq3Execution |
| jump to execution irq code | L_Irq3Reenter |
| return address for interrupt handler jmp | L_Irq4Execution |
| jump to execution irq code | L_Irq4Reenter |
| check if not jne | L_Irq5Reenter |
| return address for interrupt handler jmp | L_Irq5Execution |
| return address for interrupt handler jmp | L_Irq6Execution |
| jump to execution irq code | L_Irq6Reenter |
| return address for interrupt handler jmp | L_Irq7Execution |
| jump to execution irq code | L_Irq7Reenter |
| return address for interrupt handler jmp | L_Irq8Execution |
| jump to execution irq code | L_Irq8Reenter |
| return address for interrupt handler jmp | L_Irq9Execution |
| jump to execution irq code | L_Irq9Reenter |
| return address for interrupt handler jmp | L_Irq10Execution |
| jump to execution irq code | L_Irq10Reenter |
| return address for interrupt handler jmp | L_Irq11Execution |
| jump to execution irq code | L_Irq11Reenter |
| return address for interrupt handler jmp | L_Irq12Execution |
| jump to execution irq code | L_Irq12Reenter |
| return address for interrupt handler jmp | L_Irq13Execution |
| jump to execution irq code | L_Irq13Reenter |
| return address for interrupt handler jmp | L_Irq14Execution |
| jump to execution irq code | L_Irq14Reenter |
| return address for interrupt handler jmp | L_Irq15Execution |
| jump to execution irq code | L_Irq15Reenter |
| return from interrupt bit instruction | eflags |
| return from interrupt bit instruction | ecs |
| return from interrupt bit instruction eip | L_CpuInt0Reenter |
| return from interrupt bit instruction eip | CpuInt1Executor |
| return from interrupt bit instruction eip | L_CpuInt1Reenter |
| return from interrupt bit instruction eip | CpuInt2Executor |
| return from interrupt bit instruction eip | L_CpuInt2Reenter |
| return from interrupt bit instruction eip | CpuInt3Executor |
| return from interrupt bit instruction eip | L_CpuInt3Reenter |
| return from interrupt bit instruction eip | CpuInt4Executor |
| return from interrupt bit instruction eip | L_CpuInt4Reenter |
| return from interrupt bit instruction eip | CpuInt5Executor |
| return from interrupt bit instruction eip | L_CpuInt5Reenter |
| return from interrupt bit instruction eip | CpuInt6Executor |
| return from interrupt bit instruction eip | L_CpuInt6Reenter |
| return from interrupt bit instruction eip | CpuInt7Executor |
| return from interrupt bit instruction eip | L_CpuInt7Reenter |
| return from interrupt bit instruction eip | CpuInt8Executor |
| return from interrupt bit instruction eip | L_CpuInt8Reenter |
| return from interrupt bit instruction eip | CpuInt9Executor |
| return from interrupt bit instruction eip | L_CpuInt9Reenter |
| return from interrupt bit instruction eip | CpuInt10Executor |
| return from interrupt bit instruction eip | L_CpuInt10Reenter |
| return from interrupt bit instruction eip | CpuInt11Executor |
| return from interrupt bit instruction eip | L_CpuInt11Reenter |
| return from interrupt bit instruction eip | CpuInt12Executor |
| return from interrupt bit instruction eip | L_CpuInt12Reenter |
| return from interrupt bit instruction eip | CpuInt13Executor |
| return from interrupt bit instruction eip | L_CpuInt13Reenter |
| return from interrupt bit instruction eip | CpuInt14Executor |
| popad is of popa pop out eax iretd | L_CpuInt14Reenter |
| return from interrupt bit instruction eip | CpuInt15Executor |
| popad is of popa pop out eax iretd | L_CpuInt15Reenter |
| return from interrupt bit instruction eip | CpuInt16Executor |
| popad is of popa pop out eax iretd | L_CpuInt16Reenter |
| return from interrupt bit instruction eip | CpuInt17Executor |
| popad is of popa pop out eax iretd | L_CpuInt17Reenter |
| return from interrupt bit instruction eip | CpuInt18Executor |
| popad is of popa pop out eax iretd | L_CpuInt18Reenter |
| return from interrupt bit instruction eip | CpuInt19Executor |
| popad is of popa pop out eax iretd | L_CpuInt19Reenter |
| return from interrupt bit instruction | eip |
| SoftwareInt48Executor | __pad20__ |
| return from interrupt bit instruction | L_SoftwareInt48Reenter |
| when irq is not run this code for exit and switch to curent process mov cmp if | ( | OsTaskSwitch | = =1 |
) |
| intel reserved _CpuIntExecutorTable |
| code section for instructions _EntryStart |
| bytes for interrupt descriptors _IdtLoader |
| global _OsRootTaskStart global _OsTaskSwitchOut global _OutByte global _InByte |
| reserve _IrqExecutorTable |
| _OsTaskSwitch _OsTaskCurrent _OsTaskNext _OsIntNesting _OsRunning _OsHasIntNesting |
| _OsTaskSwitch = 0 |
| executor for irqs dd Irq0Executor dd Irq1Executor dd Irq2Executor dd Irq3Executor dd Irq4Executor dd Irq5Executor dd Irq6Executor dd Irq7Executor dd Irq8Executor dd Irq9Executor dd Irq10Executor dd Irq11Executor dd Irq12Executor dd Irq13Executor dd Irq14Executor dd Irq15Executor _SoftwareIntHandlersTable |
| The gdt base linear address |
| global _IdtTable global _GdtTable global _IrqHandlersTable global _IrqExecutorTable global _CpuIntHandlersTable global _CpuIntExecutorTable global _SoftwareIntHandlersTable global _SoftwareIntExecutorTable bits[SECTION.bss] |
| when irq is no need to run code above mov byte[_OsHasIntNesting] |
| return from interrupt bit instruction eip CpuInt10Executor |
| fpu segment overflow CpuInt10Handler |
| return from interrupt bit instruction eip CpuInt11Executor |
| invalid tss CpuInt11Handler |
| return from interrupt bit instruction eip CpuInt12Executor |
| invalid segment CpuInt12Handler |
| return from interrupt bit instruction eip CpuInt13Executor |
| stack overflow CpuInt13Handler |
| return from interrupt bit instruction eip CpuInt14Executor |
| general protect CpuInt14Handler |
| return from interrupt bit instruction eip CpuInt15Executor |
| page fault CpuInt15Handler |
| return from interrupt bit instruction eip CpuInt16Executor |
| undefine just not cpu fault CpuInt16Handler |
| return from interrupt bit instruction eip CpuInt17Executor |
| fpu error CpuInt17Handler |
| return from interrupt bit instruction eip CpuInt18Executor |
| correction error CpuInt18Handler |
| return from interrupt bit instruction eip CpuInt19Executor |
| machine error CpuInt19Handler |
| divide by CpuInt1Handler |
| single step CpuInt2Handler |
| nmi CpuInt3Handler |
| breakpoint CpuInt4Handler |
| overflow CpuInt5Handler |
| bound CpuInt6Handler |
| invalid opcode CpuInt7Handler |
| no fpu CpuInt8Handler |
| double fault CpuInt9Handler |
| end of interrupt define INT_VECTOR_IRQ0 |
Initial value:
x86 interrupt number 0x20~0x27 %define INT_VECTOR_IRQ8 0x28
| handlers in total Irq0Handler |
| redir irq2 Irq10Handler |
| user Irq11Handler |
| user Irq12Handler |
| user Irq13Handler |
| fpu Irq14Handler |
| hdc Irq15Handler |
| timer Irq1Handler |
| keyboard Irq2Handler |
| slave pic Irq3Handler |
| com2 Irq4Handler |
| com1 Irq5Handler |
| lpt2 Irq6Handler |
| lpt1 Irq8Handler |
| rtc Irq9Handler |
| bss section for uninitialized data KernelStackSpace |
| get value of pCurrentProcess Esp mov KernelStackTop |
| return from interrupt bit instruction eip L_CpuInt0Reenter |
| return from interrupt bit instruction eip L_CpuInt10Reenter |
| return from interrupt bit instruction eip L_CpuInt11Reenter |
| return from interrupt bit instruction eip L_CpuInt12Reenter |
| return from interrupt bit instruction eip L_CpuInt13Reenter |
| return from interrupt bit instruction eip L_CpuInt1Reenter |
| return from interrupt bit instruction eip L_CpuInt2Reenter |
| return from interrupt bit instruction eip L_CpuInt3Reenter |
| return from interrupt bit instruction eip L_CpuInt4Reenter |
| return from interrupt bit instruction eip L_CpuInt5Reenter |
| return from interrupt bit instruction eip L_CpuInt6Reenter |
| return from interrupt bit instruction eip L_CpuInt7Reenter |
| return from interrupt bit instruction eip L_CpuInt8Reenter |
| return from interrupt bit instruction eip L_CpuInt9Reenter |
| it is already in kernel now nested interrupt L_Irq0Execution |
| jump to execution irq code L_Irq0Reenter |
| it is already in kernel now nested interrupt L_Irq10Execution |
| jump to execution irq code L_Irq10Reenter |
| it is already in kernel now nested interrupt L_Irq11Execution |
| jump to execution irq code L_Irq11Reenter |
| it is already in kernel now nested interrupt L_Irq12Execution |
| jump to execution irq code L_Irq12Reenter |
| it is already in kernel now nested interrupt L_Irq13Execution |
| jump to execution irq code L_Irq13Reenter |
| it is already in kernel now nested interrupt L_Irq14Execution |
| jump to execution irq code L_Irq14Reenter |
| it is already in kernel now nested interrupt L_Irq15Execution |
| jump to execution irq code L_Irq15Reenter |
| it is already in kernel now nested interrupt L_Irq1Execution |
| jump to execution irq code L_Irq1Reenter |
| it is already in kernel now nested interrupt L_Irq2Execution |
| jump to execution irq code L_Irq2Reenter |
| it is already in kernel now nested interrupt L_Irq3Execution |
| jump to execution irq code L_Irq3Reenter |
| it is already in kernel now nested interrupt L_Irq4Execution |
| jump to execution irq code L_Irq4Reenter |
| it is already in kernel now nested interrupt L_Irq5Execution |
| jump to execution irq code L_Irq5Reenter |
| it is already in kernel now nested interrupt L_Irq6Execution |
| jump to execution irq code L_Irq6Reenter |
| it is already in kernel now nested interrupt L_Irq7Execution |
| jump to execution irq code L_Irq7Reenter |
| it is already in kernel now nested interrupt L_Irq8Execution |
| jump to execution irq code L_Irq8Reenter |
| it is already in kernel now nested interrupt L_Irq9Execution |
| jump to execution irq code L_Irq9Reenter |
| else no do task switch L_IrqExitSwitchTask |
| use jump to enter new protection mode L_SetupIdt |
| return from interrupt bit instruction L_SoftwareInt48Reenter |
| setup interrupt description table lidt[_IdtLoader] |
| write end of interrupt to pic out PIC_MASTER_PORT |
| unmask int bit in master out PIC_MASTER_PORT2 |
| write end of interrupt to pic master out PIC_SLAVE_PORT |
| unmask int bit in slave out PIC_SLAVE_PORT2 |
| graphics segment is not set it to extra segment gdt entry is at of GdtTable jmp SELECTOR_KERNEL_CS |
| executor for irqs dd SoftwareInt48Executor |
| irq8 ~f |
Initial value:
x86 interrupt number 0x28~0x2f %define SELECTOR_KERNEL_CS 0x08
1.5.9