Fix track EDKT106 & EDKT112: map LibPcdSetPtr function for PatchPcdSetPtr macro funct...
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 24 Aug 2006 17:04:56 +0000 (17:04 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 24 Aug 2006 17:04:56 +0000 (17:04 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1381 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Library/PcdLib.h
Tools/Source/PcdTools/org/tianocore/pcd/entity/UsageInstance.java

index a020104..038443b 100644 (file)
@@ -58,7 +58,12 @@ Module Name: PcdLib.h
 #define PatchPcdSet64(TokenName, Value)     (_gPcd_BinaryPatch_##TokenName = (Value))\r
 #define PatchPcdSetBool(TokenName, Value)   (_gPcd_BinaryPatch_##TokenName = (Value))\r
 #define PatchPcdSetPtr(TokenName, Size, Buffer) \\r
-                                            CopyMem (_gPcd_BinaryPatch_##TokenName, (Buffer), (Size))\r
+                                            LibPatchPcdSetPtr (                        \\r
+                                              _gPcd_BinaryPatch_##TokenName,           \\r
+                                              (UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \\r
+                                              (Size),                                  \\r
+                                              (Buffer)                                 \\r
+                                              )\r
 \r
 //\r
 // Dynamic is via the protocol with only the TokenNumber as argument\r
index e38bc91..03499e6 100644 (file)
@@ -368,9 +368,15 @@ public class UsageInstance {
                 // Example autogen string for following generation:\r
                 // "#define _PCD_SET_MODE_8_PcdSampleToken(SizeOfBuffer, Buffer) CopyMem (_gPcd_BinaryPatch_PcdSampleToken, (Buffer), (SizeOfBuffer))"\r
                 // \r
-                hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) CopyMem (_gPcd_BinaryPatch_%s, (Buffer), (SizeOfBuffer))\r\n",\r
+                hAutogenStr += String.format("#define _PCD_PATCHABLE_%s_SIZE %d\r\n",\r
+                                             parentToken.cName,\r
+                                             parentToken.datumSize);\r
+                hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) "+\r
+                                             "LibPatchPcdSetPtr (_gPcd_BinaryPatch_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, "+\r
+                                             "(SizeOfBuffer), (Buffer))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
+                                             parentToken.cName,\r
                                              parentToken.cName);\r
             } else {\r
                 //\r
@@ -396,8 +402,9 @@ public class UsageInstance {
                     // Example autogen string for following generation:\r
                     // "GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_PcdSampleToken[] = _PCD_VALUE_PcdSampleToken;"\r
                     // \r
-                    cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[] = _PCD_VALUE_%s;\r\n",\r
+                    cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[%d] = _PCD_VALUE_%s;\r\n",\r
                                                  parentToken.cName,\r
+                                                 parentToken.datumSize,\r
                                                  parentToken.cName);\r
                 } else {\r
                     //\r