kernel/eka/euser/epoc/x86/uc_trp.cia
changeset 9 96e5fb8b040d
equal deleted inserted replaced
-1:000000000000 9:96e5fb8b040d
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32\euser\epoc\x86\uc_trp.cia
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <u32exec.h>
       
    19 #include <e32panic.h>
       
    20 
       
    21 
       
    22 #ifndef __LEAVE_EQUALS_THROW__
       
    23 
       
    24 void __stdcall DoTrap(TTrap* aFrame);
       
    25 
       
    26 EXPORT_C __NAKED__ TInt TTrap::Trap(TInt& /*aResult*/)
       
    27 //
       
    28 // Save the enter frame state and return 0.
       
    29 //
       
    30 	{
       
    31 	THISCALL_PROLOG1()
       
    32 	asm("mov edx, [esp]");
       
    33 	asm("mov [ecx+0], edx");
       
    34 	asm("mov [ecx+4], ebx");
       
    35 	asm("mov [ecx+8], ebp");
       
    36 	asm("mov [ecx+12], esp");
       
    37 	asm("mov [ecx+16], esi");
       
    38 	asm("mov [ecx+20], edi");
       
    39 	asm("mov [ecx+24], ds");
       
    40 	asm("mov [ecx+28], es");
       
    41 	asm("mov [ecx+32], fs");
       
    42 	asm("mov [ecx+36], gs");
       
    43 	asm("mov edx, [esp+4]");
       
    44 	asm("xor eax, eax");
       
    45 	asm("mov [edx], eax");
       
    46 	asm("mov [ecx+%0], edx": : "i"_FOFF(TTrap,iResult));
       
    47 	asm("push ecx");
       
    48 	asm("call %a0": : "i"(&DoTrap));
       
    49 	asm("xor eax, eax");
       
    50 	THISCALL_EPILOG1()
       
    51 	}
       
    52 
       
    53 __NAKED__ void DoLeave(TTrap*)
       
    54 	{
       
    55 	asm("mov ecx, [esp+4]");
       
    56 	asm("mov edx, [ecx+0]");
       
    57 	asm("mov ebx, [ecx+4]");
       
    58 	asm("mov ebp, [ecx+8]");
       
    59 	asm("mov esp, [ecx+12]");
       
    60 	asm("mov esi, [ecx+16]");
       
    61 	asm("mov edi, [ecx+20]");
       
    62 	asm("mov ds, [ecx+24]");
       
    63 	asm("mov es, [ecx+28]");
       
    64 	asm("mov fs, [ecx+32]");
       
    65 	asm("mov gs, [ecx+36]");
       
    66 	asm("mov [esp], edx");
       
    67 	asm("mov eax, 1");
       
    68 	THISCALL_EPILOG1() 
       
    69 	}
       
    70 
       
    71 #endif // !__LEAVE_EQUALS_THROW__