]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c
MdeModulePkg/RegularExpressionDxe: Make oniguruma a submodule in edk2.
[mirror_edk2.git] / MdeModulePkg / Universal / RegularExpressionDxe / OnigurumaIntrinsics.c
CommitLineData
14b0e578
CS
1/** @file\r
2\r
3 Provide intrinsics within Oniguruma\r
4\r
0af8e57c 5 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
48b6c60c 6 Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r
14b0e578 7\r
9d510e61 8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
14b0e578
CS
9**/\r
10\r
11#include <Library/BaseMemoryLib.h>\r
12\r
13//\r
14// From CryptoPkg/IntrinsicLib\r
15//\r
16\r
17/* Copies bytes between buffers */\r
18#pragma function(memcpy)\r
19void * memcpy (void *dest, const void *src, unsigned int count)\r
20{\r
21 return CopyMem (dest, src, (UINTN)count);\r
22}\r
23\r
24/* Sets buffers to a specified character */\r
25#pragma function(memset)\r
26void * memset (void *dest, char ch, unsigned int count)\r
27{\r
28 //\r
29 // NOTE: Here we use one base implementation for memset, instead of the direct\r
30 // optimized SetMem() wrapper. Because the IntrinsicLib has to be built\r
31 // without whole program optimization option, and there will be some\r
32 // potential register usage errors when calling other optimized codes.\r
33 //\r
34\r
35 //\r
36 // Declare the local variables that actually move the data elements as\r
37 // volatile to prevent the optimizer from replacing this function with\r
38 // the intrinsic memset()\r
39 //\r
40 volatile UINT8 *Pointer;\r
41\r
42 Pointer = (UINT8 *)dest;\r
43 while (count-- != 0) {\r
44 *(Pointer++) = ch;\r
45 }\r
46\r
47 return dest;\r
48}\r