fixed fpu_save()

git-svn-id: svn://kolibrios.org@435 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-03-28 17:06:08 +00:00
parent c58d3fcbd1
commit 7ca193f613
3 changed files with 55 additions and 48 deletions

View File

@ -59,36 +59,43 @@ fpu_save:
mov edi, eax mov edi, eax
mov ecx, [fpu_owner] mov ecx, [fpu_owner]
mov eax, [CURRENT_TASK] mov esi, [CURRENT_TASK]
cmp ecx, eax cmp ecx, esi
jne .save jne .save
.copy:
shl eax, 8 call save_context
mov esi, [eax+SLOT_BASE+APPDATA.fpu_state] 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 mov ecx, 512/4
cld cld
rep movsd rep movsd
fninit fninit
.exit:
popfd popfd
pop edi pop edi
pop esi pop esi
pop ecx pop ecx
ret 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 bt [cpu_caps], CAPS_SSE
jnc .no_SSE jnc .no_SSE
fxsave [ecx] fxsave [eax]
jmp .copy ret
.no_SSE: .no_SSE:
fnsave [ecx] fnsave [eax]
jmp .copy ret
align 4 align 4
fpu_restore: fpu_restore:
@ -106,7 +113,6 @@ fpu_restore:
jne .copy jne .copy
clts clts
bt [cpu_caps], CAPS_SSE bt [cpu_caps], CAPS_SSE
jnc .no_SSE jnc .no_SSE

View File

@ -967,6 +967,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\
mov esi, fpu_data mov esi, fpu_data
mov ecx, 512/4 mov ecx, 512/4
cld
rep movsd rep movsd
cmp ebx,[TASK_COUNT] cmp ebx,[TASK_COUNT]

View File

@ -679,10 +679,10 @@ include 'vmodeld.inc'
mov esi,boot_setostask mov esi,boot_setostask
call boot_log call boot_log
mov eax, fpu_data ; mov eax, fpu_data
mov dword [SLOT_BASE+APPDATA.fpu_state], eax ; mov dword [SLOT_BASE+APPDATA.fpu_state], eax
mov dword [SLOT_BASE+APPDATA.fpu_handler], 0 ; mov dword [SLOT_BASE+APPDATA.fpu_handler], 0
mov dword [SLOT_BASE+APPDATA.sse_handler], 0 ; mov dword [SLOT_BASE+APPDATA.sse_handler], 0
; name for OS/IDLE process ; name for OS/IDLE process