From nobody Fri May 17 08:39:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+91111+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91111+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1657113062; cv=none; d=zohomail.com; s=zohoarc; b=nenrjOaG/ZL9VeYeL9J0aSIExJGvOWKHCOSFRNn12Ayb7ATBvdkan8XgdvFf1S5xEKXrRfXRlkh9LDNmjPl12XQ37cW+U+6mzF8ptSWU7nzocRjbCXEMon48vcKH+lOQ0/qcsaOJ1/SX9ZDSfYZD3tsrpkpzZ9NnbNEDnUfdmYQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657113062; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=+n45TLqcbo0sVaqxX+84hyaepCLEMGSuLAhoJbKXnMY=; b=BKR3YnIpfdZiBbZRlPkIhzUn0QMwpmbVfKgEFvB4DKqQh6Wped+q9NmHFEo7k4xbW1IEEqHuFoPRWwafvGzLZ6mU0wjzABomZyvxkusoGNahmcVX8/wYJOGeSOY/Zs85d3WMW7ukxGtMlvQQ4TG0FkyKBdDx/VZJ+BwOkcfnoBk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91111+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16571130620841002.7275055000998; Wed, 6 Jul 2022 06:11:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id BkYWYY1788612xL8kQEQFvSM; Wed, 06 Jul 2022 06:11:01 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.5918.1657113060822724344 for ; Wed, 06 Jul 2022 06:11:01 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10399"; a="283765555" X-IronPort-AV: E=Sophos;i="5.92,250,1650956400"; d="scan'208";a="283765555" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2022 06:10:32 -0700 X-IronPort-AV: E=Sophos;i="5.92,250,1650956400"; d="scan'208";a="650659339" X-Received: from liuzhigu-mobl.ccr.corp.intel.com ([10.249.175.104]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2022 06:10:30 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Zhiguang Liu , Eric Dong , Ray Ni , Rahul Kumar , Debkumar De , Harry Han , Catharine West Subject: [edk2-devel] [PATCH v2] UefiCpuPkg: Fix nasm warning "signed byte value exceeds" Date: Wed, 6 Jul 2022 21:10:13 +0800 Message-Id: <20220706131013.19796-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: 8g2r7BkGYDP8ERPiz5PYbMFxx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1657113061; bh=EzQNveJZPsm5tI9sb9g26LVSVA+H2Ub/C9U+SaPAHd8=; h=Cc:Date:From:Reply-To:Subject:To; b=knN4SdSbMunA+SZAae6ZFmrGwTAV3kO2j2hFJ91LGMbYCwI7H88r3X9lM/SGPuD4pNr s7HKMovBRXBWx7aTU41iJ6Ez/z2mVkh2/HcpcqvXqC3RW9QSpv5VranzVu5NmptG5IWPd eslC8ceXT6HU80KWpLr5A7oEtgS+u5nXub8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1657113063790100001 Content-Type: text/plain; charset="utf-8" Currently, "push byte %[Vector]" causes nasm warning when Vector is larger than 0x7F. This is because push accepts a signed value, and byte means signed int8. Maximum signed int8 is 0x7F. When Vector is larger the 0x7F, for example, when Vector is 255, byte 255 turns to -1, and causes the warning "signed byte value exceeds". To avoid such warning, use dword instead of byte, this will increase 3 bytes for each IdtVector. For IA32, the size of IdtVector will increase from 10 bytes to 13 bytes. For X64, the size of IdtVector will increase from 15 bytes to 18 bytes. Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Debkumar De Cc: Harry Han Cc: Catharine West Signed-off-by: Zhiguang Liu Reviewed-by: Ray Ni --- .../Library/CpuExceptionHandlerLib/CpuExceptionCommon.h | 2 +- .../CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.nasm | 7 +++---- .../CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerAsm.nasm | 11 +++++--= ---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h= b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h index 0f012bccde..fd42c4be0f 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h @@ -22,7 +22,7 @@ =20 #define CPU_EXCEPTION_NUM 32 #define CPU_INTERRUPT_NUM 256 -#define HOOKAFTER_STUB_SIZE 16 +#define HOOKAFTER_STUB_SIZE 18 =20 // // Exception Error Code of Page-Fault Exception diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandle= rAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandler= Asm.nasm index 8ed2b8f455..31a00449a2 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.na= sm +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.na= sm @@ -34,7 +34,7 @@ ALIGN 8 AsmIdtVectorBegin: %assign Vector 0 %rep 256 - push byte %[Vector]; + push strict dword %[Vector]; push eax mov eax, ASM_PFX(CommonInterruptEntry) jmp eax @@ -43,9 +43,8 @@ AsmIdtVectorBegin: AsmIdtVectorEnd: =20 HookAfterStubBegin: - db 0x6a ; push + push strict dword 0 ; 0 will be fixed VectorNum: - db 0 ; 0 will be fixed push eax mov eax, HookAfterStubHeaderEnd jmp eax @@ -453,5 +452,5 @@ global ASM_PFX(AsmVectorNumFixup) ASM_PFX(AsmVectorNumFixup): mov eax, dword [esp + 8] mov ecx, [esp + 4] - mov [ecx + (VectorNum - HookAfterStubBegin)], al + mov [ecx + (VectorNum - 4 - HookAfterStubBegin)], al ret diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionH= andlerAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5Except= ionHandlerAsm.nasm index 7c0e3d3b0b..9574785742 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerA= sm.nasm +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerA= sm.nasm @@ -57,18 +57,17 @@ ALIGN 8 AsmIdtVectorBegin: %assign Vector 0 %rep 256 - push byte %[Vector] + push strict dword %[Vector] ; This instruction pushes sign-extended= 8-byte value on stack push rax - mov rax, strict qword 0 ; mov rax, ASM_PFX(CommonInterruptE= ntry) + mov rax, strict qword 0 ; mov rax, ASM_PFX(CommonInterruptE= ntry) jmp rax %assign Vector Vector+1 %endrep AsmIdtVectorEnd: =20 HookAfterStubHeaderBegin: - db 0x6a ; push -@VectorNum: - db 0 ; 0 will be fixed + push strict dword 0 ; 0 will be fixed +VectorNum: push rax mov rax, strict qword 0 ; mov rax, HookAfterStubHeaderEnd JmpAbsoluteAddress: @@ -478,6 +477,6 @@ ASM_PFX(AsmGetTemplateAddressMap): global ASM_PFX(AsmVectorNumFixup) ASM_PFX(AsmVectorNumFixup): mov rax, rdx - mov [rcx + (@VectorNum - HookAfterStubHeaderBegin)], al + mov [rcx + (VectorNum - 4 - HookAfterStubHeaderBegin)], al ret =20 --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#91111): https://edk2.groups.io/g/devel/message/91111 Mute This Topic: https://groups.io/mt/92205812/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-