]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/EbcDxe/Ipf/EbcLowLevel.s
remove some comments introduced by tools.
[mirror_edk2.git] / MdeModulePkg / Universal / EbcDxe / Ipf / EbcLowLevel.s
CommitLineData
53c71d09 1//++\r
2// Copyright (c) 2006, Intel Corporation \r
3// All rights reserved. This program and the accompanying materials \r
4// are licensed and made available under the terms and conditions of the BSD License \r
5// which accompanies this distribution. The full text of the license may be found at \r
6// http://opensource.org/licenses/bsd-license.php \r
7// \r
8// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
9// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
10// \r
11// Module Name:\r
12//\r
13// EbcLowLevel.s\r
14//\r
15// Abstract:\r
16//\r
17// Contains low level routines for the Virtual Machine implementation\r
18// on an Itanium-based platform.\r
19//\r
20//\r
21//--\r
22\r
23.file "EbcLowLevel.s"\r
24\r
25#define PROCEDURE_ENTRY(name) .##text; \\r
26 .##type name, @function; \\r
27 .##proc name; \\r
28name::\r
29\r
30#define PROCEDURE_EXIT(name) .##endp name\r
31\r
32// Note: use of NESTED_SETUP requires number of locals (l) >= 3\r
33\r
34#define NESTED_SETUP(i,l,o,r) \\r
35 alloc loc1=ar##.##pfs,i,l,o,r ;\\r
36 mov loc0=b0\r
37\r
38#define NESTED_RETURN \\r
39 mov b0=loc0 ;\\r
40 mov ar##.##pfs=loc1 ;;\\r
41 br##.##ret##.##dpnt b0;;\r
42\r
43.type CopyMem, @function; \r
44\r
45//-----------------------------------------------------------------------------\r
46//++\r
47// EbcAsmLLCALLEX\r
48//\r
49// Implements the low level EBC CALLEX instruction. Sets up the\r
50// stack pointer, does the spill of function arguments, and\r
51// calls the native function. On return it restores the original\r
52// stack pointer and returns to the caller.\r
53//\r
54// Arguments : \r
55//\r
56// On Entry :\r
57// in0 = Address of native code to call\r
58// in1 = New stack pointer\r
59//\r
60// Return Value: \r
61// \r
62// As per static calling conventions. \r
63// \r
64//--\r
65//---------------------------------------------------------------------------\r
66;// void EbcAsmLLCALLEX (UINTN FunctionAddr, UINTN EbcStackPointer)\r
67PROCEDURE_ENTRY(EbcAsmLLCALLEX)\r
68 NESTED_SETUP (2,6,8,0)\r
69\r
70 // NESTED_SETUP uses loc0 and loc1 for context save\r
71\r
72 //\r
73 // Save a copy of the EBC VM stack pointer\r
74 //\r
75 mov r8 = in1;;\r
76\r
77 //\r
78 // Copy stack arguments from EBC stack into registers. \r
79 // Assume worst case and copy 8.\r
80 //\r
81 ld8 out0 = [r8], 8;;\r
82 ld8 out1 = [r8], 8;;\r
83 ld8 out2 = [r8], 8;;\r
84 ld8 out3 = [r8], 8;;\r
85 ld8 out4 = [r8], 8;;\r
86 ld8 out5 = [r8], 8;;\r
87 ld8 out6 = [r8], 8;;\r
88 ld8 out7 = [r8], 8;;\r
89\r
90 //\r
91 // Save the original stack pointer\r
92 //\r
93 mov loc2 = r12;\r
94\r
95 //\r
96 // Save the gp\r
97 //\r
98 or loc3 = r1, r0\r
99\r
100 //\r
101 // Set the new aligned stack pointer. Reserve space for the required \r
102 // 16-bytes of scratch area as well.\r
103 //\r
104 add r12 = 48, in1\r
105\r
106 //\r
107 // Now call the function. Load up the function address from the descriptor\r
108 // pointed to by in0. Then get the gp from the descriptor at the following\r
109 // address in the descriptor.\r
110 //\r
111 ld8 r31 = [in0], 8;;\r
112 ld8 r30 = [in0];;\r
113 mov b1 = r31\r
114 mov r1 = r30\r
115 (p0) br.call.dptk.many b0 = b1;;\r
116\r
117 //\r
118 // Restore the original stack pointer and gp\r
119 //\r
120 mov r12 = loc2\r
121 or r1 = loc3, r0\r
122\r
123 //\r
124 // Now return\r
125 //\r
126 NESTED_RETURN\r
127\r
128PROCEDURE_EXIT(EbcAsmLLCALLEX)\r
129\r
130PROCEDURE_ENTRY(EbcLLCALLEXNative)\r
131 NESTED_SETUP (3,6,3,0)\r
132 \r
133 mov loc2 = in2;;\r
134 mov loc3 = in1;;\r
135 sub loc2 = loc2, loc3\r
136 mov loc4 = r12;;\r
137 or loc5 = r1, r0\r
138 \r
139 sub r12 = r12, loc2\r
140 mov out2 = loc2;;\r
141\r
142 and r12 = -0x10, r12\r
143 mov out1 = in1;;\r
144 mov out0 = r12;;\r
145 adds r12 = -0x8, r12\r
146 (p0) br.call.dptk.many b0 = CopyMem;;\r
147 adds r12 = 0x8, r12\r
148 \r
149 mov out0 = in0;;\r
150 mov out1 = r12;;\r
151 (p0) br.call.dptk.many b0 = EbcAsmLLCALLEX;;\r
152 mov r12 = loc4;;\r
153 or r1 = loc5, r0\r
154 \r
155 NESTED_RETURN\r
156PROCEDURE_EXIT(EbcLLCALLEXNative)\r
157\r
158\r
159//\r
160// UINTN EbcLLGetEbcEntryPoint(VOID)\r
161//\r
162// Description:\r
163// Simply return, so that the caller retrieves the return register\r
164// contents (R8). That's where the thunk-to-ebc code stuffed the\r
165// EBC entry point.\r
166//\r
167PROCEDURE_ENTRY(EbcLLGetEbcEntryPoint)\r
168 br.ret.sptk b0 ;;\r
169PROCEDURE_EXIT(EbcLLGetEbcEntryPoint)\r
170\r
171//\r
172// INT64 EbcLLGetReturnValue(VOID)\r
173//\r
174// Description:\r
175// This function is called to get the value returned by native code\r
176// to EBC. It simply returns because the return value should still\r
177// be in the register, so the caller just gets the unmodified value.\r
178//\r
179PROCEDURE_ENTRY(EbcLLGetReturnValue)\r
180 br.ret.sptk b0 ;;\r
181PROCEDURE_EXIT(EbcLLGetReturnValue)\r
182\r
183//\r
184// UINTN EbcLLGetStackPointer(VOID)\r
185//\r
186PROCEDURE_ENTRY(EbcLLGetStackPointer)\r
187 mov r8 = r12 ;;\r
188 br.ret.sptk b0 ;;\r
189 br.sptk.few b6 \r
190PROCEDURE_EXIT(EbcLLGetStackPointer)\r
191\r
192\r
193\r
194\r
195\r
196\r
197\r