From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 7AB93941518 for ; Thu, 4 Apr 2024 09:44:47 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=19wGiL1w1+u7d3aKvtyyZPr3RfV5i2j4noTtJW3Vx54=; 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=1712223886; v=1; b=Rq7rbjFcYKCqrt5bUSbHHS+ExqlT3iUnRdUcP1EePxg6JSLKkgLxuN6Z9LcrZ/9JGa9skYU/ NgtCJk9XHmvfHqWNWxtXqu0K3mEzb0TRWbTl6W3QzEraoV/RfVjBuCI4xHNmoFSt3lqO1VZ5VoQ DFLTmmhJvfknnLipoWH6HnYV38BKcN7uO0E5Uf365szKLKAXJGiSp6oKbHeVB5nzOWNbHTTfk6x xRnWWIziLqZk4l8KNprjxV6J3C4mnzuqEUbFgYmyZNS6ngHgBP5wQ0zZa0M2N7RK5lBmBxC2fO4 nP35ggGjkOJrcfK4clqYmKVX+iiux1hearvdYy39ymUTw== X-Received: by 127.0.0.2 with SMTP id Sr7hYY7687511x9rT6FNqbYN; Thu, 04 Apr 2024 02:44:46 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by mx.groups.io with SMTP id smtpd.web10.34173.1712223885117654672 for ; Thu, 04 Apr 2024 02:44:45 -0700 X-CSE-ConnectionGUID: UaAEQPPhQ3mQzwnfoygSpg== X-CSE-MsgGUID: u2H8e422T5qxcGvWieo1WA== X-IronPort-AV: E=McAfee;i="6600,9927,11033"; a="8072911" X-IronPort-AV: E=Sophos;i="6.07,179,1708416000"; d="scan'208";a="8072911" X-Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2024 02:44:44 -0700 X-CSE-ConnectionGUID: uTosfKgbQrSxHFyrpXNl7A== X-CSE-MsgGUID: 5Vnz/vCgSLeWWEMcz66uKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,179,1708416000"; d="scan'208";a="49682139" X-Received: from njayapra-mobl.gar.corp.intel.com ([10.66.97.164]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2024 02:44:43 -0700 From: "Jayaprakash, N" To: devel@edk2.groups.io Cc: Jayaprakash N , Rebecca Cran , Michael D Kinney Subject: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc: wrmsr function available in edk2module is not working as expected Date: Thu, 4 Apr 2024 15:14:26 +0530 Message-Id: <20240404094426.1636-2-n.jayaprakash@intel.com> In-Reply-To: <20240404094426.1636-1-n.jayaprakash@intel.com> References: <20240404094426.1636-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, 04 Apr 2024 02:44:45 -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: XtedUelnRmW5Ksns40AKkgHUx7686176AA= 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=Rq7rbjFc; 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 66.175.222.108 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 function 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 to a 64 bit value. Problematic statement in the function edk2_wrmsr code: data = vedx << 32 | veax; Where the vedx 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 statement has been modified as below: data = (((UINT64)vedx) << 32) | veax; Verified the function by making this change and could see that the wrmsr is working as expected. 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 | 2 +- 1 file changed, 1 insertion(+), 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 d6af8da..cec4332 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,7 @@ edk2_wrmsr(PyObject *self, PyObject *args) UINT64 data = 0; if (!PyArg_ParseTuple(args, "III", &vecx, &veax, &vedx)) return NULL; - data = vedx << 32 | veax; + data = (((UINT64)vedx) << 32) | veax; Py_BEGIN_ALLOW_THREADS AsmWriteMsr64(vecx, data); Py_END_ALLOW_THREADS -- 2.40.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117421): https://edk2.groups.io/g/devel/message/117421 Mute This Topic: https://groups.io/mt/105325843/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-