From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 93DB274005B for ; Thu, 18 Apr 2024 13:03:29 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Uqo0WuyFZ2k6MZBCUUhq3OuAemsGFPcRrFxZu5rU5+4=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1713445407; v=1; b=rUMl3e5GsEAe486EeBfMHyYf4VZKB7u09zERd5Im1a1GqC5DoO4l2oJ/3nbr5gtK2Lma+qYV t5n7PJ4sHwbWJvIAud5HRN1N4Z15cy/a3LlxdR8Mcm1c37RGus1BiwWHw0H17WwdGl9B29feWYP vvodaIsxlRsIdy81W9Keh5ML2kRlQmJG13wVP68RewehhA4fsE3cNLXrSSx7K44ZZdwJWZo7ZGo /FP9UVTBSwPzfW+zS9PJh6+RUqJN5Klu6EpudN/YHM1plyb3xqjLWKlQuGtruSnn/AhlTMHqHre zv226mHMVDCEehgiYkYYF9Odbt5Z9nbFcjnw+wUvFcRfQ== X-Received: by 127.0.0.2 with SMTP id cSfUYY7687511xmh1xuCKnXM; Thu, 18 Apr 2024 06:03:27 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by mx.groups.io with SMTP id smtpd.web10.12232.1713445405606502120 for ; Thu, 18 Apr 2024 06:03:26 -0700 X-CSE-ConnectionGUID: qbTjtrzoQgywk9Phd4ThrQ== X-CSE-MsgGUID: 8fkZ8YxXSHKLSIgBJQrcfQ== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="9148677" X-IronPort-AV: E=Sophos;i="6.07,212,1708416000"; d="scan'208";a="9148677" X-Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 06:03:27 -0700 X-CSE-ConnectionGUID: vLLYOshLTmyPDRcABMdUww== X-CSE-MsgGUID: xcGsJ5VeSGmMmah4ZZRVMA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,212,1708416000"; d="scan'208";a="27606702" X-Received: from njayapra-mobl.gar.corp.intel.com ([10.247.135.165]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 06:03:25 -0700 From: "Jayaprakash, N" To: devel@edk2.groups.io Cc: Jayaprakash N , Rebecca Cran , Michael D Kinney Subject: [edk2-devel] [edk2-libc Patch 2 1/1] ek2-libc: wrmsr function available in edk2module is not working as expected Date: Thu, 18 Apr 2024 18:24:38 +0530 Message-ID: <20240418130317.1149-2-n.jayaprakash@intel.com> In-Reply-To: <20240418130317.1149-1-n.jayaprakash@intel.com> References: <20240418130317.1149-1-n.jayaprakash@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Thu, 18 Apr 2024 06:03:27 -0700 Resent-From: n.jayaprakash@intel.com Reply-To: devel@edk2.groups.io,n.jayaprakash@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: E7M5Ehh07kjCkPYRrJsdwe4px7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=rUMl3e5G; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4745 This commit fixes the issue reported in the BZ4745. The wrmsr was always writing 0 to the higher 32 bits of the msr register. This was due to a logical flaw in the code, where the input variable of type unsigned int was left shitted by 32 bits without explicitly converting it to a 64 bit value. The issue is with the below statement. data = vedx << 32 | veax; Where the vedx which is an unsigned int, after left shifting by 32 bits its value will be set to 0. Because of this the higher 32 bits of the MSR are always set to 0. This has been fixed by this commit. Cc: Rebecca Cran Cc: Michael D Kinney Cc: Jayaprakash N Signed-off-by: Jayaprakash N --- .../Python/Python-3.6.8/PyMod-3.6.8/Modules/edk2module.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/edk2module.c b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/edk2module.c index 8786df8..06bcf82 100644 --- a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/edk2module.c +++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/edk2module.c @@ -3886,7 +3886,8 @@ edk2_wrmsr(PyObject *self, PyObject *args) UINT64 data = 0; if (!PyArg_ParseTuple(args, "III", &vecx, &veax, &vedx)) return NULL; - data = vedx << 32 | veax; + data = LShiftU64(vedx, 32); + data = BitFieldOr64(data, 0, 31, veax); Py_BEGIN_ALLOW_THREADS AsmWriteMsr64(vecx, data); Py_END_ALLOW_THREADS -- 2.44.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117988): https://edk2.groups.io/g/devel/message/117988 Mute This Topic: https://groups.io/mt/105597214/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-