From nobody Tue Apr 16 19:02: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+89694+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+89694+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1652346774; cv=none; d=zohomail.com; s=zohoarc; b=QGCPPIATQsp9VYPjozyPiSNEh99rlYc7y8DtkUE2HDYuYP4X5VBunN2JOaeqrf3AwTgUk4VCC1KKZOejz3j8oae+n5gn4sSsbV/MTlGmpqpH4kULz5WLzl+H+SDsSxH3dXbP8c9uGEj87J5HulI+mLjTYd2rbOukr487lLqfQQo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652346774; h=Content-Transfer-Encoding:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=nK3oQRzg8TikUj17uifFy+ccU4zSzlEGtCzwYhWdkAo=; b=F3hxg4Gk0CHbiwoKR+nd2IRU7AUuvBTWUivhAoL1pQEST/YBcvRDq9z1FucfeITBeto6AEbK8R/cpanMIdkNTaBS9aerprjRvzV0Tb0PLxa5jwB/kZGSPzlXdF8gObyU1+6tkNIzHl19gViAWA8b24mh8HEzZWLHMnDAplglCAM= 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+89694+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 1652346774584397.23687083746177; Thu, 12 May 2022 02:12:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id mJvkYY1788612xLNcj6gIAUl; Thu, 12 May 2022 02:12:54 -0700 X-Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web09.2024.1652346773361127443 for ; Thu, 12 May 2022 02:12:53 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10344"; a="330548234" X-IronPort-AV: E=Sophos;i="5.91,219,1647327600"; d="scan'208";a="330548234" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2022 02:12:52 -0700 X-IronPort-AV: E=Sophos;i="5.91,219,1647327600"; d="scan'208";a="542693381" X-Received: from cbduggap-mobl1.gar.corp.intel.com ([10.215.202.133]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2022 02:12:51 -0700 From: "cbduggap" To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH v2] FSP_TEMP_RAM_INIT API call must follow X64 Calling Convention Date: Thu, 12 May 2022 14:42:33 +0530 Message-Id: <269758c0ceee3f742ab7d178112229be447d30d9.1652346714.git.chinni.b.duggapu@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,chinni.b.duggapu@intel.com X-Gm-Message-State: aJPfQM9hF5ncZ6vDttfgMH3mx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1652346774; bh=Rz9h1zH8Sq4vD1ljMY0knlxLlxmN1UCH4IIeKZrONRY=; h=Date:From:Reply-To:Subject:To; b=kyEMvgCf2w8eavrt9R7+QKP2vRHOdRMrc2PsUVWFZsF/ZcZIiQkiR9zN5spQRoxuvNA h55EFS4AFIz/1MZ0I0ByGbjwXxiNgRY7O1g95r+TcPsxy6C6Jd9I2haaLZXO9f/7MRy9t HYEYL7wczGeFMLNBphVy9rSvr1SfnJcaBSU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1652346775595100001 Content-Type: text/plain; charset="utf-8" This API accept one parameter using RCX and this is consumed in mutiple sub functions. Signed-off-by: cbduggap --- IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm | 21 ++++++++------ .../Include/SaveRestoreSseAvxNasm.inc | 28 +++++++++++++++++++ 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm b/IntelFsp2Pkg/F= spSecCore/X64/FspApiEntryT.nasm index a9f5f28ed7..cddc41125e 100644 --- a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm +++ b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm @@ -130,10 +130,9 @@ ASM_PFX(LoadMicrocodeDefault): =20 cmp rsp, 0 jz ParamError - mov eax, dword [rsp + 8] ; Parameter pointer - cmp eax, 0 + cmp ecx, 0 jz ParamError - mov esp, eax + mov esp, ecx =20 ; skip loading Microcode if the MicrocodeCodeSize is zero ; and report error if size is less than 2k @@ -321,8 +320,7 @@ ASM_PFX(EstablishStackFsp): ; ; Save parameter pointer in rdx ; - mov rdx, qword [rsp + 8] - + mov rdx, rcx ; ; Enable FSP STACK ; @@ -420,7 +418,10 @@ ASM_PFX(TempRamInitApi): ; ENABLE_SSE ENABLE_AVX - + ; + ; Save Input Parameter in YMM10 + ; + SAVE_RCX ; ; Save RBP, RBX, RSI, RDI and RSP in YMM7, YMM8 and YMM6 ; @@ -442,9 +443,8 @@ ASM_PFX(TempRamInitApi): ; ; Check Parameter ; - mov rax, qword [rsp + 8] - cmp rax, 0 - mov rax, 08000000000000002h + cmp rcx, 0 + mov rcx, 08000000000000002h jz TempRamInitExit =20 ; @@ -456,17 +456,20 @@ ASM_PFX(TempRamInitApi): =20 ; Load microcode LOAD_RSP + LOAD_RCX CALL_YMM ASM_PFX(LoadMicrocodeDefault) SAVE_UCODE_STATUS rax ; Save microcode return status in SLOT= 0 in YMM9 (upper 128bits). ; @note If return value rax is not 0, microcode did not load, but contin= ue and attempt to boot. =20 ; Call Sec CAR Init LOAD_RSP + LOAD_RCX CALL_YMM ASM_PFX(SecCarInit) cmp rax, 0 jnz TempRamInitExit =20 LOAD_RSP + LOAD_RCX CALL_YMM ASM_PFX(EstablishStackFsp) cmp rax, 0 jnz TempRamInitExit diff --git a/IntelFsp2Pkg/Include/SaveRestoreSseAvxNasm.inc b/IntelFsp2Pkg/= Include/SaveRestoreSseAvxNasm.inc index e8bd91669d..38c807a311 100644 --- a/IntelFsp2Pkg/Include/SaveRestoreSseAvxNasm.inc +++ b/IntelFsp2Pkg/Include/SaveRestoreSseAvxNasm.inc @@ -177,6 +177,30 @@ LXMMN xmm5, %1, 1 %endmacro =20 +; +; Upper half of YMM10 to save/restore RCX +; +; +; Save RCX to YMM10[128:191] +; Modified: XMM5 and YMM10 +; + +%macro SAVE_RCX 0 + LYMMN ymm10, xmm5, 1 + SXMMN xmm5, 0, rcx + SYMMN ymm10, 1, xmm5 + %endmacro + +; +; Restore RCX from YMM10[128:191] +; Modified: XMM5 and RCX +; + +%macro LOAD_RCX 0 + LYMMN ymm10, xmm5, 1 + movq rcx, xmm5 + %endmacro + ; ; YMM7[128:191] for calling stack ; arg 1:Entry @@ -231,6 +255,7 @@ NextAddress: ; Use CpuId instruction (CPUID.01H:EDX.SSE[bit 25] =3D 1) to t= est ; whether the processor supports SSE instruction. ; + mov r10, rcx mov rax, 1 cpuid bt rdx, 25 @@ -241,6 +266,7 @@ NextAddress: ; bt ecx, 19 jnc SseError + mov rcx, r10 =20 ; ; Set OSFXSR bit (bit #9) & OSXMMEXCPT bit (bit #10) @@ -258,6 +284,7 @@ NextAddress: %endmacro =20 %macro ENABLE_AVX 0 + mov r10, rcx mov eax, 1 cpuid and ecx, 10000000h @@ -280,5 +307,6 @@ EnableAvx: xgetbv ; result in edx:eax or eax, 00000006h ; Set XCR0 bit #1 and bit #2 to enable = SSE state and AVX state xsetbv + mov rcx, r10 %endmacro =20 --=20 2.36.0.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 (#89694): https://edk2.groups.io/g/devel/message/89694 Mute This Topic: https://groups.io/mt/91054270/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-