From nobody Mon Apr 29 06:33:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1520585170271480.1775151600135; Fri, 9 Mar 2018 00:46:10 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 779292253FB68; Fri, 9 Mar 2018 00:39:51 -0800 (PST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 29C332253FB61 for ; Fri, 9 Mar 2018 00:39:49 -0800 (PST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2018 00:46:05 -0800 Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga004.jf.intel.com with ESMTP; 09 Mar 2018 00:46:05 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 9 Mar 2018 00:46:04 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 9 Mar 2018 00:46:03 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.80]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.166]) with mapi id 14.03.0319.002; Fri, 9 Mar 2018 16:46:01 +0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=yunhuax.feng@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,444,1515484800"; d="dat'59?scan'59,208,59";a="181255467" From: "Feng, YunhuaX" To: "edk2-devel@lists.01.org" Thread-Topic: [PATCH] BaseTools: Fix parse OFFSET_OF get wrong offset Thread-Index: AdO3gwxVfWeJN58tSxqDXeFi1CuVRQ== Date: Fri, 9 Mar 2018 08:46:00 +0000 Message-ID: <47C64442C08CCD4089DC43B6B5E46BC4834B1F@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: <47C64442C08CCD4089DC43B6B5E46BC4834B1F@shsmsx102.ccr.corp.intel.com> x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: [edk2] [PATCH] BaseTools: Fix parse OFFSET_OF get wrong offset X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Gao, Liming" Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Fix parse OFFSET_OF get wrong offset Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Common/Expression.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index 5a0ade9e7e..47fa190eb8 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -888,12 +888,13 @@ class ValueExpressionEx(ValueExpression): ReLabel =3D re.compile('LABEL\((\w+)\)') ReOffset =3D re.compile('OFFSET_OF\((\w+)\)') LabelOffset =3D 0 for Index, Item in enumerate(PcdValueList): # compute byte offset of every LABEL - Item =3D Item.strip() LabelList =3D ReLabel.findall(Item) + Item =3D ReLabel.sub('', Item) + Item =3D Item.strip() if LabelList: for Label in LabelList: if not IsValidCString(Label): raise BadExpression('%s is not a v= alid c variable name' % Label) if Label not in LabelDict.keys(): @@ -1001,12 +1002,14 @@ class ValueExpressionEx(ValueExpression): =20 if RealValue: return PcdValue =20 if __name__ =3D=3D '__main__': - pass - while True: + Value =3D "{UINT32(OFFSET_OF(Cert0)),UINT32(OFFSET_OF(Cert1)), UINT32(= OFFSET_OF(Cert2)), UINT32(OFFSET_OF(Cert3)), UINT32(OFFSET_OF(Cert4)), UINT= 32(OFFSET_OF(Cert5)), UINT32(OFFSET_OF(Cert6)), UINT32(OFFSET_OF(Cert7)), U= INT32(OFFSET_OF(Cert8)), LABEL(Cert0) UINT8(1),LABEL(Cert1) UINT16(2), LABE= L(Cert2) UINT32(4), LABEL(Cert3) UINT64(8), LABEL(Cert4) 'ABC', LABEL(Cert5= ) \"ABC\", LABEL(Cert6) L'ABC', LABEL(Cert7) L\"ABC\", LABEL(Cert8) 0}" + Ret =3D ValueExpressionEx(Value, "VOID*")(True) + print Ret + while False: input =3D raw_input('Input expr: ') if input in 'qQ': break try: print ValueExpression(input)(True) --=20 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel