[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/2] xen/x86: Introduce and use GLOBAL() in asm code.
Also clean up some cases of misused/opencoded ENTRY() Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CC: Keir Fraser <keir@xxxxxxx> CC: Jan Beulich <JBeulich@xxxxxxxx> --- There is an awkward case with 'saved_magic' in wakeup_prot.S which could technically have the .align subsumed into it and become an ENTRY(). It is very definitely data rather than code, so GLOBAL() felt more appropriate. There were several ENTRY() data symbols (stack_start, boot_cpu_{compat_,}_gdt_table) which had redundant/useless aligns, so also got converted to GLOBAL(). --- xen/arch/x86/acpi/wakeup_prot.S | 10 +++++----- xen/arch/x86/boot/edd.S | 10 ++++------ xen/arch/x86/boot/head.S | 9 +++------ xen/arch/x86/boot/mem.S | 9 ++++----- xen/arch/x86/boot/trampoline.S | 15 +++++---------- xen/arch/x86/boot/video.S | 23 +++++++++++++---------- xen/arch/x86/boot/wakeup.S | 7 ++++--- xen/arch/x86/boot/x86_64.S | 29 +++++++++++------------------ xen/arch/x86/efi/relocs-dummy.S | 5 ++--- xen/arch/x86/hvm/svm/entry.S | 3 +-- xen/arch/x86/hvm/vmx/entry.S | 7 ++----- xen/arch/x86/x86_64/entry.S | 13 ++++--------- xen/include/asm-x86/config.h | 3 +++ 13 files changed, 61 insertions(+), 82 deletions(-) diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_prot.S index a1e706e..def86d2 100644 --- a/xen/arch/x86/acpi/wakeup_prot.S +++ b/xen/arch/x86/acpi/wakeup_prot.S @@ -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 diff --git a/xen/arch/x86/boot/edd.S b/xen/arch/x86/boot/edd.S index 2c8df8c..5c80da6 100644 --- a/xen/arch/x86/boot/edd.S +++ b/xen/arch/x86/boot/edd.S @@ -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 diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index d3cbddb..b12eefb 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -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. */ diff --git a/xen/arch/x86/boot/mem.S b/xen/arch/x86/boot/mem.S index 64646205..820aea9 100644 --- a/xen/arch/x86/boot/mem.S +++ b/xen/arch/x86/boot/mem.S @@ -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 diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S index f84ce2a..827f412 100644 --- a/xen/arch/x86/boot/trampoline.S +++ b/xen/arch/x86/boot/trampoline.S @@ -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 diff --git a/xen/arch/x86/boot/video.S b/xen/arch/x86/boot/video.S index ad6514e..b238bf3 100644 --- a/xen/arch/x86/boot/video.S +++ b/xen/arch/x86/boot/video.S @@ -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 diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S index b1d4787..a3883c1 100644 --- a/xen/arch/x86/boot/wakeup.S +++ b/xen/arch/x86/boot/wakeup.S @@ -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 - . diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S index ed3888d..8f92402 100644 --- a/xen/arch/x86/boot/x86_64.S +++ b/xen/arch/x86/boot/x86_64.S @@ -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) diff --git a/xen/arch/x86/efi/relocs-dummy.S b/xen/arch/x86/efi/relocs-dummy.S index 36c3006..b14c499 100644 --- a/xen/arch/x86/efi/relocs-dummy.S +++ b/xen/arch/x86/efi/relocs-dummy.S @@ -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 diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S index 1969629..a9d48ae 100644 --- a/xen/arch/x86/hvm/svm/entry.S +++ b/xen/arch/x86/hvm/svm/entry.S @@ -134,8 +134,7 @@ UNLIKELY_END(svm_trace) #endif STGI -.globl svm_stgi_label -svm_stgi_label: +GLOBAL(svm_stgi_label) mov %rsp,%rdi call svm_vmexit_handler jmp svm_asm_do_resume diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S index 496a62c..e80c30b 100644 --- a/xen/arch/x86/hvm/vmx/entry.S +++ b/xen/arch/x86/hvm/vmx/entry.S @@ -36,9 +36,7 @@ #define GUEST_RIP 0x681e #define GUEST_RFLAGS 0x6820 - ALIGN -.globl vmx_asm_vmexit_handler -vmx_asm_vmexit_handler: +ENTRY(vmx_asm_vmexit_handler) push %rdi push %rsi push %rdx @@ -87,8 +85,7 @@ vmx_asm_vmexit_handler: mov %rsp,%rdi call vmx_vmexit_handler -.globl vmx_asm_do_vmentry -vmx_asm_do_vmentry: +GLOBAL(vmx_asm_do_vmentry) call vmx_intr_assist call nvmx_switch_guest ASSERT_NOT_IN_ATOMIC diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S index 5beeccb..f64e871 100644 --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S @@ -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 diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h index f387cd6..cc42a88 100644 --- a/xen/include/asm-x86/config.h +++ b/xen/include/asm-x86/config.h @@ -80,6 +80,9 @@ .globl name; \ ALIGN; \ name: +#define GLOBAL(name) \ + .globl name; \ + name: #endif #define NR_hypercalls 64 -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |