kernel/eka/nkernsmp/x86/vectors.cia
changeset 279 957c583b417b
parent 90 947f0dc9f7a8
equal deleted inserted replaced
275:2b433474f2ba 279:957c583b417b
   512 	asm("test dword ptr [ebp+%0], 3 " : : "i" _FOFF(TX86ExcInfo,iCs));		// check if we came from kernel mode
   512 	asm("test dword ptr [ebp+%0], 3 " : : "i" _FOFF(TX86ExcInfo,iCs));		// check if we came from kernel mode
   513 	asm("jz short ring0_exception ");
   513 	asm("jz short ring0_exception ");
   514 	asm("add eax, 8 ");			// EAX = ESP at point of exception if ring 3
   514 	asm("add eax, 8 ");			// EAX = ESP at point of exception if ring 3
   515 	asm("mov cx, %0" : : "i" (KRing0DS));
   515 	asm("mov cx, %0" : : "i" (KRing0DS));
   516 	asm("mov gs, cx ");			// exception in user mode -> GS = user mode DS
   516 	asm("mov gs, cx ");			// exception in user mode -> GS = user mode DS
       
   517 	asm("mov [ebp], eax ");
       
   518 	asm("jmp short ring3_exception ");
       
   519 
   517 	asm("ring0_exception: ");
   520 	asm("ring0_exception: ");
   518 	asm("mov [ebp], eax ");
   521 	asm("mov [ebp], eax ");
   519 
   522 	asm("cmp dword ptr [ebp+%0], 13 " : : "i" _FOFF(TX86ExcInfo, iExcId)); // check for GPF
       
   523 	asm("jnz short ring3_exception ");
       
   524 	asm("cmp dword ptr [ebp+%0], 0x7fa " : : "i" _FOFF(TX86ExcInfo, iExcErrorCode)); // check for int 0xff
       
   525 	asm("jz short fatal_exception_crash ");		// explicit crash instruction, so die immediately
       
   526 
       
   527 	asm("ring3_exception: ");
   520 	asm("cmp dword ptr [esi+%0], -1 " : : "i" _FOFF(TSubScheduler, iSSX.iIrqNestCount));
   528 	asm("cmp dword ptr [esi+%0], -1 " : : "i" _FOFF(TSubScheduler, iSSX.iIrqNestCount));
   521 	asm("jnz short fatal_exception_irq ");
   529 	asm("jnz short fatal_exception_irq ");
   522 	asm("cmp dword ptr [esi+%0], 0 " : : "i" _FOFF(TSubScheduler, iKernLockCount));
   530 	asm("cmp dword ptr [esi+%0], 0 " : : "i" _FOFF(TSubScheduler, iKernLockCount));
   523 	asm("jnz short fatal_exception_locked ");
   531 	asm("jnz short fatal_exception_locked ");
   524 	asm("sti ");
   532 	asm("sti ");
   565 	asm("add esp, 8 ");		// skip vector number and error code
   573 	asm("add esp, 8 ");		// skip vector number and error code
   566 	asm("iretd ");
   574 	asm("iretd ");
   567 
   575 
   568 	asm("fatal_exception_irq: ");
   576 	asm("fatal_exception_irq: ");
   569 	asm("fatal_exception_locked: ");
   577 	asm("fatal_exception_locked: ");
       
   578 	asm("fatal_exception_crash: ");
   570 	asm("mov eax, %0" : : "i" (addressof_TheScheduler)); 
   579 	asm("mov eax, %0" : : "i" (addressof_TheScheduler)); 
   571 	asm("lea eax, [eax+%0]" : : "i" _FOFF(TScheduler,iMonitorExceptionHandler));
   580 	asm("lea eax, [eax+%0]" : : "i" _FOFF(TScheduler,iMonitorExceptionHandler));
   572 	asm("mov eax, [eax] ");
   581 	asm("mov eax, [eax] ");
   573 
   582 
   574 	asm("test eax, eax ");
   583 	asm("test eax, eax ");