]>
Commit | Line | Data |
---|---|---|
dd51a993 | 1 | /** @file\r |
2 | Declaration of internal functions for Base Memory Library.\r | |
3 | \r | |
19388d29 HT |
4 | Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r |
5 | This program and the accompanying materials\r | |
dd51a993 | 6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
dd51a993 | 13 | **/\r |
14 | \r | |
15 | #ifndef __MEM_LIB_INTERNALS__\r | |
16 | #define __MEM_LIB_INTERNALS__\r | |
17 | \r | |
bad46384 | 18 | #include <PiPei.h>\r |
c892d846 | 19 | \r |
bad46384 | 20 | #include <Library/BaseMemoryLib.h>\r |
21 | #include <Library/PeiServicesTablePointerLib.h>\r | |
22 | #include <Library/DebugLib.h>\r | |
23 | #include <Library/BaseLib.h>\r | |
24 | \r | |
dd51a993 | 25 | /**\r |
0c3437e0 | 26 | Copies a source buffer to a destination buffer, and returns the destination buffer.\r |
dd51a993 | 27 | \r |
1fef058f | 28 | This function wraps the (*PeiServices)->CopyMem ().\r |
0c3437e0 | 29 | \r |
30 | @param DestinationBuffer Pointer to the destination buffer of the memory copy.\r | |
31 | @param SourceBuffer Pointer to the source buffer of the memory copy.\r | |
32 | @param Length Number of bytes to copy from SourceBuffer to DestinationBuffer.\r | |
dd51a993 | 33 | \r |
0c3437e0 | 34 | @return DestinationBuffer.\r |
dd51a993 | 35 | \r |
36 | **/\r | |
37 | VOID *\r | |
38 | EFIAPI\r | |
39 | InternalMemCopyMem (\r | |
0c3437e0 | 40 | OUT VOID *Destination,\r |
41 | IN CONST VOID *Source,\r | |
dd51a993 | 42 | IN UINTN Length\r |
43 | );\r | |
44 | \r | |
45 | /**\r | |
0c3437e0 | 46 | Fills a target buffer with a byte value, and returns the target buffer.\r |
dd51a993 | 47 | \r |
1fef058f | 48 | This function wraps the (*PeiServices)->SetMem ().\r |
0c3437e0 | 49 | \r |
50 | @param Buffer Memory to set.\r | |
1fef058f | 51 | @param Size Number of bytes to set.\r |
0c3437e0 | 52 | @param Value Value of the set operation.\r |
dd51a993 | 53 | \r |
0c3437e0 | 54 | @return Buffer.\r |
dd51a993 | 55 | \r |
56 | **/\r | |
57 | VOID *\r | |
58 | EFIAPI\r | |
59 | InternalMemSetMem (\r | |
60 | OUT VOID *Buffer,\r | |
0c3437e0 | 61 | IN UINTN Size,\r |
dd51a993 | 62 | IN UINT8 Value\r |
63 | );\r | |
64 | \r | |
65 | /**\r | |
66 | Fills a target buffer with a 16-bit value, and returns the target buffer.\r | |
67 | \r | |
68 | @param Buffer Pointer to the target buffer to fill.\r | |
1fef058f | 69 | @param Length Count of 16-bit value to fill.\r |
dd51a993 | 70 | @param Value Value with which to fill Length bytes of Buffer.\r |
71 | \r | |
72 | @return Buffer\r | |
73 | \r | |
74 | **/\r | |
75 | VOID *\r | |
76 | EFIAPI\r | |
77 | InternalMemSetMem16 (\r | |
78 | OUT VOID *Buffer,\r | |
79 | IN UINTN Length,\r | |
80 | IN UINT16 Value\r | |
81 | );\r | |
82 | \r | |
83 | /**\r | |
84 | Fills a target buffer with a 32-bit value, and returns the target buffer.\r | |
85 | \r | |
86 | @param Buffer Pointer to the target buffer to fill.\r | |
1fef058f | 87 | @param Length Count of 32-bit value to fill.\r |
dd51a993 | 88 | @param Value Value with which to fill Length bytes of Buffer.\r |
89 | \r | |
90 | @return Buffer\r | |
91 | \r | |
92 | **/\r | |
93 | VOID *\r | |
94 | EFIAPI\r | |
95 | InternalMemSetMem32 (\r | |
96 | OUT VOID *Buffer,\r | |
97 | IN UINTN Length,\r | |
98 | IN UINT32 Value\r | |
99 | );\r | |
100 | \r | |
101 | /**\r | |
102 | Fills a target buffer with a 64-bit value, and returns the target buffer.\r | |
103 | \r | |
104 | @param Buffer Pointer to the target buffer to fill.\r | |
1fef058f | 105 | @param Length Count of 64-bit value to fill.\r |
dd51a993 | 106 | @param Value Value with which to fill Length bytes of Buffer.\r |
107 | \r | |
108 | @return Buffer\r | |
109 | \r | |
110 | **/\r | |
111 | VOID *\r | |
112 | EFIAPI\r | |
113 | InternalMemSetMem64 (\r | |
114 | OUT VOID *Buffer,\r | |
115 | IN UINTN Length,\r | |
116 | IN UINT64 Value\r | |
117 | );\r | |
118 | \r | |
119 | /**\r | |
120 | Set Buffer to 0 for Size bytes.\r | |
121 | \r | |
122 | @param Buffer Memory to set.\r | |
42eedea9 | 123 | @param Length Number of bytes to set\r |
dd51a993 | 124 | \r |
125 | @return Buffer\r | |
126 | \r | |
127 | **/\r | |
128 | VOID *\r | |
129 | EFIAPI\r | |
130 | InternalMemZeroMem (\r | |
131 | OUT VOID *Buffer,\r | |
132 | IN UINTN Length\r | |
133 | );\r | |
134 | \r | |
135 | /**\r | |
136 | Compares two memory buffers of a given length.\r | |
137 | \r | |
138 | @param DestinationBuffer First memory buffer\r | |
139 | @param SourceBuffer Second memory buffer\r | |
140 | @param Length Length of DestinationBuffer and SourceBuffer memory\r | |
141 | regions to compare. Must be non-zero.\r | |
142 | \r | |
d531bfee | 143 | @return 0 All Length bytes of the two buffers are identical.\r |
144 | @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first\r | |
145 | mismatched byte in DestinationBuffer.\r | |
dd51a993 | 146 | \r |
147 | **/\r | |
148 | INTN\r | |
149 | EFIAPI\r | |
150 | InternalMemCompareMem (\r | |
151 | IN CONST VOID *DestinationBuffer,\r | |
152 | IN CONST VOID *SourceBuffer,\r | |
153 | IN UINTN Length\r | |
154 | );\r | |
155 | \r | |
156 | /**\r | |
157 | Scans a target buffer for an 8-bit value, and returns a pointer to the\r | |
158 | matching 8-bit value in the target buffer.\r | |
159 | \r | |
160 | @param Buffer Pointer to the target buffer to scan.\r | |
1fef058f | 161 | @param Length Count of 8-bit value to scan. Must be non-zero.\r |
dd51a993 | 162 | @param Value Value to search for in the target buffer.\r |
163 | \r | |
164 | @return Pointer to the first occurrence or NULL if not found.\r | |
165 | \r | |
166 | **/\r | |
167 | CONST VOID *\r | |
168 | EFIAPI\r | |
169 | InternalMemScanMem8 (\r | |
170 | IN CONST VOID *Buffer,\r | |
171 | IN UINTN Length,\r | |
172 | IN UINT8 Value\r | |
173 | );\r | |
174 | \r | |
175 | /**\r | |
176 | Scans a target buffer for a 16-bit value, and returns a pointer to the\r | |
177 | matching 16-bit value in the target buffer.\r | |
178 | \r | |
179 | @param Buffer Pointer to the target buffer to scan.\r | |
1fef058f | 180 | @param Length Count of 16-bit value to scan. Must be non-zero.\r |
dd51a993 | 181 | @param Value Value to search for in the target buffer.\r |
182 | \r | |
183 | @return Pointer to the first occurrence or NULL if not found.\r | |
184 | \r | |
185 | **/\r | |
186 | CONST VOID *\r | |
187 | EFIAPI\r | |
188 | InternalMemScanMem16 (\r | |
189 | IN CONST VOID *Buffer,\r | |
190 | IN UINTN Length,\r | |
191 | IN UINT16 Value\r | |
192 | );\r | |
193 | \r | |
194 | /**\r | |
195 | Scans a target buffer for a 32-bit value, and returns a pointer to the\r | |
196 | matching 32-bit value in the target buffer.\r | |
197 | \r | |
198 | @param Buffer Pointer to the target buffer to scan.\r | |
1fef058f | 199 | @param Length Count of 32-bit value to scan. Must be non-zero.\r |
dd51a993 | 200 | @param Value Value to search for in the target buffer.\r |
201 | \r | |
202 | @return Pointer to the first occurrence or NULL if not found.\r | |
203 | \r | |
204 | **/\r | |
205 | CONST VOID *\r | |
206 | EFIAPI\r | |
207 | InternalMemScanMem32 (\r | |
208 | IN CONST VOID *Buffer,\r | |
209 | IN UINTN Length,\r | |
210 | IN UINT32 Value\r | |
211 | );\r | |
212 | \r | |
213 | /**\r | |
214 | Scans a target buffer for a 64-bit value, and returns a pointer to the\r | |
215 | matching 64-bit value in the target buffer.\r | |
216 | \r | |
217 | @param Buffer Pointer to the target buffer to scan.\r | |
1fef058f | 218 | @param Length Count of 64-bit value to scan. Must be non-zero.\r |
dd51a993 | 219 | @param Value Value to search for in the target buffer.\r |
220 | \r | |
221 | @return Pointer to the first occurrence or NULL if not found.\r | |
222 | \r | |
223 | **/\r | |
224 | CONST VOID *\r | |
225 | EFIAPI\r | |
226 | InternalMemScanMem64 (\r | |
227 | IN CONST VOID *Buffer,\r | |
228 | IN UINTN Length,\r | |
229 | IN UINT64 Value\r | |
230 | );\r | |
231 | \r | |
232 | #endif\r |