]>
Commit | Line | Data |
---|---|---|
ebd04fc2 | 1 | /** @file\r |
2 | GCC inline implementation of BaseLib processor specific functions.\r | |
3 | \r | |
ea6898b9 | 4 | Copyright (c) 2006 - 2010, Intel Corporation<BR>\r |
7f22d351 | 5 | Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.<BR>\r |
ebd04fc2 | 6 | All rights reserved. This program and the accompanying materials\r |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #include "BaseLibInternals.h"\r | |
17 | \r | |
18 | /**\r | |
19 | Requests CPU to pause for a short period of time.\r | |
20 | \r | |
21 | Requests CPU to pause for a short period of time. Typically used in MP\r | |
22 | systems to prevent memory starvation while waiting for a spin lock.\r | |
23 | \r | |
24 | **/\r | |
25 | VOID\r | |
26 | EFIAPI\r | |
27 | CpuPause (\r | |
28 | VOID\r | |
29 | )\r | |
30 | {\r | |
31 | __asm__ __volatile__ (\r | |
32 | "nop\n\t"\r | |
33 | "nop\n\t"\r | |
34 | "nop\n\t"\r | |
35 | "nop\n\t"\r | |
36 | "nop\n\t"\r | |
37 | );\r | |
38 | }\r | |
39 | \r | |
ea6898b9 | 40 | /**\r |
41 | Transfers control to a function starting with a new stack.\r | |
42 | \r | |
43 | This internal worker function transfers control to the function\r | |
44 | specified by EntryPoint using the new stack specified by NewStack\r | |
45 | and passing in the parameters specified by Context1 and Context2.\r | |
46 | Context1 and Context2 are optional and may be NULL.\r | |
47 | The function EntryPoint must never return.\r | |
48 | \r | |
49 | @param EntryPoint The pointer to the function to enter.\r | |
50 | @param Context1 The first parameter to pass in.\r | |
51 | @param Context2 The second Parameter to pass in\r | |
52 | @param NewStack The new Location of the stack\r | |
53 | \r | |
54 | **/\r | |
ebd04fc2 | 55 | VOID\r |
56 | EFIAPI\r | |
57 | InternalSwitchStackAsm (\r | |
58 | SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
ea6898b9 | 59 | VOID *Context1,\r |
ebd04fc2 | 60 | VOID *Context2,\r |
61 | VOID *NewStack\r | |
62 | )\r | |
63 | {\r | |
64 | __asm__ __volatile__ (\r | |
65 | "mov lr, %0\n\t"\r | |
66 | "mov sp, %3\n\t"\r | |
67 | "mov %r0, %1\n\t"\r | |
68 | "mov %r1, %2\n\t"\r | |
69 | "bx lr\n\t"\r | |
70 | : /* no output operand */\r | |
71 | : "r" (EntryPoint),\r | |
ea6898b9 | 72 | "r" (Context1),\r |
ebd04fc2 | 73 | "r" (Context2),\r |
74 | "r" (NewStack)\r | |
75 | );\r | |
76 | }\r |