x86: Introduce and use GLOBAL() in asm code
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 9 Sep 2013 08:25:40 +0000 (10:25 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 9 Sep 2013 08:25:40 +0000 (10:25 +0200)
Also clean up some cases of misused/opencoded ENTRY()

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
12 files changed:
xen/arch/x86/acpi/wakeup_prot.S
xen/arch/x86/boot/edd.S
xen/arch/x86/boot/head.S
xen/arch/x86/boot/mem.S
xen/arch/x86/boot/trampoline.S
xen/arch/x86/boot/video.S
xen/arch/x86/boot/wakeup.S
xen/arch/x86/boot/x86_64.S
xen/arch/x86/efi/relocs-dummy.S
xen/arch/x86/hvm/svm/entry.S
xen/arch/x86/x86_64/entry.S
xen/include/asm-x86/config.h

index a1e706e2c867c2453bee64d93cd9b9f5d7334e0b..def86d2f45725a8f6ce2608a81497c532c770398 100644 (file)
@@ -64,9 +64,8 @@ ENTRY(do_suspend_lowlevel)
         call    acpi_enter_sleep_state
         jmp     __ret_point
 
-        .align  16
-        .globl  __ret_point
-__ret_point:
+
+ENTRY(__ret_point)
 
         /* mmu_cr4_features contains latest cr4 setting */
         mov     REF(mmu_cr4_features), GREG(ax)
@@ -118,8 +117,9 @@ __ret_point:
 
 .data
         .align 16
-        .globl   saved_magic
-saved_magic:     .long   0x9abcdef0
+
+GLOBAL(saved_magic)
+        .long   0x9abcdef0
 
 saved_ss:        .word   0
 
index 2c8df8ccc85e777d60e46a6c4b063dfef72e64e4..5c80da64390657f4620c243cc0286d706c47ab9c 100644 (file)
@@ -145,13 +145,11 @@ edd_done:
 opt_edd:
         .byte   0                               # edd=on/off/skipmbr
 
-.globl  boot_edd_info, boot_edd_info_nr
-.globl  boot_mbr_signature, boot_mbr_signature_nr
-boot_edd_info_nr:
+GLOBAL(boot_edd_info_nr)
         .byte   0
-boot_mbr_signature_nr:
+GLOBAL(boot_mbr_signature_nr)
         .byte   0
-boot_mbr_signature:
+GLOBAL(boot_mbr_signature)
         .fill   EDD_MBR_SIG_MAX*8,1,0
-boot_edd_info:
+GLOBAL(boot_edd_info)
         .fill   512,1,0                         # big enough for a disc sector
index d3cbddb3498eef24044381f36d7019be15d10ee5..b12eefb8bef7dab03e4cb7542c4ead403770c622 100644 (file)
@@ -195,11 +195,9 @@ __start:
 reloc:
 #include "reloc.S"
 
-        .align 16
-        .globl trampoline_start, trampoline_end
-trampoline_start:
+ENTRY(trampoline_start)
 #include "trampoline.S"
-trampoline_end:
+GLOBAL(trampoline_end)
 
         .text
 __high_start:
@@ -212,8 +210,7 @@ __high_start:
  * to avoid type conflicts with fixed-range MTRRs covering the lowest megabyte
  * of physical memory. In any case the VGA hole should be mapped with type UC.
  */
-        .globl l1_identmap
-l1_identmap:
+GLOBAL(l1_identmap)
         pfn = 0
         .rept L1_PAGETABLE_ENTRIES
         /* VGA hole (0xa0000-0xc0000) should be mapped UC. */
index 646462053db8413de93e9ad12d6dbe48f218ae60..820aea94166aa9fda0df52a21e7d66b7a452b54d 100644 (file)
@@ -67,12 +67,11 @@ get_memory_map:
 
         ret
 
-        .globl e820map, e820nr, lowmem_kb, highmem_kb
-e820map:
+GLOBAL(e820map)
         .fill   E820MAX*20,1,0
-e820nr:
+GLOBAL(e820nr)
         .long   0
-lowmem_kb:
+GLOBAL(lowmem_kb)
         .long   0
-highmem_kb:
+GLOBAL(highmem_kb)
         .long   0
index f84ce2a0f5ca5d6c4953b05c3e6b3fcff858a706..827f41219d1a999157643e3e326f21e625c2c433 100644 (file)
@@ -18,8 +18,7 @@
         .long 111b - (off) - .;            \
         .popsection
 
-        .globl trampoline_realmode_entry
-trampoline_realmode_entry:
+GLOBAL(trampoline_realmode_entry)
         mov     %cs,%ax
         mov     %ax,%ds
         movb    $0xA5,bootsym(trampoline_cpu_started)
@@ -57,16 +56,13 @@ trampoline_gdt:
         .long   trampoline_gdt + BOOT_PSEUDORM_DS + 2 - .
         .popsection
 
-        .globl cpuid_ext_features
-cpuid_ext_features:
+GLOBAL(cpuid_ext_features)
         .long   0
 
-        .globl trampoline_xen_phys_start
-trampoline_xen_phys_start:
+GLOBAL(trampoline_xen_phys_start)
         .long   0
 
-        .globl trampoline_cpu_started
-trampoline_cpu_started:
+GLOBAL(trampoline_cpu_started)
         .byte   0
 
         .code32
@@ -206,8 +202,7 @@ trampoline_boot_cpu_entry:
 skip_realmode:
         .byte   0
 
-        .globl kbd_shift_flags
-kbd_shift_flags:
+GLOBAL(kbd_shift_flags)
         .byte   0
 
 rm_idt: .word   256*4-1, 0, 0
index ad6514ebf0dcf8fe8de62a14e0760c7613f561de..b238bf3af5119204160ed11aaa860bcc2488d9b2 100644 (file)
@@ -993,14 +993,17 @@ force_size:     .word   0       # Use this size instead of the one in BIOS vars
 
 vesa_size:      .word   0,0,0   # width x depth x height
 
-                .globl  boot_vid_info, boot_edid_info, boot_edid_caps
 /* If we don't run at all, assume basic video mode 3 at 80x25. */
-boot_vid_mode:  .word   VIDEO_80x25
-boot_vid_info:  .byte   0, 0    /* orig_x, orig_y */
-                .byte   3       /* text mode 3    */
-                .byte   80, 25  /* 80x25          */
-                .byte   1       /* isVGA          */
-                .word   16      /* 8x16 font      */
-                .fill   0x28,1,0
-boot_edid_info: .fill   128,1,0x13
-boot_edid_caps: .word   0x1313
+GLOBAL(boot_vid_mode)
+        .word   VIDEO_80x25
+GLOBAL(boot_vid_info)
+        .byte   0, 0    /* orig_x, orig_y */
+        .byte   3       /* text mode 3    */
+        .byte   80, 25  /* 80x25          */
+        .byte   1       /* isVGA          */
+        .word   16      /* 8x16 font      */
+        .fill   0x28,1,0
+GLOBAL(boot_edid_info)
+        .fill   128,1,0x13
+GLOBAL(boot_edid_caps)
+        .word   0x1313
index b1d4787d2e974b201381f2c533b273282d112fd0..a3883c14311eb3fce8d74e01a8d90687dffcf761 100644 (file)
@@ -98,9 +98,10 @@ bogus_real_magic:
 
         .align 4
 real_magic:     .long 0x12345678
-         .globl video_mode, video_flags
-video_mode:     .long 0
-video_flags:    .long 0
+GLOBAL(video_mode)
+        .long 0
+GLOBAL(video_flags)
+        .long 0
 trampoline_seg: .word 0
         .pushsection .trampoline_seg, "a"
         .long   trampoline_seg - .
index ed3888d4697515292bfda7afc9257b4dd5735cfb..8f9240298230ddf12dcc54335e885a7f5924e1b1 100644 (file)
@@ -84,23 +84,21 @@ multiboot_ptr:
         .long   0
 
         .word   0
-        .globl  gdt_descr
-gdt_descr:
+GLOBAL(gdt_descr)
         .word   LAST_RESERVED_GDT_BYTE
         .quad   boot_cpu_gdt_table - FIRST_RESERVED_GDT_BYTE
 
         .word   0,0,0
-        .globl  idt_descr
-idt_descr:
+GLOBAL(idt_descr)
         .word   256*16-1
         .quad   idt_table
 
-ENTRY(stack_start)
+GLOBAL(stack_start)
         .quad   cpu0_stack
 
         .section .data.page_aligned, "aw", @progbits
         .align PAGE_SIZE, 0
-ENTRY(boot_cpu_gdt_table)
+GLOBAL(boot_cpu_gdt_table)
         .quad 0x0000000000000000     /* unused */
         .quad 0x00af9a000000ffff     /* 0xe008 ring 0 code, 64-bit mode   */
         .quad 0x00cf92000000ffff     /* 0xe010 ring 0 data                */
@@ -115,7 +113,7 @@ ENTRY(boot_cpu_gdt_table)
         .align PAGE_SIZE, 0
 /* NB. Even rings != 0 get access to the full 4Gb, as only the            */
 /*     (compatibility) machine->physical mapping table lives there.       */
-ENTRY(boot_cpu_compat_gdt_table)
+GLOBAL(boot_cpu_compat_gdt_table)
         .quad 0x0000000000000000     /* unused */
         .quad 0x00af9a000000ffff     /* 0xe008 ring 0 code, 64-bit mode   */
         .quad 0x00cf92000000ffff     /* 0xe010 ring 0 data                */
@@ -128,12 +126,10 @@ ENTRY(boot_cpu_compat_gdt_table)
         .quad 0x0000910000000000     /* per-CPU entry (limit == cpu)      */
         .align PAGE_SIZE, 0
 
-       .globl __page_tables_start, __page_tables_end
-__page_tables_start:
+GLOBAL(__page_tables_start)
 
 /* Mapping of first 16 megabytes of memory. */
-        .globl l2_identmap
-l2_identmap:
+GLOBAL(l2_identmap)
         .quad sym_phys(l1_identmap) + __PAGE_HYPERVISOR
         pfn = 0
         .rept 7
@@ -143,8 +139,7 @@ l2_identmap:
         .fill 4 * L2_PAGETABLE_ENTRIES - 8, 8, 0
         .size l2_identmap, . - l2_identmap
 
-        .globl l2_xenmap
-l2_xenmap:
+GLOBAL(l2_xenmap)
         idx = 0
         .rept 8
         .quad sym_phys(__image_base__) + (idx << L2_PAGETABLE_SHIFT) + (PAGE_HYPERVISOR | _PAGE_PSE)
@@ -165,8 +160,7 @@ l2_fixmap:
         .endr
         .size l2_fixmap, . - l2_fixmap
 
-        .globl l3_identmap
-l3_identmap:
+GLOBAL(l3_identmap)
         idx = 0
         .rept 4
         .quad sym_phys(l2_identmap) + (idx << PAGE_SHIFT) + __PAGE_HYPERVISOR
@@ -190,8 +184,7 @@ l3_xenmap:
         .size l3_xenmap, . - l3_xenmap
 
 /* Top-level master (and idle-domain) page directory. */
-        .globl idle_pg_table
-idle_pg_table:
+GLOBAL(idle_pg_table)
         .quad sym_phys(l3_bootmap) + __PAGE_HYPERVISOR
         idx = 1
         .rept L4_PAGETABLE_ENTRIES - 1
@@ -206,4 +199,4 @@ idle_pg_table:
         .endr
         .size idle_pg_table, . - idle_pg_table
 
-__page_tables_end:
+GLOBAL(__page_tables_end)
index 36c30063d285ee3a5bf815d55d3461c5973866ce..b14c4996b0720847daabc03fb64b451dc3a3bc18 100644 (file)
@@ -2,11 +2,10 @@
 
        .section .reloc, "a", @progbits
        .balign 4
-       .globl __base_relocs_start, __base_relocs_end
-__base_relocs_start:
+GLOBAL(__base_relocs_start)
        .long 0
        .long 8
-__base_relocs_end:
+GLOBAL(__base_relocs_end)
 
        .globl VIRT_START, ALT_START
        .equ VIRT_START, XEN_VIRT_START
index 3ee42475e6d396e73ea21f33ac6491a643f0a315..aeddf64984b3ce9d3a9ecd32be11882c8547a9b7 100644 (file)
@@ -127,8 +127,7 @@ UNLIKELY_END(svm_trace)
         mov  %rax,UREGS_eflags(%rsp)
 
         STGI
-.globl svm_stgi_label
-svm_stgi_label:
+GLOBAL(svm_stgi_label)
         mov  %rsp,%rdi
         call svm_vmexit_handler
         jmp  .Lsvm_do_resume
index 5beeccb64794a7b30a686a57fc367449edd695d9..f64e871c7cd46b1eba2044025796d166aa46a9db 100644 (file)
@@ -272,8 +272,7 @@ ENTRY(sysenter_entry)
         pushq $FLAT_USER_SS
         pushq $0
         pushfq
-        .globl sysenter_eflags_saved
-sysenter_eflags_saved:
+GLOBAL(sysenter_eflags_saved)
         pushq $3 /* ring 3 null cs */
         pushq $0 /* null rip */
         pushq $0
@@ -479,8 +478,7 @@ ENTRY(ret_from_intr)
 ENTRY(page_fault)
         movl  $TRAP_page_fault,4(%rsp)
 /* No special register assumptions. */
-       .globl handle_exception
-handle_exception:
+GLOBAL(handle_exception)
         SAVE_ALL
 handle_exception_saved:
         testb $X86_EFLAGS_IF>>8,UREGS_eflags+1(%rsp)
@@ -689,11 +687,8 @@ ENTRY(enable_nmis)
 1:
         retq
 
-/* No op trap handler.  Required for kexec crash path.  This is not
- * declared with the ENTRY() macro to avoid wasted alignment space.
- */
-.globl trap_nop
-trap_nop:
+/* No op trap handler.  Required for kexec crash path. */
+GLOBAL(trap_nop)
         iretq
 
 
index f387cd68f0e32d72ed0fe8e524461df54ba0c7d9..cc42a88e66b22885280a3e36e24c174104d3338c 100644 (file)
@@ -80,6 +80,9 @@
   .globl name;                                  \
   ALIGN;                                        \
   name:
+#define GLOBAL(name)                            \
+  .globl name;                                  \
+  name:
 #endif
 
 #define NR_hypercalls 64