From nobody Fri May 17 08:24:43 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+91085+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+91085+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1657092654; cv=none; d=zohomail.com; s=zohoarc; b=cFmeVIY9wCwpV1l2ZpzHOVlobqO5dFFyAJvVLnqwkQM8jBcwZXLXGylRFZ7ug7eRcjxzZjuidxKKlGyjYww4eaU7RfmKhU1wffRuTRYgjdBOLVSQuiA27dMyOT+ab3eDdnpX42739L9EIOa3arO3rKVThxx9NMHyzTXPsz5a9gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657092654; 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=T+kA9Jw8x9JspQRtcgkpM2VOGTGciNxX7q4ON/MOSeo=; b=OnvmcU8tiHYQvJ4oOnA2bflJJR42+mOo/yi7AbpYKXaMwqhi4x+M+jYEXacF87rSdZLGzGRD9g0SVZogVihEGD/mHmhe9iBeDTFjGit3wl40Xh8XboaghlK2BZjwmV9ARZdinfeg+ofmNllu4INrokHKwgGRphov69o/TgEraZg= 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+91085+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 1657092654860236.77134341686042; Wed, 6 Jul 2022 00:30:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9CyNYY1788612xXtxurChyng; Wed, 06 Jul 2022 00:30:53 -0700 X-Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.3464.1657092652467916331 for ; Wed, 06 Jul 2022 00:30:52 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10399"; a="282422190" X-IronPort-AV: E=Sophos;i="5.92,249,1650956400"; d="scan'208";a="282422190" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2022 00:30:52 -0700 X-IronPort-AV: E=Sophos;i="5.92,249,1650956400"; d="scan'208";a="650545552" 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 00:30:50 -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] UefiCpuPkg: Fix nasm warning "signed byte value exceeds" Date: Wed, 6 Jul 2022 15:30:35 +0800 Message-Id: <20220706073035.18740-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: J9sJEviwx0QMz09LjUs3MMHZx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1657092653; bh=Nn3ubrCzGh6jOAuoQHQpcJlWk6O822MtZM1Tph+KNAI=; h=Cc:Date:From:Reply-To:Subject:To; b=rb8YU37xqQXeNL87t92BapD1C82rIL3FO7MmbEGxyCRVB1hCD+ZwQ4hPKyXc0xXH/Ek T+dQjHeOB+X/OeZpK+yGNUthN4siA5LDJFEj2EQqFHVLeAjFeEd1q90QVs/BXFEUyF+vw sBIWtaRbFhqe9cRgKi50MbR4rEdMZQp0tXE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1657092655717100003 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 --- .../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..94bca6a414 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 19 =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 (#91085): https://edk2.groups.io/g/devel/message/91085 Mute This Topic: https://groups.io/mt/92201950/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-