X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Kernel%2Farch%2Fx86_64%2Fdesctab.asm;h=816d14e5c68385e1abc00b635a0ed7f07d26480a;hb=a1b7b0fcbf99e2c53dd6d7ee5961772bf29bdb2b;hp=cf1b0f614540eb94648c26c386200c82c343ab7c;hpb=f5f082502f5aeaa144a6ff60ad331e23957b0bbb;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86_64/desctab.asm b/Kernel/arch/x86_64/desctab.asm index cf1b0f61..816d14e5 100644 --- a/Kernel/arch/x86_64/desctab.asm +++ b/Kernel/arch/x86_64/desctab.asm @@ -80,7 +80,7 @@ Desctab_Init: %endrep ; Install IRQs - SETIDT 0xF0, Irq0 + SETIDT 0xF0, SchedulerIRQ SETIDT 0xF1, Irq1 SETIDT 0xF2, Irq2 SETIDT 0xF3, Irq3 @@ -321,20 +321,43 @@ IrqCommon: [extern Proc_Scheduler] [global SchedulerIRQ] SchedulerIRQ: - ; TODO: Find Current CPU PUSH_GPR ;PUSH_FPU ;PUSH_XMM - xor rsi, rsi - mov rdi, MM_LOCALAPIC+0x20 - mov esi, [rdi] + ; Save Thread Pointer + mov rax, dr0 + push rax + + ; Get the CPU Number + mov rdi, dr1 + ; Call the Scheduler call Proc_Scheduler + ; Restore Thread Pointer + pop rax + mov dr0, rax + + ; Send EOI (To either the APIC or the PIC) + %if USE_MP + test ebx, ebx + jnz .sendEOI + %endif + ; PIC + mov al, 0x20 + out 0x20, al ; ACK IRQ + %if USE_MP + jmp .ret + ; APIC +.sendEOI: + mov eax, DWORD [gpMP_LocalAPIC] + mov DWORD [eax+0x0B0], 0 + %endif +.ret: + ;POP_XMM ;POP_FPU POP_GPR - add rsp, 8*2 iretq [section .data]