From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web10.21890.1680173305413586247 for ; Thu, 30 Mar 2023 03:48:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sGXgGHri; spf=pass (domain: kernel.org, ip: 145.40.68.75, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 651CAB8271C for ; Thu, 30 Mar 2023 10:48:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2547CC4339C for ; Thu, 30 Mar 2023 10:48:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680173302; bh=N59YMnmhtBBN+xjO4clu2eq2lZcH21jzUVJcVntjdIE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=sGXgGHri1ZuScSgfxsdFQQtzx6+mNlq+fu+U3uShVMoaH+xAHPVWn1pISipPGe4qi MoqR19Sz0dq8KF04E+Cqoj4H5QtvnZS8UuzZC0u5c/AXRrwcJ3g1DromPEzQ/a870V K9oC81a2o5kM9JJ3RywUs4P1EjLHEZV9a5q1EvLQllWIs5UrY4vR2pLY2iYBO4hLvq c2fcdobO4f6jIWBWecRqYpn1r3ajMsr2fOWjEwjD6SHshSViyygznid0CuiFJhGsHx TI6VQ9hh4gNJ2wK/9o8dROxvJsGD8+cLOZ/r9Bymr3X3vBzsGxRpTL0CJtdYZVvyln GziukrfedelLw== Received: by mail-lj1-f174.google.com with SMTP id e9so3847821ljq.4 for ; Thu, 30 Mar 2023 03:48:22 -0700 (PDT) X-Gm-Message-State: AAQBX9dt2Q3ITwEfCSETBE+qo2OgJTenfm8OJ7aUcWyvuHkRULulXkQt Vqh9a7gg87nZEnX1RofdnjTC529Lg3nRgaxV+mc= X-Google-Smtp-Source: AKy350Zwy/dku2mKPchotPynWwc1S2nWK5qtQT39frJuwAdHZclM5/wZSyZUa/BKSvilm+qJIZlPABL020y2/1S2cjI= X-Received: by 2002:a2e:8746:0:b0:2a5:fe8f:ddec with SMTP id q6-20020a2e8746000000b002a5fe8fddecmr3551635ljj.2.1680173300102; Thu, 30 Mar 2023 03:48:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Ard Biesheuvel" Date: Thu, 30 Mar 2023 12:48:08 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] Is Xcode5ExceptionHandlerAsm.nasm still needed? To: devel@edk2.groups.io, ray.ni@intel.com Cc: Andrew Fish , "Kinney, Michael D" , "Liu, Zhiguang" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 30 Mar 2023 at 12:16, Ni, Ray wrote: > > Andrew, > > In UefiCpuPkg\Library\CpuExceptionHandlerLib\X64\, there are two nasm fil= es: ExceptionHandlerAsm.nasm and the other XCODE version. > > > > The major diff between the two is the second operand in =E2=80=9Cmov rax,= ASM_PFX(CommonInterruptEntry)=E2=80=9D is patched at runtime by code, inst= ead of relying on linker/loader to fix it. > > Can I know more background why it=E2=80=99s needed for XCODE? > > > > Given Apple is switching away from X86 CPU, is the XCODE version still ne= eded? > > > > + Mike because I found another commit by you for bug: 565 =E2=80=93 Fix X= 64 XCODE5/NASM compatibility issue in UefiCpuPkg MpInitLib (tianocore.org). > > Yes, we still need it, also for non-Xcode clang + lld The problem is that the little code templates use absolute addressing to refer to the jump targets. This is necessary because these templates are copied into the vector table, and so they are moved independently from the code they refer to, and so relative addressing is not an option here. One thing I haven't tried yet is to emit the template code into .data instead of .text, which /should/ be fine given that the template code is never executed directly, only the copied versions are executed.