]>
Commit | Line | Data |
---|---|---|
ebd04fc2 | 1 | /** @file\r |
2 | GCC inline implementation of BaseLib processor specific functions.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2007, Intel Corporation<BR>\r | |
5 | Portions copyright (c) 2008-2009 Apple Inc.<BR>\r | |
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 | |
40 | VOID\r | |
41 | EFIAPI\r | |
42 | InternalSwitchStackAsm (\r | |
43 | SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
44 | VOID *Context,\r | |
45 | VOID *Context2,\r | |
46 | VOID *NewStack\r | |
47 | )\r | |
48 | {\r | |
49 | __asm__ __volatile__ (\r | |
50 | "mov lr, %0\n\t"\r | |
51 | "mov sp, %3\n\t"\r | |
52 | "mov %r0, %1\n\t"\r | |
53 | "mov %r1, %2\n\t"\r | |
54 | "bx lr\n\t"\r | |
55 | : /* no output operand */\r | |
56 | : "r" (EntryPoint),\r | |
57 | "r" (Context),\r | |
58 | "r" (Context2),\r | |
59 | "r" (NewStack)\r | |
60 | );\r | |
61 | }\r |