X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgeekos%2Flowlevel.asm;h=30979decebd40b0bad32b909f184c31d4bc5f1ad;hb=091d8b1fcfc3a766f6603d4c1c69d9f8f4bf3031;hp=63f93c262b049595d5bd2893c38cfd316513bd5f;hpb=626595465a2c6987606a6bc697df65130ad8c2d3;p=palacios.git diff --git a/palacios/src/geekos/lowlevel.asm b/palacios/src/geekos/lowlevel.asm index 63f93c2..30979de 100644 --- a/palacios/src/geekos/lowlevel.asm +++ b/palacios/src/geekos/lowlevel.asm @@ -2,7 +2,7 @@ ; Low level interrupt/thread handling code for GeekOS. ; Copyright (c) 2001,2003,2004 David H. Hovemeyer ; Copyright (c) 2003, Jeffrey K. Hollingsworth -; $Revision: 1.1 $ +; $Revision: 1.8 $ ; This is free software. You are permitted to use, ; redistribute, and modify it as specified in the file "COPYING". @@ -126,6 +126,10 @@ IMPORT Make_Runnable ; 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 @@ -165,12 +169,15 @@ EXPORT Flush_TLB ; CPUID functions EXPORT cpuid_ecx EXPORT cpuid_eax +EXPORT cpuid_edx ; Utility Functions EXPORT Set_MSR EXPORT Get_MSR + EXPORT Get_CR2 +EXPORT Get_CR3 EXPORT Proc_test @@ -269,6 +276,29 @@ Flush_TLB: ret + +; +; cpuid_edx - return the edx register from cpuid +; +align 8 +cpuid_edx: + push ebp + mov ebp, esp + push edx + push ecx + push ebx + + mov eax, [ebp + 8] + cpuid + mov eax, edx + + pop ebx + pop ecx + pop edx + pop ebp + ret + + ; ; cpuid_ecx - return the ecx register from cpuid ; @@ -276,11 +306,17 @@ align 8 cpuid_ecx: push ebp mov ebp, esp + push edx push ecx + push ebx + mov eax, [ebp + 8] cpuid mov eax, ecx + + pop ebx pop ecx + pop edx pop ebp ret @@ -289,8 +325,19 @@ cpuid_ecx: ; align 8 cpuid_eax: + push ebp + mov ebp, esp + push edx + push ecx + push ebx + mov eax, [esp+4] cpuid + + pop ebx + pop ecx + pop edx + pop ebp ret ; @@ -332,6 +379,7 @@ Get_MSR: + align 8 Get_CR2: mov eax, cr2 @@ -339,6 +387,11 @@ Get_CR2: align 8 +Get_CR3: + mov eax, cr3 + ret + +align 8 Proc_test: push ebp mov ebp, esp @@ -372,6 +425,17 @@ Handle_Interrupt: 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. @@ -408,12 +472,64 @@ Handle_Interrupt: 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