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 89B62D8108C for ; Fri, 9 Aug 2024 06:30:31 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=QDXVwDZYXjf949Yv8UKk7VepNqwXTjvRILLctt/vkdQ=; 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=1723185031; v=1; b=v62ihQPA4TbLjFNSXwLsrXP1EteBX1JKA7sCmLwOTXiPW6ZZHfdbrmzUNbfelmBhS2LJlkbe YDDFzAeOx4EEv1xCW95nAjrzjQL+qz0DquqJh1YykIoIWt9B4rMCxdInB5by4d6/OdPOsT+5u1T Ey65GGEqorf9/2FfDtSs12zJ5KQY/1aao28Ft9tPQv6zHuMTkLYJzSWXuF6AirDSsmw7clH+X88 XUdEManWJs3YdhnONgsUVytm1eRhJBTFAfBuvBcfbr156fPCL9X4QP8U9RbzdlWphS+z97lcGP2 e/waIPrS2vaKUtMQQywwkiYK7TKoL/N3Y0SnGhq9I1MCA== X-Received: by 127.0.0.2 with SMTP id 6WxHYY7687511xTStLufxfCH; Thu, 08 Aug 2024 23:30:29 -0700 X-Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) by mx.groups.io with SMTP id smtpd.web10.78511.1723185028205453966 for ; Thu, 08 Aug 2024 23:30:29 -0700 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033032019045;MF=huangming@linux.alibaba.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---0WCOvgAK_1723184981; X-Received: from 842effaa37a8.tbsite.net(mailfrom:huangming@linux.alibaba.com fp:SMTPD_---0WCOvgAK_1723184981) by smtp.aliyun-inc.com; Fri, 09 Aug 2024 14:30:25 +0800 From: "Ming Huang" To: devel@edk2.groups.io Cc: ming.huang-@outlook.com, Ming Huang Subject: [edk2-devel] [PATCH v1 v1 1/1] MdePkg: Add error output for IoLib.c Date: Fri, 9 Aug 2024 14:29:39 +0800 Message-Id: <20240809062939.96374-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: Thu, 08 Aug 2024 23:30:29 -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: rsMB4bachRBz20DJZPdJozHTx7686176AA= X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=v62ihQPA; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linux.alibaba.com (policy=none) 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 (#120306): https://edk2.groups.io/g/devel/message/120306 Mute This Topic: https://groups.io/mt/107803950/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-