X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86%2Ferrors.c;h=d73fcea4a26f90f2cc8db9ebf8fea24d53b0d59b;hb=a20cfd571f504f5c7f2d29516442a12c200441d5;hp=15fe22b0002edc3336476b945382b1c73aba52f5;hpb=95d6bcfbf5ff9d9921ca70997a64f2580d1f91a7;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/errors.c b/Kernel/arch/x86/errors.c index 15fe22b0..d73fcea4 100644 --- a/Kernel/arch/x86/errors.c +++ b/Kernel/arch/x86/errors.c @@ -5,6 +5,7 @@ */ #include #include +#include // === CONSTANTS === #define MAX_BACKTRACE 8 //!< Maximum distance to trace the stack backwards @@ -16,6 +17,8 @@ extern void Threads_Dump(void); extern void Threads_Fault(int Num); extern int GetCPUNum(void); extern void MM_DumpTables(tVAddr, tVAddr); +extern void Proc_EnableSSE(void); +extern void Proc_RestoreSSE(Uint32 Data); // === PROTOTYPES === void __stack_chk_fail(void); @@ -82,6 +85,24 @@ void ErrorHandler(tRegs *Regs) MM_PageFault( cr, Regs->err_code, Regs ); return ; } + + // #NM - Coprocessor unavaliable + if(Regs->int_num == 7) + { + tThread *thread = Proc_GetCurThread(); + if(!thread->SavedState.bSSEModified) + { + Proc_EnableSSE(); + if(!thread->SavedState.SSE) + thread->SavedState.SSE = malloc(sizeof(tSSEState) + 0xF); + else + Proc_RestoreSSE( ((Uint)thread->SavedState.SSE + 0xF) & ~0xF ); + thread->SavedState.bSSEModified = 1; + __asm__ __volatile__ ("sti"); + return ; + } + // oops, SSE enabled but a #NM, bad news + } // VM8086 GPF if(Regs->int_num == 13 && Regs->eflags & 0x20000) @@ -213,6 +234,7 @@ void Error_Backtrace(Uint eip, Uint ebp) while( MM_GetPhysAddr(ebp) && i < MAX_BACKTRACE ) { + if( ebp >= MM_KERNEL_STACKS_END ) break; //str = Debug_GetSymbol(*(Uint*)(ebp+4), &delta); if(str == NULL) LogF(" >> 0x%x", *(Uint*)(ebp+4));