1#/** @file
2#
3#    Low level IA32 specific EBC support routines.
4#
5#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
6#  This program and the accompanying materials
7#  are licensed and made available under the terms and conditions of the BSD License
8#  which accompanies this distribution.  The full text of the license may be found at
9#  http://opensource.org/licenses/bsd-license.php
10#
11#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13#
14#**/
15
16ASM_GLOBAL ASM_PFX(CopyMem)
17ASM_GLOBAL ASM_PFX(EbcInterpret)
18ASM_GLOBAL ASM_PFX(ExecuteEbcImageEntryPoint)
19
20ASM_GLOBAL ASM_PFX(EbcLLCALLEXNative)
21ASM_PFX(EbcLLCALLEXNative):
22         push   %ebp
23         push   %ebx
24         mov    %esp,%ebp
25         mov    0xc(%esp),%ecx
26         mov    0x14(%esp),%eax
27         mov    0x10(%esp),%edx
28         sub    %edx,%eax
29         sub    %eax,%esp
30         mov    %esp,%ebx
31         push   %ecx
32         push   %eax
33         push   %edx
34         push   %ebx
35         call   ASM_PFX(CopyMem)
36         pop    %eax
37         pop    %eax
38         pop    %eax
39         pop    %ecx
40         call   *%ecx
41         mov    %ebp,%esp
42         mov    %ebp,%esp
43         pop    %ebx
44         pop    %ebp
45         ret
46
47ASM_GLOBAL ASM_PFX(EbcLLEbcInterpret)
48ASM_PFX(EbcLLEbcInterpret):
49    # Construct new stack
50    push %ebp
51    mov  %esp, %ebp
52    push %esi
53    push %edi
54    sub  $0x40, %esp
55    push %eax
56    mov  %ebp, %esi
57    add  $0x8, %esi
58    mov  %esp, %edi
59    add  $0x4, %edi
60    mov  $0x10, %ecx
61    rep  movsd
62
63    # call C-code
64    call ASM_PFX(EbcInterpret)
65    add  $0x44, %esp
66    pop  %edi
67    pop  %esi
68    pop  %ebp
69    ret
70
71ASM_GLOBAL ASM_PFX(EbcLLExecuteEbcImageEntryPoint)
72ASM_PFX(EbcLLExecuteEbcImageEntryPoint):
73    # Construct new stack
74    mov  %eax, -0xC(%esp)
75    mov  0x4(%esp), %eax
76    mov  %eax, -0x8(%esp)
77    mov  0x8(%esp), %eax
78    mov  %eax, -0x4(%esp)
79    # call C-code
80    sub  $0xC, %esp
81    call ASM_PFX(ExecuteEbcImageEntryPoint)
82    add  $0xC, %esp
83    ret
84