Update contrib.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\nkern\x86\ncutils.cia
20 EXPORT_C __NAKED__ TUint64 X86::Timestamp()
26 extern "C" __NAKED__ void NKIdle(TInt)
32 __NAKED__ void InitFpu()
35 asm("and al, 0xf7"); // enable access to FPU
38 asm("lea ecx, %a0": : "i"(DefaultCoprocessorState));
40 asm("fnsave [ecx]"); // save clean coprocessor state
43 asm("mov cr0, eax"); // disable access to coprocessor
48 const TLinAddr addressof_CrashState = (TLinAddr)&::CrashState;
49 const TLinAddr addressof_X86_Regs = (TLinAddr)&::X86_Regs;
50 const TLinAddr addressof_X86_IrqNestCount = (TLinAddr)&::X86_IrqNestCount;
52 /** @internalTechnology
54 Called to indicate that the system has crashed and all CPUs should be
55 halted and should dump their registers.
59 __NAKED__ void NKern::NotifyCrash(const TAny* /*a0*/, TInt /*a1*/)
64 asm("mov ebp, %0" : : "i" (addressof_CrashState));
65 asm("mov dword ptr [ebp], 1 ");
66 asm("mov ebp, %0" : : "i" (addressof_X86_Regs));
67 asm("mov [ebp+%0], eax" : : "i" _FOFF(SFullX86RegSet,iEax));
68 asm("mov [ebp+%0], ebx" : : "i" _FOFF(SFullX86RegSet,iEbx));
69 asm("mov [ebp+%0], ecx" : : "i" _FOFF(SFullX86RegSet,iEcx));
70 asm("mov [ebp+%0], edx" : : "i" _FOFF(SFullX86RegSet,iEdx));
71 asm("mov [ebp+%0], esi" : : "i" _FOFF(SFullX86RegSet,iEsi));
72 asm("mov [ebp+%0], edi" : : "i" _FOFF(SFullX86RegSet,iEdi));
73 asm("pop dword ptr [ebp+%0]" : : "i" _FOFF(SFullX86RegSet,iEbp)); // pushed EBP
74 asm("pop dword ptr [ebp+%0]" : : "i" _FOFF(SFullX86RegSet,iEflags)); // pushed EFLAGS
75 asm("pop dword ptr [ebp+%0]" : : "i" _FOFF(SFullX86RegSet,iEip)); // return address
76 asm("pop dword ptr [ebp+%0]" : : "i" _FOFF(SFullX86RegSet,iFaultCategory)); // a0 parameter
77 asm("pop dword ptr [ebp+%0]" : : "i" _FOFF(SFullX86RegSet,iFaultReason)); // a1 parameter
78 asm("mov [ebp+%0], esp" : : "i" _FOFF(SFullX86RegSet,iEsp));
79 asm("lea eax, [ebp+%0]" : : "i" _FOFF(SFullX86RegSet,iCs));
80 asm("mov [eax], cs ");
81 asm("mov [eax+4], ds ");
82 asm("mov [eax+8], es ");
83 asm("mov [eax+12], fs ");
84 asm("mov [eax+16], gs ");
85 asm("mov [eax+20], ss ");
86 asm("mov ebx, %0" : : "i" (addressof_X86_IrqNestCount));
87 asm("mov eax, 0x80000000 ");
88 asm("lock xchg eax, [ebx] ");
89 asm("mov [ebp+%0], eax" : : "i" _FOFF(SFullX86RegSet,iIrqNestCount));
95 asm("call %a0" : : "i" (NKCrashHandler));
99 asm("push dword ptr [ebp+%0]" : : "i" _FOFF(SFullX86RegSet,iFaultReason)); // a1 parameter
100 asm("push dword ptr [ebp+%0]" : : "i" _FOFF(SFullX86RegSet,iFaultCategory)); // a0 parameter
102 asm("call %a0" : : "i" (NKCrashHandler));
104 asm("int 0xff "); // shouldn't get here