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 2F1D79412C8 for ; Fri, 19 Apr 2024 09:03:32 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=4ecIaPhLTS7S0sGDoR8e62P4heGRa1viKwMNdHZ9bYY=; 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=1713517410; v=1; b=M3iMXSu6A7CNZjI+XnnOOGae7fogivdqefb/MGx9nZtptxh0VkL+ucmV53iJ6PygxrfZjqPv jUePJ+nDwfdD1JGG4R/MYcPVP6R2LZxBUJitVB298i+ciREfoVvNNVm3s3fAQwc2Zaiwatq2wuk R0kM4k1I1E9YGKAmUVf1iP5vkJYMuNDJ/XZIpUjk4vENEAkPJyWGXTglrVsacVin8pb7Dr8pDN8 pRK32mLh/b2+TzbIknbAd6sPOfZBtio5FJ+JvwY69JCFuzse4T3ZsgVksamnAanp7JKMt7p/fnY 4dhz9yNYqqVOS8gHdSaLZ/iYTLA/k+7CimGlCvKm/Ti/Q== X-Received: by 127.0.0.2 with SMTP id K8jzYY7687511x2TShx4fKq1; Fri, 19 Apr 2024 02:03:30 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by mx.groups.io with SMTP id smtpd.web11.15923.1713517407951349511 for ; Fri, 19 Apr 2024 02:03:30 -0700 X-CSE-ConnectionGUID: 14CBTvWZQFedBECymEM3YQ== X-CSE-MsgGUID: 6IlE2abFSaW1QocGqhpcxw== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="8945516" X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="8945516" X-Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2024 02:03:30 -0700 X-CSE-ConnectionGUID: /cMv0w2sR3qgt8Q2hFznZg== X-CSE-MsgGUID: 5u7GK7TXRgmbOyO5va++Cw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="23779588" X-Received: from njayapra-mobl.gar.corp.intel.com ([10.247.135.165]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2024 02:03:28 -0700 From: "Jayaprakash, N" To: devel@edk2.groups.io Cc: Jayaprakash N , Rebecca Cran , Michael D Kinney Subject: [edk2-devel] [edk2-libc Patch v3 1/1] ek2-libc: wrmsr function available in edk2module is not working as expected Date: Fri, 19 Apr 2024 14:31:02 +0530 Message-ID: <20240419090319.660-2-n.jayaprakash@intel.com> In-Reply-To: <20240419090319.660-1-n.jayaprakash@intel.com> References: <20240419090319.660-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: Fri, 19 Apr 2024 02:03:30 -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: OOG1tFn6CgYCVOlVEUeIOAsax7686176AA= 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=M3iMXSu6; 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 | 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..f688b51 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 = LShiftU64(vedx, 32) | 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 (#118012): https://edk2.groups.io/g/devel/message/118012 Mute This Topic: https://groups.io/mt/105614477/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-