All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH 2/2] x86: annotate entry points with type and size
Date: Tue, 12 Apr 2022 12:28:07 +0200	[thread overview]
Message-ID: <531ab7f7-ce5a-12b2-e7e7-528c26f9ff7f@suse.com> (raw)
In-Reply-To: <e4bf47ca-2ae6-1fd4-56a6-e4e777150b64@suse.com>

Future gas versions will generate minimalistic Dwarf debug info for
items annotated as functions and having their sizes specified [1].
"Borrow" Arm's END() and ENDPROC() to avoid open-coding (and perhaps
typo-ing) the respective directives.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

[1] https://sourceware.org/git?p=binutils-gdb.git;a=commitdiff;h=591cc9fbbfd6d51131c0f1d4a92e7893edcc7a28

--- a/xen/arch/x86/include/asm/config.h
+++ b/xen/arch/x86/include/asm/config.h
@@ -53,6 +53,11 @@
 #define GLOBAL(name)                            \
   .globl name;                                  \
   name:
+#define END(name)                               \
+  .size name, . - name
+#define ENDPROC(name)                           \
+  .type name, @function;                        \
+  END(name)
 #endif
 
 #define NR_hypercalls 64
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -27,6 +27,7 @@ ENTRY(entry_int82)
 
         mov   %rsp, %rdi
         call  do_entry_int82
+ENDPROC(entry_int82)
 
 /* %rbx: struct vcpu */
 ENTRY(compat_test_all_events)
@@ -116,6 +117,7 @@ compat_process_trap:
         leaq  VCPU_trap_bounce(%rbx),%rdx
         call  compat_create_bounce_frame
         jmp   compat_test_all_events
+ENDPROC(compat_test_all_events)
 
 /* %rbx: struct vcpu, interrupts disabled */
 ENTRY(compat_restore_all_guest)
@@ -161,6 +163,7 @@ ENTRY(compat_restore_all_guest)
         RESTORE_ALL adj=8 compat=1
 .Lft0:  iretq
         _ASM_PRE_EXTABLE(.Lft0, handle_exception)
+ENDPROC(compat_restore_all_guest)
 
 /* This mustn't modify registers other than %rax. */
 ENTRY(cr4_pv32_restore)
@@ -193,6 +196,7 @@ ENTRY(cr4_pv32_restore)
         pop   %rdx
         xor   %eax, %eax
         ret
+ENDPROC(cr4_pv32_restore)
 
 ENTRY(compat_syscall)
         /* Fix up reported %cs/%ss for compat domains. */
