diff --git a/kernel/arch/i386/interrupts.nim b/kernel/arch/i386/interrupts.nim index 67920fd..6475a8b 100644 --- a/kernel/arch/i386/interrupts.nim +++ b/kernel/arch/i386/interrupts.nim @@ -28,6 +28,7 @@ proc idtFlush(){.inline,asmNoStackFrame.} = ret """ +#[ proc isrHandler(registers: Registers){.exportc, codegenDecl: "__attribute__((interrupt)) $# $#$#".} = serial.write("Recieved interrupt handler:") serial.write(registers.int_no) @@ -53,6 +54,7 @@ proc isrCommon(){.asmNoStackFrame,exportc.} = add $8, %esp iret """ +]# macro generateISR(code: static[uint8], isError: static[bool]): typed = result = nnkStmtList.newTree( @@ -68,10 +70,6 @@ macro generateISR(code: static[uint8], isError: static[bool]): typed = ), newEmptyNode(), nnkStmtList.newTree( - nnkAsmStmt.newTree( - newEmptyNode(), - newLit((if isError: "" else: "push 0\x0A") & "push " & $code & "\x0A") - ), nnkCall.newTree( nnkDotExpr.newTree( newIdentNode("serial"), @@ -93,9 +91,10 @@ macro generateISR(code: static[uint8], isError: static[bool]): typed = ), newLit("\x0A") ), - nnkCall.newTree( - newIdentNode("isrCommon") - ) + nnkAsmStmt.newTree( + newEmptyNode(), + newLit((if isError: "" else: "push 0\x0A") & "push " & $code & "\x0A") + ) ) ) ) diff --git a/kernel/kernel.nim b/kernel/kernel.nim index 4d7f16b..c7d2a82 100644 --- a/kernel/kernel.nim +++ b/kernel/kernel.nim @@ -41,4 +41,5 @@ proc kernelMain() {.exportc: "kernel_main"}= terminalWrite(low(int)+1) terminalWrite("\LMAX_UINT:") terminalWrite(high(uint32)) - terminalWrite("\L") \ No newline at end of file + terminalWrite("\L") + asm """int $0x3""" \ No newline at end of file