From patchwork Thu Aug 4 15:04:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jane Malalane X-Patchwork-Id: 12936465 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 076C5C25B06 for ; Thu, 4 Aug 2022 15:05:29 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.380517.614701 (Exim 4.92) (envelope-from ) id 1oJcPM-0001pj-7v; Thu, 04 Aug 2022 15:05:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 380517.614701; Thu, 04 Aug 2022 15:05:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oJcPM-0001pb-4x; Thu, 04 Aug 2022 15:05:08 +0000 Received: by outflank-mailman (input) for mailman id 380517; Thu, 04 Aug 2022 15:05:06 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oJcPK-0001pR-Nw for xen-devel@lists.xenproject.org; Thu, 04 Aug 2022 15:05:06 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d120dfde-1406-11ed-bd2d-47488cf2e6aa; Thu, 04 Aug 2022 17:05:04 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d120dfde-1406-11ed-bd2d-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1659625504; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+XvSPGhkSE1Z7JYIaZw7tOFI2h+V4kO6R6kgf5+xW64=; b=aDfuyZ4eBB4NvKyWNWOS3qP5o2MY0Dz31i3wV/Z2bXSWcT9XflGDiApc f604ymhx7kFf4V4s0tpzVimiiHtYp6zD/p2kDeZjsYKEiUIy7afwZK3on psOXWIa85qS4ez7fN+2hpBleU/67T6U3PlmzqTkyQVpBT+1CwHWm9JTX9 8=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 2.7 X-MesageID: 77380020 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:NMr33qhHPO9XXKvyR54p6DOKX17brhtdeKXEuqucoGZYitEo9fiigw3rTHB/vMu+OsBzOTSeNSnCs4IU2YTIz8AWJWPuvmb4KX+F6BLaQgz51FdQzqpjf+ZYVAVlHC8VHgAGJ+35Y8rt69mUOzoU6eggX3v0mCFpCDCP66c4sovqSAV1PuGqrraWgiiC9H6id5H5IOZwQnV82SAENY+Qq4nIJdfZm8s9Z26+9B2O6qwbCFlEw/pozTzRAV9PdtnNiWPQrmYfwXFTBGXwwWqXIuRPBXvHZhialCZjxd56C9cfvPKD5cNkWiqjbo0jV+RqaHO5+BFRwOiweYsRSVCrvW530EeQeRkUXs51Zjvskyief97OlHOIOVsq/EIBO5lKuCA9y9BFUDNk0uJ6IgBgEGjXLpfmtSZ9kwE0jxrELnwQ3rl/zmVFJrzr1FIZuYZUWNeJrnpq/DzMrUpjBx4vH8cEpj6M7wb8aB2UMy3R/R4et5Mzp+Z9yoHsWIqjTwKW2ggUkeQwD7kkzPdjaNC7YaSuPaQSvQyO8qBs67QVgN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ort-AV: E=Sophos;i="5.93,216,1654574400"; d="scan'208";a="77380020" From: Jane Malalane To: Xen-devel CC: Jane Malalane , Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH 1/4] x86/kexec: Add the '.L_' prefix to is_* and call_* labels Date: Thu, 4 Aug 2022 16:04:21 +0100 Message-ID: <20220804150424.17584-2-jane.malalane@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220804150424.17584-1-jane.malalane@citrix.com> References: <20220804150424.17584-1-jane.malalane@citrix.com> MIME-Version: 1.0 These are local symbols and shouldn't be externally visible. Suggested-by: Andrew Cooper Signed-off-by: Jane Malalane Acked-by: Jan Beulich --- CC: Andrew Cooper CC: Jan Beulich CC: "Roger Pau Monné" CC: Wei Liu --- xen/arch/x86/x86_64/kexec_reloc.S | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/xen/arch/x86/x86_64/kexec_reloc.S b/xen/arch/x86/x86_64/kexec_reloc.S index 89316bc3a7..f4842025eb 100644 --- a/xen/arch/x86/x86_64/kexec_reloc.S +++ b/xen/arch/x86/x86_64/kexec_reloc.S @@ -40,10 +40,10 @@ ENTRY(kexec_reloc) movq %rsi, %cr3 /* Jump to identity mapped code. */ - leaq (identity_mapped - kexec_reloc)(%rdi), %rax + leaq (.L_identity_mapped - kexec_reloc)(%rdi), %rax jmpq *%rax -identity_mapped: +.L_identity_mapped: /* * Set cr0 to a known state: * - Paging enabled @@ -70,14 +70,14 @@ identity_mapped: /* Need to switch to 32-bit mode? */ testq $KEXEC_RELOC_FLAG_COMPAT, %r8 - jnz call_32_bit + jnz .L_call_32_bit -call_64_bit: +.L_call_64_bit: /* Call the image entry point. This should never return. */ callq *%rbp ud2 -call_32_bit: +.L_call_32_bit: /* Setup IDT. */ lidt compat_mode_idt(%rip) @@ -102,41 +102,41 @@ relocate_pages: xorl %edi, %edi xorl %esi, %esi -next_entry: /* top, read another word for the indirection page */ +.L_next_entry: /* top, read another word for the indirection page */ movq (%rbx), %rcx addq $8, %rbx -is_dest: +.L_is_dest: testb $IND_DESTINATION, %cl - jz is_ind + jz .L_is_ind movq %rcx, %rdi andq $PAGE_MASK, %rdi - jmp next_entry -is_ind: + jmp .L_next_entry +.L_is_ind: testb $IND_INDIRECTION, %cl - jz is_done + jz .L_is_done movq %rcx, %rbx andq $PAGE_MASK, %rbx - jmp next_entry -is_done: + jmp .L_next_entry +.L_is_done: testb $IND_DONE, %cl - jnz done -is_source: + jnz .L_done +.L_is_source: testb $IND_SOURCE, %cl - jz is_zero + jz .L_is_zero movq %rcx, %rsi /* For every source page do a copy */ andq $PAGE_MASK, %rsi movl $(PAGE_SIZE / 8), %ecx rep movsq - jmp next_entry -is_zero: + jmp .L_next_entry +.L_is_zero: testb $IND_ZERO, %cl - jz next_entry + jz .L_next_entry movl $(PAGE_SIZE / 8), %ecx /* Zero the destination page. */ xorl %eax, %eax rep stosq - jmp next_entry -done: + jmp .L_next_entry +.L_done: popq %rbx ret From patchwork Thu Aug 4 15:04:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jane Malalane X-Patchwork-Id: 12936466 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9ABCC19F2A for ; Thu, 4 Aug 2022 15:05:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.380523.614744 (Exim 4.92) (envelope-from ) id 1oJcPX-00033U-H3; Thu, 04 Aug 2022 15:05:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 380523.614744; Thu, 04 Aug 2022 15:05:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oJcPX-00033L-E6; Thu, 04 Aug 2022 15:05:19 +0000 Received: by outflank-mailman (input) for mailman id 380523; Thu, 04 Aug 2022 15:05:18 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oJcPW-0001pR-LQ for xen-devel@lists.xenproject.org; Thu, 04 Aug 2022 15:05:18 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d886c8f3-1406-11ed-bd2d-47488cf2e6aa; Thu, 04 Aug 2022 17:05:17 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d886c8f3-1406-11ed-bd2d-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1659625516; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=CdtbkD3eQ8hKPJiJTBFFPb8a5m5PwrGLe0HfMNmqQaQ=; b=G7ZY9PbNyfVRA65s7s85gODyhEWswcsgLbPFXzByoWhiY0L+8fb7NfM9 qoiZAkGQwBiDvJmcYW/Ga6LUmnOAkHP1F4z8KVmKFm9FCqDTaep/zikLg PgNVXCDdLDjK9sRFOUTCY8srB6B/DaqnDeSIg0hlt2KKxLxYvoaxgGaEe I=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 2.7 X-MesageID: 79938458 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a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uPQlH2zpsWiPXSMmWPSRHhWRUUG6Wfe9JYGK7bSe1o7cIzjYteIqY4cl0Vet/w9vo/1E ruVAye0FHKXaaX7FDi3 IronPort-HdrOrdr: A9a23:B8WLcq6W0Rs8HKcvWgPXwMrXdLJyesId70hD6qhwISY6TiX4rb HWoB1173/JYVoqNE3I3OrwXZVoIkmsk6Kdg7NhXotKNTOO0ADDQb2Kr7GSpwEIcxeOkdK1vp 0AT0ERMrLN5CBB/KTH3DU= X-IronPort-AV: E=Sophos;i="5.93,216,1654574400"; d="scan'208";a="79938458" From: Jane Malalane To: Xen-devel CC: Jane Malalane , Andrew Cooper , George Dunlap , "Jan Beulich" , Julien Grall , "Stefano Stabellini" , Wei Liu Subject: [PATCH 2/4] xen: Port linkage.h from kernel code Date: Thu, 4 Aug 2022 16:04:22 +0100 Message-ID: <20220804150424.17584-3-jane.malalane@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220804150424.17584-1-jane.malalane@citrix.com> References: <20220804150424.17584-1-jane.malalane@citrix.com> MIME-Version: 1.0 Suggested-by: Andrew Cooper Signed-off-by: Jane Malalane --- CC: Andrew Cooper CC: George Dunlap CC: Jan Beulich CC: Julien Grall CC: Stefano Stabellini CC: Wei Liu --- xen/include/xen/linkage.h | 260 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100644 xen/include/xen/linkage.h diff --git a/xen/include/xen/linkage.h b/xen/include/xen/linkage.h new file mode 100644 index 0000000000..adc00c356b --- /dev/null +++ b/xen/include/xen/linkage.h @@ -0,0 +1,260 @@ +#ifndef __XEN_LINKAGE_H +#define __XEN_LINKAGE_H + +/* + * Imported from linux-5.19:include/linux/linkage.h + */ + +/* Some toolchains use other characters (e.g. '`') to mark new line in macro */ +#ifndef ASM_NL +#define ASM_NL ; +#endif + +#ifdef __ASSEMBLY__ + +/* SYM_T_FUNC -- type used by assembler to mark functions */ +#ifndef SYM_T_FUNC +#define SYM_T_FUNC STT_FUNC +#endif + +/* SYM_T_OBJECT -- type used by assembler to mark data */ +#ifndef SYM_T_OBJECT +#define SYM_T_OBJECT STT_OBJECT +#endif + +/* SYM_T_NONE -- type used by assembler to mark entries of unknown type */ +#ifndef SYM_T_NONE +#define SYM_T_NONE STT_NOTYPE +#endif + +/* SYM_A_* -- align the symbol? */ +#define SYM_A_ALIGN ALIGN +#define SYM_A_NONE /* nothing */ + +/* SYM_L_* -- linkage of symbols */ +#define SYM_L_GLOBAL(name) .globl name +#define SYM_L_WEAK(name) .weak name +#define SYM_L_LOCAL(name) /* nothing */ + +/* === generic annotations === */ + +/* SYM_ENTRY -- use only if you have to for non-paired symbols */ +#ifndef SYM_ENTRY +#define SYM_ENTRY(name, linkage, align...) \ + linkage(name) ASM_NL \ + align ASM_NL \ + name: +#endif + +/* SYM_START -- use only if you have to */ +#ifndef SYM_START +#define SYM_START(name, linkage, align...) \ + SYM_ENTRY(name, linkage, align) +#endif + +/* SYM_END -- use only if you have to */ +#ifndef SYM_END +#define SYM_END(name, sym_type) \ + .type name sym_type ASM_NL \ + .set .L__sym_size_##name, .-name ASM_NL \ + .size name, .L__sym_size_##name +#endif + +/* SYM_ALIAS -- use only if you have to */ +#ifndef SYM_ALIAS +#define SYM_ALIAS(alias, name, linkage) \ + linkage(alias) ASM_NL \ + .set alias, name ASM_NL +#endif + +/* === code annotations === */ + +/* + * FUNC -- C-like functions (proper stack frame etc.) + * CODE -- non-C code (e.g. irq handlers with different, special stack etc.) + * + * Objtool validates stack for FUNC, but not for CODE. + * Objtool generates debug info for both FUNC & CODE, but needs special + * annotations for each CODE's start (to describe the actual stack frame). + * + * Objtool requires that all code must be contained in an ELF symbol. Symbol + * names that have a .L prefix do not emit symbol table entries. .L + * prefixed symbols can be used within a code region, but should be avoided for + * denoting a range of code via ``SYM_*_START/END`` annotations. + * + * ALIAS -- does not generate debug info -- the aliased function will + */ + +/* SYM_INNER_LABEL_ALIGN -- only for labels in the middle of code, + * w/ alignment + */ +#ifndef SYM_INNER_LABEL_ALIGN +#define SYM_INNER_LABEL_ALIGN(name, linkage) \ + .type name SYM_T_NONE ASM_NL \ + SYM_ENTRY(name, linkage, SYM_A_ALIGN) +#endif + +/* SYM_INNER_LABEL_LOCAL -- only for local labels in the middle of code */ +#ifndef SYM_INNER_LABEL_LOCAL +#define SYM_INNER_LABEL_LOCAL(name) \ + .type name SYM_T_NONE ASM_NL \ + SYM_ENTRY(name, SYM_L_LOCAL, SYM_A_NONE) +#endif + +/* SYM_INNER_LABEL_GLOBAL -- only for global labels in the middle of code */ +#ifndef SYM_INNER_LABEL_GLOBAL +#define SYM_INNER_LABEL_GLOBAL(name) \ + .type name SYM_T_NONE ASM_NL \ + SYM_ENTRY(name, SYM_L_GLOBAL, SYM_A_NONE) +#endif + +/* SYM_FUNC_START -- use for global functions */ +#ifndef SYM_FUNC_START +#define SYM_FUNC_START(name) \ + SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) +#endif + +/* SYM_FUNC_START_NOALIGN -- use for global functions, w/o alignment */ +#ifndef SYM_FUNC_START_NOALIGN +#define SYM_FUNC_START_NOALIGN(name) \ + SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE) +#endif + +/* SYM_FUNC_START_LOCAL -- use for local functions */ +#ifndef SYM_FUNC_START_LOCAL +#define SYM_FUNC_START_LOCAL(name) \ + SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN) +#endif + +/* SYM_FUNC_START_LOCAL_NOALIGN -- use for local functions, w/o alignment */ +#ifndef SYM_FUNC_START_LOCAL_NOALIGN +#define SYM_FUNC_START_LOCAL_NOALIGN(name) \ + SYM_START(name, SYM_L_LOCAL, SYM_A_NONE) +#endif + +/* SYM_FUNC_START_WEAK -- use for weak functions */ +#ifndef SYM_FUNC_START_WEAK +#define SYM_FUNC_START_WEAK(name) \ + SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN) +#endif + +/* SYM_FUNC_START_WEAK_NOALIGN -- use for weak functions, w/o alignment */ +#ifndef SYM_FUNC_START_WEAK_NOALIGN +#define SYM_FUNC_START_WEAK_NOALIGN(name) \ + SYM_START(name, SYM_L_WEAK, SYM_A_NONE) +#endif + +/* + * SYM_FUNC_END -- the end of SYM_FUNC_START_LOCAL, SYM_FUNC_START, + * SYM_FUNC_START_WEAK, ... + */ +#ifndef SYM_FUNC_END +#define SYM_FUNC_END(name) \ + SYM_END(name, SYM_T_FUNC) +#endif + +/* + * SYM_FUNC_ALIAS -- define a global alias for an existing function + */ +#ifndef SYM_FUNC_ALIAS +#define SYM_FUNC_ALIAS(alias, name) \ + SYM_ALIAS(alias, name, SYM_L_GLOBAL) +#endif + +/* + * SYM_FUNC_ALIAS_LOCAL -- define a local alias for an existing function + */ +#ifndef SYM_FUNC_ALIAS_LOCAL +#define SYM_FUNC_ALIAS_LOCAL(alias, name) \ + SYM_ALIAS(alias, name, SYM_L_LOCAL) +#endif + +/* + * SYM_FUNC_ALIAS_WEAK -- define a weak global alias for an existing function + */ +#ifndef SYM_FUNC_ALIAS_WEAK +#define SYM_FUNC_ALIAS_WEAK(alias, name) \ + SYM_ALIAS(alias, name, SYM_L_WEAK) +#endif + +/* SYM_CODE_START -- use for non-C (special) functions */ +#ifndef SYM_CODE_START +#define SYM_CODE_START(name) \ + SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) +#endif + +/* SYM_CODE_START_NOALIGN -- use for non-C (special) functions, w/o alignment */ +#ifndef SYM_CODE_START_NOALIGN +#define SYM_CODE_START_NOALIGN(name) \ + SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE) +#endif + +/* SYM_CODE_START_LOCAL -- use for local non-C (special) functions */ +#ifndef SYM_CODE_START_LOCAL +#define SYM_CODE_START_LOCAL(name) \ + SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN) +#endif + +/* + * SYM_CODE_START_LOCAL_NOALIGN -- use for local non-C (special) functions, + * w/o alignment + */ +#ifndef SYM_CODE_START_LOCAL_NOALIGN +#define SYM_CODE_START_LOCAL_NOALIGN(name) \ + SYM_START(name, SYM_L_LOCAL, SYM_A_NONE) +#endif + +/* SYM_CODE_END -- the end of SYM_CODE_START_LOCAL, SYM_CODE_START, ... */ +#ifndef SYM_CODE_END +#define SYM_CODE_END(name) \ + SYM_END(name, SYM_T_NONE) +#endif + +/* === data annotations === */ + +/* SYM_DATA_START -- global data symbol */ +#ifndef SYM_DATA_START +#define SYM_DATA_START(name) \ + SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE) +#endif + +/* SYM_DATA_START -- local data symbol */ +#ifndef SYM_DATA_START_LOCAL +#define SYM_DATA_START_LOCAL(name) \ + SYM_START(name, SYM_L_LOCAL, SYM_A_NONE) +#endif + +/* SYM_DATA_END -- the end of SYM_DATA_START symbol */ +#ifndef SYM_DATA_END +#define SYM_DATA_END(name) \ + SYM_END(name, SYM_T_OBJECT) +#endif + +/* SYM_DATA_END_LABEL -- the labeled end of SYM_DATA_START symbol */ +#ifndef SYM_DATA_END_LABEL +#define SYM_DATA_END_LABEL(name, linkage, label) \ + linkage(label) ASM_NL \ + .type label SYM_T_OBJECT ASM_NL \ + label: \ + SYM_END(name, SYM_T_OBJECT) +#endif + +/* SYM_DATA -- start+end wrapper around simple global data */ +#ifndef SYM_DATA +#define SYM_DATA(name, data...) \ + SYM_DATA_START(name) ASM_NL \ + data ASM_NL \ + SYM_DATA_END(name) +#endif + +/* SYM_DATA_LOCAL -- start+end wrapper around simple local data */ +#ifndef SYM_DATA_LOCAL +#define SYM_DATA_LOCAL(name, data...) \ + SYM_DATA_START_LOCAL(name) ASM_NL \ + data ASM_NL \ + SYM_DATA_END(name) +#endif + +#endif /* __ASSEMBLY__ */ + +#endif /* __XEN_LINKAGE_H */ From patchwork Thu Aug 4 15:04:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jane Malalane X-Patchwork-Id: 12936463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 661DDC19F2A for ; Thu, 4 Aug 2022 15:05:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.380518.614707 (Exim 4.92) (envelope-from ) id 1oJcPM-0001tD-JJ; Thu, 04 Aug 2022 15:05:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 380518.614707; Thu, 04 Aug 2022 15:05:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oJcPM-0001sY-Dp; Thu, 04 Aug 2022 15:05:08 +0000 Received: by outflank-mailman (input) for mailman id 380518; Thu, 04 Aug 2022 15:05:08 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oJcPL-0001pR-SR for xen-devel@lists.xenproject.org; Thu, 04 Aug 2022 15:05:07 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d2558e88-1406-11ed-bd2d-47488cf2e6aa; Thu, 04 Aug 2022 17:05:06 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d2558e88-1406-11ed-bd2d-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1659625506; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QgUZ32yF2K286P2BkzCo1ex4mjo4Zhntd7s4lmaIVpo=; b=NwI6vkdyRFBY/3g9ch+1ooY+csxsAfuHJ4aTLVGCPcrbF3+H/0zjm10f MH1Riie6aGUS4t7KELeiw0NdV1WRELH0I/eq2eNUKuCUL8TwtVZmpgpqo dB5FhPafbWnEynArDkFsaLHdX2t1eigTCHuwgtnFjd4pgOyLqozXjW/CN E=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 2.7 X-MesageID: 77379592 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:4j5itK/RN50nuPFwmNsfDrUD7H6TJUtcMsCJ2f8bNWPcYEJGY0x3n GQcWTyHM/yIZWqmfdtyb4vi/RsC7MODytJmQANuqys8E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si+Fa+Sn9z8kvU2xbuKUIPbePSxsThNTRi4kiBZy88Y0mYctitWia++3k YqaT/b3ZRn0gFaYDkpOs/jZ8EM34Kyp0N8llgdWic5j7Qe2e0Y9VPrzFYnpR1PkT49dGPKNR uqr5NlVKUuAon/Bovv8+lrKWhViroz6ZGBiuVIPM0SWuTBQpzRa70oOHKF0hXG7Kdm+t4sZJ N1l7fRcQOqyV0HGsLx1vxJwS0mSMUDakVNuzLfWXcG7liX7n3XQL/pGHX8RAqlA/sNOBVpN8 dMWa2kAdh7SiLfjqF67YrEEasULKcDqOMUUu216zCGfBvEjKXzBa/yUv5kChm52350QW6aFD yYaQWMHgBDoQRRJNxEyAZY3mO6ui1H0ciFCqULTrq0yi4TW5FMui+e8bYuPEjCMbYZz3UfAm 0KXxmfSOwgCPcCd9zHUr1v504cjmgukAdlPRdVU7MVCn1m71mEVThoMWjOTo/O0l0q/UNJ3M FEP92wlqq1a3FymSJzxUgO1pFaAvwUAQJxAHusi8gaPx6HIpQGDCQA5oiVpMYJ88pVsHHpzi wHPz4iB6SFTXKO9WEy6yZPMqRaLPRMWKUAMJnYJVQVU7Iy2yG0stS4jXuqPAYbs0ICkRWmtm m3QxMQtr+5N1JBWjs1X6XiC2mvx/caRE2bZ8y2NBgqYAhVFiJlJjmBCwXzS9r5+IYmQVTFtV 1BUypHFvIji4Xxg/RFhodnh/5nzvp5pyBWG3TZS82AJrlxBAUKLc4FK+y1ZL0x0KMsCcjKBS BaN5FIMucYMbCD6MvQfj2eN5yMCncDd+SnNDKiIPrKinLArHON4wM2eTRHJhD28+KTduao+J Y2aYa6RMJruMow+lWLeb7pMjtcWKtUWnzy7qWbTk0v6itJzpRe9Fd84Dbd5Rr9jvf7c8VyFr r6y9aKikn1ibQE3WQGPmaZ7ELzABSFT6UzewyCPStO+Hw== IronPort-HdrOrdr: A9a23:9+M+/Km6aGtqgmMDuqOVGtUUKhDpDfIU3DAbv31ZSRFFG/Fxl6 iV8sjzsiWE8Qr5OUtQ/+xoV5PhfZqxz/JICMwqTNKftWrdyQyVxeNZnOjfKlTbckWUnINgPO VbAsxD4bXLfCBHZK3BgTVQfexO/DD+ytHLudvj X-IronPort-AV: E=Sophos;i="5.93,216,1654574400"; d="scan'208";a="77379592" From: Jane Malalane To: Xen-devel CC: Jane Malalane , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH 3/4] x86/entry: move .init.text section higher up in the code for readability Date: Thu, 4 Aug 2022 16:04:23 +0100 Message-ID: <20220804150424.17584-4-jane.malalane@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220804150424.17584-1-jane.malalane@citrix.com> References: <20220804150424.17584-1-jane.malalane@citrix.com> MIME-Version: 1.0 Suggested-by: Andrew Cooper Signed-off-by: Jane Malalane Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Andrew Cooper CC: "Roger Pau Monné" CC: Wei Liu --- xen/arch/x86/x86_64/entry.S | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S index 26bf2f1941..4ad25d9c90 100644 --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S @@ -140,6 +140,15 @@ process_trap: call create_bounce_frame jmp test_all_events + .pushsection .init.text, "ax", @progbits + ENTRY(early_page_fault) + ENDBR64 + movl $TRAP_page_fault,4(%rsp) + SAVE_ALL + movq %rsp,%rdi + call do_early_page_fault + jmp restore_all_xen + .section .text.entry, "ax", @progbits /* %rbx: struct vcpu, interrupts disabled */ @@ -982,16 +991,6 @@ ENTRY(double_fault) call do_double_fault BUG /* do_double_fault() shouldn't return. */ - .pushsection .init.text, "ax", @progbits -ENTRY(early_page_fault) - ENDBR64 - movl $TRAP_page_fault,4(%rsp) - SAVE_ALL - movq %rsp,%rdi - call do_early_page_fault - jmp restore_all_xen - .popsection - ENTRY(nmi) ENDBR64 pushq $0 From patchwork Thu Aug 4 15:04:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jane Malalane X-Patchwork-Id: 12936464 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A895AC19F2D for ; Thu, 4 Aug 2022 15:05:27 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.380519.614723 (Exim 4.92) (envelope-from ) id 1oJcPO-0002Km-1P; Thu, 04 Aug 2022 15:05:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 380519.614723; Thu, 04 Aug 2022 15:05:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oJcPN-0002Ka-TQ; Thu, 04 Aug 2022 15:05:09 +0000 Received: by outflank-mailman (input) for mailman id 380519; Thu, 04 Aug 2022 15:05:08 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oJcPM-0001pR-Ds for xen-devel@lists.xenproject.org; Thu, 04 Aug 2022 15:05:08 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d2ed1192-1406-11ed-bd2d-47488cf2e6aa; Thu, 04 Aug 2022 17:05:06 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d2ed1192-1406-11ed-bd2d-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1659625506; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rbJPwE6pO1Pfkj8tz43SWX+jW02vPu3YzO8jU4aC0vk=; b=EHYW9NA7DEHiuZ3i9Ccz+vU87QPCyndLt+hkkXGPYPr19+hr/paAZ/d4 VtklaLbvSxHGtL0JssYjztWetGNiufqIaE74xNSY0/BtJyAJfjj943c+e n4jFF6SL8pJz7hRtMmaMlh3F7W2kTTR7qYblKRbfpXVm9GKYx9wtIj+MQ I=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 2.7 X-MesageID: 77380021 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:F3uhQ6JiYW6qZF04FE//H55y250vRxNeGxJCi3AjJ82iE/EPTyDwt742D5P94fufO2Mly1YiP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e7jpLhNVb/Fn/a7vUEZ+7lHJ5YaOHmgEgH/UWLqe4rxarvr+n59OYehsGcZ5hnZWx8DYterWjWi4UT9pm07qoF2r0cfQOqb9AMc45NVzwirKYD4i2Bf9qgQJ8VA3xnIJqBVxB5gz3+dDVpkMTmKrtRpomS2SDv3yjmF1MTyCJCut+oxAmKILLP3R6zCi3grp3jRRiNB59qjO6WUTd3xuUI0ItIfIqJcDZnLKouq882miSk4UQ7Zu27nV2+Jh8GNsdyGU04zPsn5g0AWogGOQYiKrPuj6lZpuF2d6tFsq1RqslGoCLAAHWxi7yQ7TmOO3HiS6yRO8KRT600dz96c5ank8tH78I4enToqjv5mvTOs6Er/z/V0T2N4s/SWxbkDxg3QK5CkGVu6719we2H7HDYYMP8CQZmLDdUhj/tg+ptiM298n5tCsNI6+C86arY6nQob98NohhNZKYyabEjW4/lE= X-IronPort-AV: E=Sophos;i="5.93,216,1654574400"; d="scan'208";a="77380021" From: Jane Malalane To: Xen-devel CC: Jane Malalane , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [RFC PATCH 4/4] x86: Use linkage.h helpers to add tags to symbols Date: Thu, 4 Aug 2022 16:04:24 +0100 Message-ID: <20220804150424.17584-5-jane.malalane@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220804150424.17584-1-jane.malalane@citrix.com> References: <20220804150424.17584-1-jane.malalane@citrix.com> MIME-Version: 1.0 Clean up x86_64/kexec_reloc.S and x86_64/entry.S. This fixes the livepatching contents of entry.S. RFC: I'm unsure on where the page_fault symbol should end, i.e. if unlike current code handle_exception_saved should be within page_fault like handle_exception is or not. Suggested-by: Andrew Cooper Signed-off-by: Jane Malalane --- CC: Jan Beulich CC: Andrew Cooper CC: "Roger Pau Monné" CC: Wei Liu --- xen/arch/x86/x86_64/entry.S | 105 +++++++++++++++++++++++++------------- xen/arch/x86/x86_64/kexec_reloc.S | 43 ++++++---------- 2 files changed, 86 insertions(+), 62 deletions(-) diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S index 4ad25d9c90..7dc280aafa 100644 --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S @@ -11,6 +11,7 @@ #include #include #include +#include /* %rsp: struct cpu_user_regs */ .macro ASSERT_CONTEXT_IS_XEN @@ -152,7 +153,7 @@ process_trap: .section .text.entry, "ax", @progbits /* %rbx: struct vcpu, interrupts disabled */ -restore_all_guest: +SYM_CODE_START_LOCAL(restore_all_guest) ASSERT_INTERRUPTS_DISABLED /* Stash guest SPEC_CTRL value while we can read struct vcpu. */ @@ -239,6 +240,7 @@ iret_exit_to_guest: addq $8,%rsp .Lft0: iretq _ASM_PRE_EXTABLE(.Lft0, handle_exception) +SYM_CODE_END(restore_all_guest) /* * When entering SYSCALL from kernel mode: @@ -255,7 +257,7 @@ iret_exit_to_guest: * - Guest %rsp stored in %rax * - Xen stack loaded, pointing at the %ss slot */ -ENTRY(lstar_enter) +SYM_CODE_START(lstar_enter) #ifdef CONFIG_XEN_SHSTK ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK #endif @@ -290,9 +292,10 @@ ENTRY(lstar_enter) mov %rsp, %rdi call pv_hypercall jmp test_all_events +SYM_CODE_END(lstar_enter) /* See lstar_enter for entry register state. */ -ENTRY(cstar_enter) +SYM_CODE_START(cstar_enter) #ifdef CONFIG_XEN_SHSTK ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK #endif @@ -329,8 +332,9 @@ ENTRY(cstar_enter) jne compat_syscall #endif jmp switch_to_kernel +SYM_CODE_END(cstar_enter) -ENTRY(sysenter_entry) +SYM_CODE_START(sysenter_entry) ENDBR64 #ifdef CONFIG_XEN_SHSTK ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK @@ -339,7 +343,7 @@ ENTRY(sysenter_entry) pushq $FLAT_USER_SS pushq $0 pushfq -GLOBAL(sysenter_eflags_saved) +SYM_INNER_LABEL_GLOBAL(sysenter_eflags_saved) ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP pushq $3 /* ring 3 null cs */ pushq $0 /* null rip */ @@ -393,8 +397,9 @@ UNLIKELY_END(sysenter_gpf) jne compat_sysenter #endif jmp .Lbounce_exception +SYM_CODE_END(sysenter_entry) -ENTRY(int80_direct_trap) +SYM_CODE_START(int80_direct_trap) ENDBR64 ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP pushq $0 @@ -465,8 +470,9 @@ UNLIKELY_END(msi_check) call create_bounce_frame jmp test_all_events +SYM_CODE_END(int80_direct_trap) -int80_slow_path: +SYM_CODE_START_LOCAL(int80_slow_path) /* * Setup entry vector and error code as if this was a GPF caused by an * IDT entry with DPL==0. @@ -482,6 +488,7 @@ int80_slow_path: */ GET_STACK_END(14) jmp handle_exception_saved +SYM_CODE_END(int80_slow_path) /* create_bounce_frame & helpers don't need to be in .text.entry */ .text @@ -657,9 +664,8 @@ ret_from_intr: .section .text.entry, "ax", @progbits - ALIGN /* No special register assumptions. */ -restore_all_xen: +SYM_CODE_START_LOCAL(restore_all_xen) /* * Check whether we need to switch to the per-CPU page tables, in * case we return to late PV exit code (from an NMI or #MC). @@ -676,8 +682,9 @@ UNLIKELY_END(exit_cr3) RESTORE_ALL adj=8 iretq +SYM_CODE_END(restore_all_xen) -ENTRY(common_interrupt) +SYM_CODE_START(common_interrupt) ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP SAVE_ALL @@ -706,12 +713,14 @@ ENTRY(common_interrupt) mov %r15, STACK_CPUINFO_FIELD(xen_cr3)(%r14) mov %bl, STACK_CPUINFO_FIELD(use_pv_cr3)(%r14) jmp ret_from_intr +SYM_CODE_END(common_interrupt) -ENTRY(page_fault) +SYM_CODE_START(page_fault) ENDBR64 movl $TRAP_page_fault,4(%rsp) + /* No special register assumptions. */ -GLOBAL(handle_exception) +SYM_INNER_LABEL_GLOBAL(handle_exception) ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP SAVE_ALL @@ -734,7 +743,7 @@ GLOBAL(handle_exception) cmovnz %r12d, %r13d .Lxcpt_cr3_okay: -handle_exception_saved: +SYM_INNER_LABEL_LOCAL(handle_exception_saved) GET_CURRENT(bx) testb $X86_EFLAGS_IF>>8,UREGS_eflags+1(%rsp) jz exception_with_ints_disabled @@ -842,9 +851,10 @@ handle_exception_saved: ASSERT_CONTEXT_IS_XEN jmp restore_all_xen #endif +SYM_CODE_END(page_fault) /* No special register assumptions. */ -exception_with_ints_disabled: +SYM_CODE_START_LOCAL(exception_with_ints_disabled) testb $3,UREGS_cs(%rsp) # interrupts disabled outside Xen? jnz FATAL_exception_with_ints_disabled movq %rsp,%rdi @@ -874,99 +884,116 @@ exception_with_ints_disabled: mov %r15, STACK_CPUINFO_FIELD(xen_cr3)(%r14) mov %r13b, STACK_CPUINFO_FIELD(use_pv_cr3)(%r14) jmp restore_all_xen # return to fixup code +SYM_CODE_END(exception_with_ints_disabled) /* No special register assumptions. */ -FATAL_exception_with_ints_disabled: +SYM_CODE_START_LOCAL(FATAL_exception_with_ints_disabled) xorl %esi,%esi movq %rsp,%rdi call fatal_trap BUG /* fatal_trap() shouldn't return. */ +SYM_CODE_END(FATAL_exception_with_ints_disabled) -ENTRY(divide_error) +SYM_CODE_START(divide_error) ENDBR64 pushq $0 movl $TRAP_divide_error,4(%rsp) jmp handle_exception +SYM_CODE_END(divide_error) -ENTRY(coprocessor_error) +SYM_CODE_START(coprocessor_error) ENDBR64 pushq $0 movl $TRAP_copro_error,4(%rsp) jmp handle_exception +SYM_CODE_END(coprocessor_error) -ENTRY(simd_coprocessor_error) +SYM_CODE_START(simd_coprocessor_error) ENDBR64 pushq $0 movl $TRAP_simd_error,4(%rsp) jmp handle_exception +SYM_CODE_END(simd_coprocessor_error) -ENTRY(device_not_available) +SYM_CODE_START(device_not_available) ENDBR64 pushq $0 movl $TRAP_no_device,4(%rsp) jmp handle_exception +SYM_CODE_END(device_not_available) -ENTRY(debug) +SYM_CODE_START(debug) ENDBR64 pushq $0 movl $TRAP_debug,4(%rsp) jmp handle_ist_exception +SYM_CODE_END(debug) -ENTRY(int3) +SYM_CODE_START(int3) ENDBR64 pushq $0 movl $TRAP_int3,4(%rsp) jmp handle_exception +SYM_CODE_END(int3) -ENTRY(overflow) +SYM_CODE_START(overflow) ENDBR64 pushq $0 movl $TRAP_overflow,4(%rsp) jmp handle_exception +SYM_CODE_END(overflow) -ENTRY(bounds) +SYM_CODE_START(bounds) ENDBR64 pushq $0 movl $TRAP_bounds,4(%rsp) jmp handle_exception +SYM_CODE_END(bounds) -ENTRY(invalid_op) +SYM_CODE_START(invalid_op) ENDBR64 pushq $0 movl $TRAP_invalid_op,4(%rsp) jmp handle_exception +SYM_CODE_END(invalid_op) -ENTRY(invalid_TSS) +SYM_CODE_START(invalid_TSS) ENDBR64 movl $TRAP_invalid_tss,4(%rsp) jmp handle_exception +SYM_CODE_END(invalid_TSS) -ENTRY(segment_not_present) +SYM_CODE_START(segment_not_present) ENDBR64 movl $TRAP_no_segment,4(%rsp) jmp handle_exception +SYM_CODE_END(segment_not_present) -ENTRY(stack_segment) +SYM_CODE_START(stack_segment) ENDBR64 movl $TRAP_stack_error,4(%rsp) jmp handle_exception +SYM_CODE_END(stack_segment) -ENTRY(general_protection) +SYM_CODE_START(general_protection) ENDBR64 movl $TRAP_gp_fault,4(%rsp) jmp handle_exception +SYM_CODE_END(general_protection) -ENTRY(alignment_check) +SYM_CODE_START(alignment_check) ENDBR64 movl $TRAP_alignment_check,4(%rsp) jmp handle_exception +SYM_CODE_END(alignment_check) -ENTRY(entry_CP) +SYM_CODE_START(entry_CP) ENDBR64 movl $X86_EXC_CP, 4(%rsp) jmp handle_exception +SYM_CODE_END(entry_CP) -ENTRY(double_fault) +SYM_CODE_START(double_fault) ENDBR64 movl $TRAP_double_fault,4(%rsp) /* Set AC to reduce chance of further SMAP faults */ @@ -990,12 +1017,13 @@ ENTRY(double_fault) movq %rsp,%rdi call do_double_fault BUG /* do_double_fault() shouldn't return. */ +SYM_CODE_END(double_fault) -ENTRY(nmi) +SYM_CODE_START(nmi) ENDBR64 pushq $0 movl $TRAP_nmi,4(%rsp) -handle_ist_exception: +SYM_INNER_LABEL_LOCAL(handle_ist_exception) ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP SAVE_ALL @@ -1119,17 +1147,20 @@ handle_ist_exception: ASSERT_CONTEXT_IS_XEN jmp restore_all_xen #endif +SYM_CODE_END(nmi) -ENTRY(machine_check) +SYM_CODE_START(machine_check) ENDBR64 pushq $0 movl $TRAP_machine_check,4(%rsp) jmp handle_ist_exception +SYM_CODE_END(machine_check) /* No op trap handler. Required for kexec crash path. */ -GLOBAL(trap_nop) +SYM_CODE_START_NOALIGN(trap_nop) ENDBR64 iretq +SYM_CODE_END(trap_nop) /* Table of automatically generated entry points. One per vector. */ .pushsection .init.rodata, "a", @progbits @@ -1142,7 +1173,8 @@ GLOBAL(autogen_entrypoints) .endm .popsection -autogen_stubs: /* Automatically generated stubs. */ +/* Automatically generated stubs. */ +SYM_CODE_START_LOCAL(autogen_stubs) vec = 0 .rept X86_NR_VECTORS @@ -1186,6 +1218,7 @@ autogen_stubs: /* Automatically generated stubs. */ vec = vec + 1 .endr +SYM_CODE_END(autogen_stubs) .section .init.rodata, "a", @progbits .size autogen_entrypoints, . - autogen_entrypoints diff --git a/xen/arch/x86/x86_64/kexec_reloc.S b/xen/arch/x86/x86_64/kexec_reloc.S index f4842025eb..5f96c74085 100644 --- a/xen/arch/x86/x86_64/kexec_reloc.S +++ b/xen/arch/x86/x86_64/kexec_reloc.S @@ -14,6 +14,7 @@ .file __FILE__ #include +#include #include #include @@ -24,7 +25,7 @@ .align PAGE_SIZE .code64 -ENTRY(kexec_reloc) +SYM_FUNC_START(kexec_reloc) /* %rdi - code page maddr */ /* %rsi - page table maddr */ /* %rdx - indirection page maddr */ @@ -92,8 +93,9 @@ ENTRY(kexec_reloc) /* Enter compatibility mode. */ ljmp *compatibility_mode_far(%rip) +SYM_FUNC_END(kexec_reloc) -relocate_pages: +SYM_FUNC_START_LOCAL(relocate_pages) /* %rdi - indirection page maddr */ pushq %rbx @@ -141,8 +143,9 @@ relocate_pages: ret .code32 +SYM_FUNC_END(relocate_pages) -compatibility_mode: +SYM_FUNC_START_LOCAL(compatibility_mode) /* Setup some sane segments. */ movl $0x0008, %eax movl %eax, %ds @@ -169,46 +172,34 @@ compatibility_mode: /* Call the image entry point. This should never return. */ call *%ebp ud2 +SYM_FUNC_END(compatibility_mode) - .align 4 -compatibility_mode_far: +SYM_DATA_START_LOCAL(compatibility_mode_far) .long 0x00000000 /* set in call_32_bit above */ .word 0x0010 +SYM_DATA_END(compatibility_mode_far) - .type compatibility_mode_far, @object - .size compatibility_mode_far, . - compatibility_mode_far - -compat_mode_gdt_desc: +SYM_DATA_START_LOCAL(compat_mode_gdt_desc) .word .Lcompat_mode_gdt_end - compat_mode_gdt -1 .quad 0x0000000000000000 /* set in call_32_bit above */ +SYM_DATA_END(compat_mode_gdt_desc) - .type compat_mode_gdt_desc, @object - .size compat_mode_gdt_desc, . - compat_mode_gdt_desc - - .align 8 -compat_mode_gdt: +SYM_DATA_START_LOCAL(compat_mode_gdt) .quad 0x0000000000000000 /* null */ .quad 0x00cf93000000ffff /* 0x0008 ring 0 data */ .quad 0x00cf9b000000ffff /* 0x0010 ring 0 code, compatibility */ .Lcompat_mode_gdt_end: +SYM_DATA_END(compat_mode_gdt) - .type compat_mode_gdt, @object - .size compat_mode_gdt, . - compat_mode_gdt - -compat_mode_idt: +SYM_DATA_START_LOCAL(compat_mode_idt) .word 0 /* limit */ .long 0 /* base */ - - .type compat_mode_idt, @object - .size compat_mode_idt, . - compat_mode_idt +SYM_DATA_END(compat_mode_idt) /* * 16 words of stack are more than enough. */ - .align 8 -reloc_stack: +SYM_DATA_START_LOCAL(reloc_stack) .fill 16,8,0 .Lreloc_stack_base: - - .type reloc_stack, @object - .size reloc_stack, . - reloc_stack +SYM_DATA_END(reloc_stack)