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