; Low level interrupt/thread handling code for GeekOS.
; Copyright (c) 2001,2003,2004 David H. Hovemeyer <daveho@cs.umd.edu>
; Copyright (c) 2003, Jeffrey K. Hollingsworth <hollings@cs.umd.edu>
-; $Revision: 1.4 $
+; $Revision: 1.8 $
; This is free software. You are permitted to use,
; redistribute, and modify it as specified in the file "COPYING".
; Function to activate a new user context (if needed).
IMPORT Switch_To_User_Context
+; Debug functions
+IMPORT SerialPrintHex
+IMPORT SerialPutChar
+
; Sizes of interrupt handler entry points for interrupts with
; and without error codes. The code in idt.c uses this
; information to infer the layout of the table of interrupt
EXPORT Set_MSR
EXPORT Get_MSR
+
EXPORT Get_CR2
EXPORT Get_CR3
+
EXPORT Proc_test
; ----------------------------------------------------------------------
+
align 8
Get_CR2:
mov eax, cr2
mov esi, [esp+REG_SKIP] ; get interrupt number
mov ebx, [eax+esi*4] ; get address of handler function
+; push esi
+; call SerialPrintHex
+; pop esi
+
+; push eax
+; mov eax, 0xa
+; push eax
+; call SerialPutChar
+; pop eax
+; pop eax
+
; Call the handler.
; The argument passed is a pointer to an Interrupt_State struct,
; which describes the stack layout for all interrupts.
mov [g_needReschedule], dword 0
.restore:
+
+; push ebp
+; mov ebp, esp
+; pusha
+;
+; mov eax, 0xa
+; push eax
+; call SerialPutChar
+; pop eax
+; mov eax, 0xa
+; push eax
+; call SerialPutChar
+; pop eax
+;
+; mov ecx, 4
+; mov edx, 24
+;
+;.loop:
+; mov eax, [ebp + ecx]
+;
+; push eax
+; call SerialPrintHex
+; pop eax
+;
+; mov eax, 0xa
+; push eax
+; call SerialPutChar
+; pop eax
+;
+; add ecx, 4
+; dec edx
+; jnz .loop
+;
+;
+; popa
+; pop ebp
+
; Activate the user context, if necessary.
Activate_User_Context
; Restore registers
Restore_Registers
+
+; pusha
+
+; mov eax, 0xaa
+; push eax
+; call SerialPrintHex
+; pop eax
+
+; mov eax, 0xa
+; push eax
+; call SerialPutChar
+; pop eax
+
+; popa
+
; Return from the interrupt.
iret