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 B3B5574003E for ; Tue, 13 Aug 2024 09:42:35 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=kuKZCLf/aW/foc8b9RyXXtk2koKnq5+vxqc/EQCWF3E=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe; s=20240206; t=1723542155; v=1; b=anovt+9bEnKsik72sD9UCFeNoWb0UdevsOrSrs1sMV/7rI8/ftHBECOK5JdX8R8cDBb9Dgn7 qFeIdm+vbEEt+w1MT+mkmB65lhzXgwPzhvPTstRyRYf2ohLJ8CgnZNrvnwenyoktcocSztcxvDb MLIJPvkhNlYsjBLPi+rFqGcVsdn7cv1AXzKMn76gOz6m6sddsQDV+NvbH8eLVHgKPtkGevmFWwY SYDR15RH2rOMQicGP7lwlg+FmOBzKMVZnYYbGZqlZVNzMLcH5Zt1BhwYHzsQp3lJzMAgaYx9Csw 1+2gnY3ge8uTTaV1RV8zO3/ri40ATFw3yLxJ1cemqCj4A== X-Received: by 127.0.0.2 with SMTP id nuJyYY7687511xaDi6QSvWUX; Tue, 13 Aug 2024 02:42:34 -0700 X-Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) by mx.groups.io with SMTP id smtpd.web11.68082.1723542152372279838 for ; Tue, 13 Aug 2024 02:42:32 -0700 X-Received: from 842effaa37a8.tbsite.net(mailfrom:huangming@linux.alibaba.com fp:SMTPD_---0WCojx-C_1723542133) by smtp.aliyun-inc.com; Tue, 13 Aug 2024 17:42:29 +0800 From: "Ming Huang" To: devel@edk2.groups.io, gaoliming@byosoft.com.cn, michael.d.kinney@intel.com, zhiguang.liu@intel.com Cc: ming.huang-@outlook.com, Ming Huang Subject: [edk2-devel] [PATCH v1 v1 1/1] MdePkg: Add error output for IoLib.c Date: Tue, 13 Aug 2024 17:42:07 +0800 Message-Id: <20240813094207.104010-1-huangming@linux.alibaba.com> 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: Tue, 13 Aug 2024 02:42:32 -0700 Resent-From: huangming@linux.alibaba.com Reply-To: devel@edk2.groups.io,huangming@linux.alibaba.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: inTMaX6CLLBU3LoSoNmgtFNzx7686176AA= X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=anovt+9b; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linux.alibaba.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 It is better to output error address information When Address is invalid before ASSERT. Signed-off-by: Ming Huang --- MdePkg/Library/BaseIoLibIntrinsic/IoLib.c | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c index 5bd02b56a1..57d05af5a9 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c @@ -174,6 +174,10 @@ MmioRead16 ( UINT16 Value; BOOLEAN Flag; + if ((Address & 1) != 0) { + DEBUG ((DEBUG_ERROR, "MmioRead16 invalid address: %lx\n", Address)); + } + ASSERT ((Address & 1) == 0); Flag = FilterBeforeMmIoRead (FilterWidth16, Address, &Value); if (Flag) { @@ -220,6 +224,10 @@ MmioWrite16 ( { BOOLEAN Flag; + if ((Address & 1) != 0) { + DEBUG ((DEBUG_ERROR, "MmioWrite16 invalid address: %lx\n", Address)); + } + ASSERT ((Address & 1) == 0); Flag = FilterBeforeMmIoWrite (FilterWidth16, Address, &Value); @@ -266,6 +274,10 @@ MmioRead32 ( UINT32 Value; BOOLEAN Flag; + if ((Address & 3) != 0) { + DEBUG ((DEBUG_ERROR, "MmioRead32 invalid address: %lx\n", Address)); + } + ASSERT ((Address & 3) == 0); Flag = FilterBeforeMmIoRead (FilterWidth32, Address, &Value); @@ -313,6 +325,10 @@ MmioWrite32 ( { BOOLEAN Flag; + if ((Address & 3) != 0) { + DEBUG ((DEBUG_ERROR, "MmioWrite32 invalid address: %lx\n", Address)); + } + ASSERT ((Address & 3) == 0); Flag = FilterBeforeMmIoWrite (FilterWidth32, Address, &Value); @@ -359,6 +375,10 @@ MmioRead64 ( UINT64 Value; BOOLEAN Flag; + if ((Address & 7) != 0) { + DEBUG ((DEBUG_ERROR, "MmioRead64 invalid address: %lx\n", Address)); + } + ASSERT ((Address & 7) == 0); Flag = FilterBeforeMmIoRead (FilterWidth64, Address, &Value); @@ -404,6 +424,10 @@ MmioWrite64 ( { BOOLEAN Flag; + if ((Address & 7) != 0) { + DEBUG ((DEBUG_ERROR, "MmioWrite64 invalid address: %lx\n", Address)); + } + ASSERT ((Address & 7) == 0); Flag = FilterBeforeMmIoWrite (FilterWidth64, Address, &Value); -- 2.17.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#120325): https://edk2.groups.io/g/devel/message/120325 Mute This Topic: https://groups.io/mt/107873366/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-