@@ -222,6 +226,7 @@ UNLIKELY_END(compat_syscall_gpf)
         movw  %si,TRAPBOUNCE_cs(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
         jmp   .Lcompat_bounce_exception
+ENDPROC(compat_syscall)
 
 ENTRY(compat_sysenter)
         CR4_PV32_RESTORE
@@ -236,11 +241,13 @@ ENTRY(compat_sysenter)
         movw  %ax,TRAPBOUNCE_cs(%rdx)
         call  compat_create_bounce_frame
         jmp   compat_test_all_events
+ENDPROC(compat_sysenter)
 
 ENTRY(compat_int80_direct_trap)
         CR4_PV32_RESTORE
         call  compat_create_bounce_frame
         jmp   compat_test_all_events
+ENDPROC(compat_int80_direct_trap)
 
 /* CREATE A BASIC EXCEPTION FRAME ON GUEST OS (RING-1) STACK:            */
 /*   {[ERRCODE,] EIP, CS, EFLAGS, [ESP, SS]}                             */
@@ -352,3 +359,4 @@ compat_crash_page_fault:
         jmp   .Lft14
 .previous
         _ASM_EXTABLE(.Lft14, .Lfx14)
+ENDPROC(compat_create_bounce_frame)
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -139,6 +139,7 @@ process_trap:
         leaq VCPU_trap_bounce(%rbx), %rdx
         call create_bounce_frame
         jmp  test_all_events
+ENDPROC(switch_to_kernel)
 
         .section .text.entry, "ax", @progbits
 
@@ -230,6 +231,7 @@ iret_exit_to_guest:
         addq  $8,%rsp
 .Lft0:  iretq
         _ASM_PRE_EXTABLE(.Lft0, handle_exception)
+ENDPROC(restore_all_guest)
 
 /*
  * When entering SYSCALL from kernel mode:
@@ -281,6 +283,7 @@ ENTRY(lstar_enter)
         mov   %rsp, %rdi
         call  pv_hypercall
         jmp   test_all_events
+ENDPROC(lstar_enter)
 
 /* See lstar_enter for entry register state. */
 ENTRY(cstar_enter)
@@ -320,6 +323,7 @@ ENTRY(cstar_enter)
         jne   compat_syscall
 #endif
         jmp   switch_to_kernel
+ENDPROC(cstar_enter)
 
 ENTRY(sysenter_entry)
         ENDBR64
@@ -384,6 +388,7 @@ UNLIKELY_END(sysenter_gpf)
         jne   compat_sysenter
 #endif
         jmp   .Lbounce_exception
+ENDPROC(sysenter_entry)
 
 ENTRY(int80_direct_trap)
         ENDBR64
@@ -473,6 +478,7 @@ int80_slow_path:
          */
         GET_STACK_END(14)
         jmp   handle_exception_saved
+ENDPROC(int80_direct_trap)
 
         /* create_bounce_frame & helpers don't need to be in .text.entry */
         .text
@@ -617,6 +623,7 @@ ENTRY(dom_crash_sync_extable)
         xorl  %edi,%edi
         jmp   asm_domain_crash_synchronous /* Does not return */
         .popsection
+ENDPROC(create_bounce_frame)
 #endif /* CONFIG_PV */
 
 /* --- CODE BELOW THIS LINE (MOSTLY) NOT GUEST RELATED --- */
@@ -640,10 +647,12 @@ ret_from_intr:
 #else
         jmp   test_all_events
 #endif
+ENDPROC(continue_pv_domain)
 #else
 ret_from_intr:
         ASSERT_CONTEXT_IS_XEN
         jmp   restore_all_xen
+ENDPROC(ret_from_intr)
 #endif
 
         .section .text.entry, "ax", @progbits
@@ -667,6 +676,7 @@ UNLIKELY_END(exit_cr3)
 
         RESTORE_ALL adj=8
         iretq
+ENDPROC(restore_all_xen)
 
 ENTRY(common_interrupt)
         ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP
@@ -697,10 +707,12 @@ ENTRY(common_interrupt)
         mov   %r15, STACK_CPUINFO_FIELD(xen_cr3)(%r14)
         mov   %bl, STACK_CPUINFO_FIELD(use_pv_cr3)(%r14)
         jmp ret_from_intr
+ENDPROC(common_interrupt)
 
 ENTRY(page_fault)
         ENDBR64
         movl  $TRAP_page_fault,4(%rsp)
+ENDPROC(page_fault)
 /* No special register assumptions. */
 GLOBAL(handle_exception)
         ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP
@@ -872,12 +884,14 @@ FATAL_exception_with_ints_disabled:
         movq  %rsp,%rdi
         call  fatal_trap
         BUG   /* fatal_trap() shouldn't return. */
+ENDPROC(handle_exception)
 
 ENTRY(divide_error)
         ENDBR64
         pushq $0
         movl  $TRAP_divide_error,4(%rsp)
         jmp   handle_exception
+ENDPROC(divide_error)
 
 ENTRY(coprocessor_error)
         ENDBR64
@@ -890,72 +904,85 @@ ENTRY(simd_coprocessor_error)
         pushq $0
         movl  $TRAP_simd_error,4(%rsp)
         jmp   handle_exception
+ENDPROC(coprocessor_error)
 
 ENTRY(device_not_available)
         ENDBR64
         pushq $0
         movl  $TRAP_no_device,4(%rsp)
         jmp   handle_exception
+ENDPROC(device_not_available)
 
 ENTRY(debug)
         ENDBR64
         pushq $0
         movl  $TRAP_debug,4(%rsp)
         jmp   handle_ist_exception
+ENDPROC(debug)
 
 ENTRY(int3)
         ENDBR64
         pushq $0
         movl  $TRAP_int3,4(%rsp)
         jmp   handle_exception
+ENDPROC(int3)
 
 ENTRY(overflow)
         ENDBR64
         pushq $0
         movl  $TRAP_overflow,4(%rsp)
         jmp   handle_exception
+ENDPROC(overflow)
 
 ENTRY(bounds)
         ENDBR64
         pushq $0
         movl  $TRAP_bounds,4(%rsp)
         jmp   handle_exception
+ENDPROC(bounds)
 
 ENTRY(invalid_op)
         ENDBR64
         pushq $0
         movl  $TRAP_invalid_op,4(%rsp)
         jmp   handle_exception
+ENDPROC(invalid_op)
 
 ENTRY(invalid_TSS)
         ENDBR64
         movl  $TRAP_invalid_tss,4(%rsp)
         jmp   handle_exception
+ENDPROC(invalid_TSS)
 
 ENTRY(segment_not_present)
         ENDBR64
         movl  $TRAP_no_segment,4(%rsp)
         jmp   handle_exception
+ENDPROC(segment_not_present)
 
 ENTRY(stack_segment)
         ENDBR64
         movl  $TRAP_stack_error,4(%rsp)
         jmp   handle_exception
+ENDPROC(stack_segment)
 
 ENTRY(general_protection)
         ENDBR64
         movl  $TRAP_gp_fault,4(%rsp)
         jmp   handle_exception
+ENDPROC(general_protection)
 
 ENTRY(alignment_check)
         ENDBR64
         movl  $TRAP_alignment_check,4(%rsp)
         jmp   handle_exception
+ENDPROC(alignment_check)
 
 ENTRY(entry_CP)
         ENDBR64
         movl  $X86_EXC_CP, 4(%rsp)
         jmp   handle_exception
+ENDPROC(entry_CP)
 
 ENTRY(double_fault)
         ENDBR64
@@ -981,6 +1008,7 @@ ENTRY(double_fault)
         movq  %rsp,%rdi
         call  do_double_fault
         BUG   /* do_double_fault() shouldn't return. */
+ENDPROC(double_fault)
 
         .pushsection .init.text, "ax", @progbits
 ENTRY(early_page_fault)
@@ -990,6 +1018,7 @@ ENTRY(early_page_fault)
         movq  %rsp,%rdi
         call  do_early_page_fault
         jmp   restore_all_xen
+ENDPROC(early_page_fault)
         .popsection
 
 ENTRY(nmi)
@@ -1120,17 +1149,20 @@ handle_ist_exception:
         ASSERT_CONTEXT_IS_XEN
         jmp   restore_all_xen
 #endif
+ENDPROC(nmi)
 
 ENTRY(machine_check)
         ENDBR64
         pushq $0
         movl  $TRAP_machine_check,4(%rsp)
         jmp   handle_ist_exception
+ENDPROC(machine_check)
 
 /* No op trap handler.  Required for kexec crash path. */
 GLOBAL(trap_nop)
         ENDBR64
         iretq
+ENDPROC(trap_nop)
 
 /* Table of automatically generated entry points.  One per vector. */
         .pushsection .init.rodata, "a", @progbits
@@ -1187,6 +1219,7 @@ autogen_stubs: /* Automatically generate
 
         vec = vec + 1
         .endr
+ENDPROC(autogen_stubs)
 
         .section .init.rodata, "a", @progbits
-        .size autogen_entrypoints, . - autogen_entrypoints
+        END(autogen_entrypoints)



  parent reply	other threads:[~2022-04-12 10:28 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 10:25 [PATCH 0/2] x86: aid debug info generation in assembly files Jan Beulich
2022-04-12 10:27 ` [PATCH 1/2] x86: improve .debug_line contents for assembly sources Jan Beulich
2022-04-14 12:40   ` Roger Pau Monné
2022-04-14 12:52     ` Jan Beulich
2022-04-14 13:31       ` Roger Pau Monné
2022-04-14 13:36         ` Roger Pau Monné
2022-04-14 14:15         ` Jan Beulich
2022-04-14 16:02           ` Roger Pau Monné
2022-04-14 16:34             ` Jan Beulich
2022-04-26  9:26             ` Jan Beulich
2022-04-12 10:28 ` Jan Beulich [this message]
2022-04-14 12:49   ` [PATCH 2/2] x86: annotate entry points with type and size Andrew Cooper
2022-04-14 12:59     ` Jan Beulich
2022-06-23 11:47       ` Jan Beulich
2023-05-23 11:30 ` [PATCH v2 0/2] " Jan Beulich
2023-05-23 11:30   ` [PATCH v2 1/2] " Jan Beulich
2023-05-29 13:34     ` Roger Pau Monné
2023-05-30  8:06       ` Jan Beulich
2023-05-30 13:21         ` Roger Pau Monné
2023-05-30 14:23           ` Jan Beulich
2023-05-30 15:15             ` Roger Pau Monné
2023-05-23 11:31   ` [PATCH v2 2/2] x86: also mark assembler globals hidden Jan Beulich
2023-05-29 13:38     ` Roger Pau Monné
2023-07-10  8:50 ` [PATCH v3 0/8] annotate entry points with type and size Jan Beulich
2023-07-10  8:51   ` [PATCH v3 1/8] common: move a few macros out of xen/lib.h Jan Beulich
2023-07-18 15:40     ` Oleksii
2023-07-18 19:49     ` Shawn Anastasio
2023-07-19  6:28       ` Jan Beulich
2023-07-10  8:52   ` [PATCH v3 2/8] common: assembly entry point type/size annotations Jan Beulich
2023-07-10  9:28     ` Jan Beulich
2023-07-10  8:53   ` [PATCH v3 3/8] x86: annotate entry points with type and size Jan Beulich
2023-07-10  8:54   ` [PATCH v3 4/8] x86: also mark assembler globals hidden Jan Beulich
2023-07-10  8:55   ` [PATCH v3 5/8] Arm: annotate entry points with type and size Jan Beulich
2023-07-10  8:56   ` [PATCH v3 6/8] RISC-V: " Jan Beulich
2023-07-10  8:58     ` Jan Beulich
2023-07-26 15:28       ` Oleksii
2023-07-26 15:43         ` Jan Beulich
2023-07-26 16:55           ` Oleksii
2023-07-10  8:56   ` [PATCH v3 7/8] PPC: switch entry point annotations to common model Jan Beulich
2023-07-10  8:57   ` [PATCH v3 8/8] tools/binfile: switch to common annotations model Jan Beulich
2023-07-17 14:18   ` [PATCH v3 9/8] common: honor CONFIG_CC_SPLIT_SECTIONS also for assembly functions Jan Beulich
2023-07-18 12:28     ` Jan Beulich
2023-08-04  6:24 ` [PATCH v4 0/8] annotate entry points with type and size Jan Beulich
2023-08-04  6:26   ` [PATCH v4 1/8] common: assembly entry point type/size annotations Jan Beulich
2023-09-14 21:06     ` Julien Grall
2023-09-18 10:24       ` Jan Beulich
2023-09-18 10:34         ` Julien Grall
2023-09-18 10:51           ` Jan Beulich
2023-08-04  6:26   ` [PATCH v4 2/8] x86: annotate entry points with type and size Jan Beulich
2023-08-04  6:27   ` [PATCH v4 3/8] x86: also mark assembler globals hidden Jan Beulich
2023-08-04  6:28   ` [PATCH v4 4/8] Arm: annotate entry points with type and size Jan Beulich
2023-09-14 21:25     ` Julien Grall
2023-09-15  7:00       ` Jan Beulich
2023-08-04  6:29   ` [PATCH v4 5/8] RISC-V: " Jan Beulich
2023-08-04  6:30   ` [PATCH v4 5/8] PPC: switch entry point annotations to common model Jan Beulich
2023-08-04  6:30   ` [PATCH v4 6/8] tools/binfile: switch to common annotations model Jan Beulich
2023-09-14 21:30     ` Julien Grall
2023-08-04  6:31   ` [PATCH v4 8/8] common: honor CONFIG_CC_SPLIT_SECTIONS also for assembly functions Jan Beulich
2023-08-04  6:32   ` [PATCH v4 0/8] annotate entry points with type and size Jan Beulich
2024-01-15 14:30 ` [PATCH v5 " Jan Beulich
2024-01-15 14:34   ` [PATCH v5 1/8] common: assembly entry point type/size annotations Jan Beulich
2024-01-17 17:02     ` Roger Pau Monné
2024-01-18 15:48       ` Jan Beulich
2024-01-18 14:52     ` Roger Pau Monné
2024-01-18 16:00       ` Jan Beulich
2024-01-15 14:34   ` [PATCH v5 2/8] x86: annotate entry points with type and size Jan Beulich
2024-01-18 17:45     ` Roger Pau Monné
2024-01-19  8:06       ` Jan Beulich
2024-01-19  9:48     ` Roger Pau Monné
2024-01-15 14:35   ` [PATCH v5 3/8] x86: also mark assembler globals hidden Jan Beulich
2024-01-15 14:36   ` [PATCH v5 4/8] Arm: annotate entry points with type and size Jan Beulich
2024-01-22 13:22     ` Jan Beulich
2024-03-15 19:09       ` Julien Grall
2024-01-15 14:37   ` [PATCH v5 5/8] RISC-V: " Jan Beulich
2024-01-16 12:15     ` Oleksii
2024-01-15 14:38   ` [PATCH v5 6/8] PPC: switch entry point annotations to common model Jan Beulich
2024-01-22 13:20     ` Ping: " Jan Beulich
2024-01-23  3:00       ` Shawn Anastasio
2024-01-15 14:39   ` [PATCH v5 7/8] tools/binfile: switch to common annotations model Jan Beulich
2024-01-15 14:40   ` [PATCH v5 8/8] common: honor CONFIG_CC_SPLIT_SECTIONS also for assembly functions Jan Beulich
2024-01-19 10:36     ` Roger Pau Monné
2024-01-22 10:50       ` Jan Beulich
2024-01-22 17:40         ` Roger Pau Monné
2024-02-07 13:34 ` [PATCH v6 7/7] (mostly) x86: add/convert entry point annotations Jan Beulich
2024-02-07 13:35   ` [PATCH v6 0/7] " Jan Beulich
2024-02-07 13:36   ` [PATCH v6 1/7] common: honor CONFIG_CC_SPLIT_SECTIONS also for assembly functions Jan Beulich
2024-02-07 13:37   ` [PATCH v6 2/7] SVM: convert entry point annotations Jan Beulich
2024-02-07 13:48     ` Andrew Cooper
2024-02-07 13:37   ` [PATCH v6 3/7] VMX: " Jan Beulich
2024-02-07 13:55     ` Andrew Cooper
2024-02-07 14:25       ` Jan Beulich
2024-02-08 16:20         ` Jan Beulich
2024-02-07 13:37   ` [PATCH v6 4/7] x86/ACPI: annotate assembly functions with type and size Jan Beulich
2024-02-07 14:00     ` Andrew Cooper
2024-02-07 13:38   ` [PATCH v6 5/7] x86/kexec: convert entry point annotations Jan Beulich
2024-02-07 14:05     ` Andrew Cooper
2024-02-07 13:38   ` [PATCH v6 6/7] x86: convert misc assembly function annotations Jan Beulich
2024-02-07 14:11     ` Andrew Cooper
2024-02-07 13:39   ` [PATCH v6 7/7] x86: move ENTRY(), GLOBAL(), and ALIGN Jan Beulich
2024-02-07 14:27     ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=531ab7f7-ce5a-12b2-e7e7-528c26f9ff7f@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.