1 /** @file
2   Emulator Thunk to abstract OS services from pure EFI code
3 
4   Copyright (c) 2010 - 2011, Apple Inc. All rights reserved.<BR>
5   Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
6 
7   This program and the accompanying materials
8   are licensed and made available under the terms and conditions of the BSD License
9   which accompanies this distribution.  The full text of the license may be found at
10   http://opensource.org/licenses/bsd-license.php
11 
12   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 
15 **/
16 
17 #ifndef __EMU_THREAD_THUNK__
18 #define __EMU_THREAD_THUNK__
19 
20 
21 typedef struct _EMU_THREAD_THUNK_PROTOCOL  EMU_THREAD_THUNK_PROTOCOL;
22 
23 
24 typedef
25 UINTN
26 (EFIAPI *THREAD_THUNK_MUTEX_LOCK) (
27   IN VOID *Mutex
28   );
29 
30 
31 typedef
32 UINTN
33 (EFIAPI *THREAD_THUNK_MUTEX_UNLOCK) (
34   IN VOID *Mutex
35   );
36 
37 
38 typedef
39 UINTN
40 (EFIAPI *THREAD_THUNK_MUTEX_TRY_LOCK) (
41   IN VOID *Mutex
42   );
43 
44 
45 typedef
46 VOID *
47 (EFIAPI *THREAD_THUNK_MUTEX_INIT) (
48   IN VOID
49   );
50 
51 
52 typedef
53 UINTN
54 (EFIAPI *THREAD_THUNK_MUTEX_DISTROY) (
55   IN VOID *Mutex
56   );
57 
58 
59 
60 typedef
61 VOID *
62 (EFIAPI *THREAD_THUNK_THREAD_ENTRY) (
63   IN  VOID *Context
64   );
65 
66 typedef
67 UINTN
68 (EFIAPI *THREAD_THUNK_CREATE_THREAD) (
69   IN  VOID                      *Thread,
70   IN  VOID                      *Attribute,
71   IN  THREAD_THUNK_THREAD_ENTRY Start,
72   IN  VOID                      *Context
73   );
74 
75 typedef
76 VOID
77 (EFIAPI *THREAD_THUNK_EXIT_THREAD) (
78   IN VOID *ValuePtr
79   );
80 
81 
82 typedef
83 UINTN
84 (EFIAPI *THREAD_THUNK_SELF) (
85   VOID
86   );
87 
88 
89 struct _EMU_THREAD_THUNK_PROTOCOL {
90   THREAD_THUNK_MUTEX_LOCK       MutexLock;
91   THREAD_THUNK_MUTEX_UNLOCK     MutexUnlock;
92   THREAD_THUNK_MUTEX_TRY_LOCK   MutexTryLock;
93   THREAD_THUNK_MUTEX_INIT       MutexInit;
94   THREAD_THUNK_MUTEX_DISTROY    MutexDistroy;
95   THREAD_THUNK_CREATE_THREAD    CreateThread;
96   THREAD_THUNK_EXIT_THREAD      ExitThread;
97   THREAD_THUNK_SELF             Self;
98 };
99 
100 extern EFI_GUID gEmuThreadThunkProtocolGuid;
101 
102 #endif
103 
104