diff --git a/kernel/trunk/core/fpu.inc b/kernel/trunk/core/fpu.inc index ebbb7a32a3..77c3c4b9ed 100644 --- a/kernel/trunk/core/fpu.inc +++ b/kernel/trunk/core/fpu.inc @@ -59,36 +59,43 @@ fpu_save: mov edi, eax mov ecx, [fpu_owner] - mov eax, [CURRENT_TASK] - cmp ecx, eax + mov esi, [CURRENT_TASK] + cmp ecx, esi jne .save -.copy: - shl eax, 8 - mov esi, [eax+SLOT_BASE+APPDATA.fpu_state] + + call save_context + jmp .exit +.save: + mov [fpu_owner], esi + + shl ecx, 8 + mov eax, [ecx+SLOT_BASE+APPDATA.fpu_state] + + call save_context + + shl esi, 8 + mov esi, [esi+SLOT_BASE+APPDATA.fpu_state] mov ecx, 512/4 cld rep movsd fninit - +.exit: popfd pop edi pop esi pop ecx ret -.save: - mov [fpu_owner], eax - - shl ecx, 8 - mov ecx, [ecx+SLOT_BASE+APPDATA.fpu_state] +align 4 +save_context: bt [cpu_caps], CAPS_SSE jnc .no_SSE - fxsave [ecx] - jmp .copy + fxsave [eax] + ret .no_SSE: - fnsave [ecx] - jmp .copy + fnsave [eax] + ret align 4 fpu_restore: @@ -106,7 +113,6 @@ fpu_restore: jne .copy clts - bt [cpu_caps], CAPS_SSE jnc .no_SSE @@ -135,40 +141,40 @@ fpu_restore: align 4 e7: ;#NM exception handler - save_ring3_context - clts - mov ax, os_data - mov ds, ax - mov es, ax + save_ring3_context + clts + mov ax, os_data + mov ds, ax + mov es, ax - mov ebx, [fpu_owner] - cmp ebx, [CURRENT_TASK] - je .exit + mov ebx, [fpu_owner] + cmp ebx, [CURRENT_TASK] + je .exit - shl ebx, 8 - mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state] - bt [cpu_caps], CAPS_SSE - jnc .no_SSE + shl ebx, 8 + mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state] + bt [cpu_caps], CAPS_SSE + jnc .no_SSE - fxsave [eax] - mov ebx, [CURRENT_TASK] - mov [fpu_owner], ebx - shl ebx, 8 - mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state] - fxrstor [eax] + fxsave [eax] + mov ebx, [CURRENT_TASK] + mov [fpu_owner], ebx + shl ebx, 8 + mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state] + fxrstor [eax] .exit: - restore_ring3_context - iret + restore_ring3_context + iret .no_SSE: - fnsave [eax] - mov ebx, [CURRENT_TASK] - mov [fpu_owner], ebx - shl ebx, 8 - mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state] - frstor [eax] - restore_ring3_context - iret + fnsave [eax] + mov ebx, [CURRENT_TASK] + mov [fpu_owner], ebx + shl ebx, 8 + mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state] + frstor [eax] + restore_ring3_context + iret iglobal fpu_owner dd 1 diff --git a/kernel/trunk/core/taskman.inc b/kernel/trunk/core/taskman.inc index cc8a1dbad8..0b6ad5353e 100644 --- a/kernel/trunk/core/taskman.inc +++ b/kernel/trunk/core/taskman.inc @@ -967,6 +967,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\ mov esi, fpu_data mov ecx, 512/4 + cld rep movsd cmp ebx,[TASK_COUNT] diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index cae0cba44f..6551c2b2e3 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -679,10 +679,10 @@ include 'vmodeld.inc' mov esi,boot_setostask call boot_log - mov eax, fpu_data - mov dword [SLOT_BASE+APPDATA.fpu_state], eax - mov dword [SLOT_BASE+APPDATA.fpu_handler], 0 - mov dword [SLOT_BASE+APPDATA.sse_handler], 0 +; mov eax, fpu_data +; mov dword [SLOT_BASE+APPDATA.fpu_state], eax +; mov dword [SLOT_BASE+APPDATA.fpu_handler], 0 +; mov dword [SLOT_BASE+APPDATA.sse_handler], 0 ; name for OS/IDLE process