Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
2c7e5c2f HT |
3 | Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>\r |
4 | This program and the accompanying materials \r | |
3eb9473e | 5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | \r | |
13 | Module Name:\r | |
14 | \r | |
15 | ScanMem32Wrapper.c\r | |
16 | \r | |
17 | Abstract: \r | |
18 | \r | |
19 | ScanMem32() implementation.\r | |
20 | \r | |
21 | --*/\r | |
22 | \r | |
23 | #include "BaseMemoryLibInternal.h"\r | |
24 | \r | |
25 | /**\r | |
26 | Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value\r | |
27 | in the target buffer.\r | |
28 | \r | |
29 | This function searches target the buffer specified by Buffer and Length from the lowest\r | |
30 | address to the highest address for a 32-bit value that matches Value. If a match is found,\r | |
31 | then a pointer to the matching byte in the target buffer is returned. If no match is found,\r | |
32 | then NULL is returned. If Length is 0, then NULL is returned.\r | |
33 | If Length > 0 and Buffer is NULL, then ASSERT().\r | |
34 | If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r | |
35 | If Length is not aligned on a 32-bit boundary, then ASSERT().\r | |
36 | If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r | |
37 | \r | |
38 | @param Buffer Pointer to the target buffer to scan.\r | |
39 | @param Length Number of bytes in Buffer to scan.\r | |
40 | @param Value Value to search for in the target buffer.\r | |
41 | \r | |
42 | @return A pointer to the matching byte in the target buffer or NULL otherwise.\r | |
43 | \r | |
44 | **/\r | |
45 | VOID *\r | |
46 | EFIAPI\r | |
47 | ScanMem32 (\r | |
48 | IN CONST VOID *Buffer,\r | |
49 | IN UINTN Length,\r | |
50 | IN UINT32 Value\r | |
51 | )\r | |
52 | {\r | |
53 | if (Length == 0) {\r | |
54 | return NULL;\r | |
55 | }\r | |
56 | \r | |
57 | ASSERT (Buffer != NULL);\r | |
58 | ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r | |
59 | ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));\r | |
60 | ASSERT ((Length & (sizeof (Value) - 1)) == 0);\r | |
61 | \r | |
62 | return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);\r | |
63 | }\r |