diff --git a/kernel/trunk/core/memory.inc b/kernel/trunk/core/memory.inc index 413b7a0806..d5720f0343 100644 --- a/kernel/trunk/core/memory.inc +++ b/kernel/trunk/core/memory.inc @@ -1038,6 +1038,7 @@ proc fpu_save jnc .no_SSE fxsave [eax] + fninit ;re-init fpu ret .no_SSE: fnsave [eax] @@ -1055,6 +1056,7 @@ proc fpu_restore fxrstor [eax] ret .no_SSE: + fnclex ;fix possible problems frstor [eax] ret endp diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index 44643fac19..8f703a3602 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -236,7 +236,6 @@ e7: frstor [eax] restore_ring3_context iret - .init: fninit ;нам не нужны немаскированные исключения .ready: @@ -693,8 +692,17 @@ terminate: ; terminate application cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1 jne fpu_ok_1 - mov [fpu_owner],1 - fpu_ok_1: + + mov [fpu_owner],1 + mov eax, [256+PROC_BASE+0x10] + bt [cpu_caps], CAPS_FXSR + jnc .no_SSE + fxrstor [eax] + jmp fpu_ok_1 +.no_SSE: + fnclex + frstor [eax] +fpu_ok_1: mov [0xf400],byte 0 ; empty keyboard buffer mov [0xf500],byte 0 ; empty button buffer diff --git a/kernel/trunk/drivers/mixer.asm b/kernel/trunk/drivers/mixer.asm index 14c1715896..dc3b19f45a 100644 --- a/kernel/trunk/drivers/mixer.asm +++ b/kernel/trunk/drivers/mixer.asm @@ -29,12 +29,8 @@ proc new_mix stdcall, output:dword cmp [play_count], 0 je .exit -; mov eax, fpu_state -; fnsave [eax] call FpuSave - emms mov [main_count], 32; - .l00: mov [mix_buff_map], 0x0000FFFF; xor eax, eax @@ -98,6 +94,7 @@ proc new_mix stdcall, output:dword jnz .l00 call update_stream + emms call FpuRestore ret .exit: