From patchwork Wed Nov 30 13:04:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 9454331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 99B156071E for ; Wed, 30 Nov 2016 13:08:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F5A428417 for ; Wed, 30 Nov 2016 13:08:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83DF42841E; Wed, 30 Nov 2016 13:08:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AE89528417 for ; Wed, 30 Nov 2016 13:08:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cC4aN-0003rw-3L; Wed, 30 Nov 2016 13:06:07 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cC4aL-0003q2-Pp for xen-devel@lists.xenproject.org; Wed, 30 Nov 2016 13:06:05 +0000 Received: from [85.158.143.35] by server-7.bemta-6.messagelabs.com id 9C/26-29519-CBECE385; Wed, 30 Nov 2016 13:06:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRWlGSWpSXmKPExsXSO6nOVXfPObs Ig1nNUhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bapt1MBSvcK2Y/aGRtYOwx7mLk4hASmMgk sWnfUUYI5y+jxM1FS5ggnI2MEh9nN7NClTFKLDjZAZTh5GAT0JG4+OUhO4gtIqAkcW/VZLAOZ oGZTBKn75xkAUkIC7hIbH/UywhiswioSlzonsEMYvMKeEjs6tnCBmJLCChKdD+bAGZzAsWfTr gLNlRIwF3i29JLzBA1hhKfNy5lnsDIt4CRYRWjenFqUVlqka6hXlJRZnpGSW5iZo6uoYGZXm5 qcXFiempOYlKxXnJ+7iZGYLAwAMEOxp3PnQ4xSnIwKYny8nXaRQjxJeWnVGYkFmfEF5XmpBYf YpTh4FCS4M04C5QTLEpNT61Iy8wBhi1MWoKDR0mEtwAkzVtckJhbnJkOkTrFqCglzvvmDFBCA CSRUZoH1waLlUuMslLCvIxAhwjxFKQW5WaWoMq/YhTnYFQS5g0AGc+TmVcCN/0V0GImoMVvX1 uDLC5JREhJNTBG9u08VB32MfDRNxk/oV+1+RFTI7XyyypE1m+VL/rEc46h9f5UsclHmvi3vMu bc+T8+Zj7E3MyYyze29md8Dse+lArUaTb71386oYVG9bNPHLtntehnRPntz+y+tBsbsVW33mo LUNlwRndSX5rb54NX2TwNbr4c4XrnSe8gR0hKRxTeNo+rVVRYinOSDTUYi4qTgQAE7EOlpACA AA= X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-15.tower-21.messagelabs.com!1480511162!45824278!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10982 invoked from network); 30 Nov 2016 13:06:04 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-15.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 30 Nov 2016 13:06:04 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id uAUD5dma022388 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Nov 2016 13:05:40 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id uAUD5dQQ023182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Nov 2016 13:05:39 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id uAUD5ca7010245; Wed, 30 Nov 2016 13:05:38 GMT Received: from olila.local.net-space.pl (/10.175.217.205) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 30 Nov 2016 05:05:38 -0800 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Wed, 30 Nov 2016 14:04:18 +0100 Message-Id: <1480511059-14062-13-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1480511059-14062-1-git-send-email-daniel.kiper@oracle.com> References: <1480511059-14062-1-git-send-email-daniel.kiper@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: jgross@suse.com, sstabellini@kernel.org, andrew.cooper3@citrix.com, cardoe@cardoe.com, pgnet.dev@gmail.com, ning.sun@intel.com, julien.grall@arm.com, jbeulich@suse.com, qiaowei.ren@intel.com, gang.wei@intel.com, fu.wei@linaro.org Subject: [Xen-devel] [PATCH v10 12/13] x86/boot: rename sym_phys() to sym_offs() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This way macro name better describes its function. Currently it is used to calculate symbol offset in relation to the beginning of Xen image mapping. However, value returned by sym_offs() for a given symbol is not always equal its physical address. There is no functional change. Suggested-by: Jan Beulich Signed-off-by: Daniel Kiper Acked-by: Jan Beulich --- v8 - suggestions/fixes: - improve commit message (suggested by Jan Beulich). --- xen/arch/x86/boot/head.S | 38 +++++++++++++++++++------------------- xen/arch/x86/boot/trampoline.S | 2 +- xen/arch/x86/boot/wakeup.S | 4 ++-- xen/arch/x86/boot/x86_64.S | 18 +++++++++--------- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index d992a95..390f72d 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -12,9 +12,9 @@ .text .code32 -#define sym_phys(sym) ((sym) - __XEN_VIRT_START) -#define sym_esi(sym) sym_phys(sym)(%esi) -#define sym_fs(sym) %fs:sym_phys(sym) +#define sym_offs(sym) ((sym) - __XEN_VIRT_START) +#define sym_esi(sym) sym_offs(sym)(%esi) +#define sym_fs(sym) %fs:sym_offs(sym) #define BOOT_CS32 0x0008 #define BOOT_CS64 0x0010 @@ -97,7 +97,7 @@ multiboot2_header_start: /* EFI64 entry point. */ mb2ht_init MB2_HT(ENTRY_ADDRESS_EFI64), MB2_HT(OPTIONAL), \ - sym_phys(__efi64_start) + sym_offs(__efi64_start) /* Multiboot2 header end tag. */ mb2ht_init MB2_HT(END), MB2_HT(REQUIRED) @@ -110,7 +110,7 @@ multiboot2_header_start: gdt_boot_descr: .word 7*8-1 gdt_boot_base: - .long sym_phys(trampoline_gdt) + .long sym_offs(trampoline_gdt) .long 0 /* Needed for 64-bit lgdt */ .align 4 @@ -130,23 +130,23 @@ efi_platform: .section .init.text, "ax", @progbits bad_cpu: - add $sym_phys(.Lbad_cpu_msg),%esi # Error message + add $sym_offs(.Lbad_cpu_msg),%esi # Error message jmp .Lget_vtb not_multiboot: - add $sym_phys(.Lbad_ldr_msg),%esi # Error message + add $sym_offs(.Lbad_ldr_msg),%esi # Error message jmp .Lget_vtb .Lmb2_no_st: - add $sym_phys(.Lbad_ldr_nst),%esi # Error message + add $sym_offs(.Lbad_ldr_nst),%esi # Error message jmp .Lget_vtb .Lmb2_no_ih: - add $sym_phys(.Lbad_ldr_nih),%esi # Error message + add $sym_offs(.Lbad_ldr_nih),%esi # Error message jmp .Lget_vtb .Lmb2_no_bs: - add $sym_phys(.Lbad_ldr_nbs),%esi # Error message + add $sym_offs(.Lbad_ldr_nbs),%esi # Error message xor %edi,%edi # No VGA text buffer jmp .Lsend_chr .Lmb2_efi_ia_32: - add $sym_phys(.Lbad_efi_msg),%esi # Error message + add $sym_offs(.Lbad_efi_msg),%esi # Error message xor %edi,%edi # No VGA text buffer jmp .Lsend_chr .Lget_vtb: @@ -354,7 +354,7 @@ __start: cli /* Load default Xen image load base address. */ - mov $sym_phys(__image_base__),%esi + mov $sym_offs(__image_base__),%esi /* Bootloaders may set multiboot{1,2}.mem_lower to a nonzero value. */ xor %edx,%edx @@ -505,8 +505,8 @@ trampoline_setup: jnz 1f /* Initialize BSS (no nasty surprises!). */ - mov $sym_phys(__bss_start),%edi - mov $sym_phys(__bss_end),%ecx + mov $sym_offs(__bss_start),%edi + mov $sym_offs(__bss_end),%ecx push %fs pop %es sub %edi,%ecx @@ -579,22 +579,22 @@ trampoline_setup: /* Apply relocations to bootstrap trampoline. */ mov sym_fs(trampoline_phys),%edx - mov $sym_phys(__trampoline_rel_start),%edi + mov $sym_offs(__trampoline_rel_start),%edi 1: mov %fs:(%edi),%eax add %edx,%fs:(%edi,%eax) add $4,%edi - cmp $sym_phys(__trampoline_rel_stop),%edi + cmp $sym_offs(__trampoline_rel_stop),%edi jb 1b /* Patch in the trampoline segment. */ shr $4,%edx - mov $sym_phys(__trampoline_seg_start),%edi + mov $sym_offs(__trampoline_seg_start),%edi 1: mov %fs:(%edi),%eax mov %dx,%fs:(%edi,%eax) add $4,%edi - cmp $sym_phys(__trampoline_seg_stop),%edi + cmp $sym_offs(__trampoline_seg_stop),%edi jb 1b /* Do not parse command line on EFI platform here. */ @@ -620,7 +620,7 @@ trampoline_setup: push %eax /* Copy bootstrap trampoline to low memory, below 1MB. */ - mov $sym_phys(trampoline_start),%esi + mov $sym_offs(trampoline_start),%esi mov $((trampoline_end - trampoline_start) / 4),%ecx rep movsl %fs:(%esi),%es:(%edi) diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S index 64f8efd..b96607a 100644 --- a/xen/arch/x86/boot/trampoline.S +++ b/xen/arch/x86/boot/trampoline.S @@ -92,7 +92,7 @@ trampoline_protmode_entry: mov %ecx,%cr4 /* Load pagetable base register. */ - mov $sym_phys(idle_pg_table),%eax + mov $sym_offs(idle_pg_table),%eax add bootsym_rel(trampoline_xen_phys_start,4,%eax) mov %eax,%cr3 diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S index 08ea9b2..42d57ab 100644 --- a/xen/arch/x86/boot/wakeup.S +++ b/xen/arch/x86/boot/wakeup.S @@ -120,7 +120,7 @@ wakeup_32: mov $bootsym_rel(wakeup_stack, 4, %esp) # check saved magic again - mov $sym_phys(saved_magic), %eax + mov $sym_offs(saved_magic),%eax add bootsym_rel(trampoline_xen_phys_start, 4, %eax) mov (%eax), %eax cmp $0x9abcdef0, %eax @@ -133,7 +133,7 @@ wakeup_32: mov %ecx, %cr4 /* Load pagetable base register */ - mov $sym_phys(idle_pg_table),%eax + mov $sym_offs(idle_pg_table),%eax add bootsym_rel(trampoline_xen_phys_start,4,%eax) mov %eax,%cr3 diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S index 7392004..86d3775 100644 --- a/xen/arch/x86/boot/x86_64.S +++ b/xen/arch/x86/boot/x86_64.S @@ -112,7 +112,7 @@ GLOBAL(__page_tables_start) * actualy mapped (mostly using superpages). Uses 4x 4k pages. */ GLOBAL(l2_identmap) - .quad sym_phys(l1_identmap) + __PAGE_HYPERVISOR + .quad sym_offs(l1_identmap) + __PAGE_HYPERVISOR idx = 1 .rept 7 .quad (idx << L2_PAGETABLE_SHIFT) | PAGE_HYPERVISOR | _PAGE_PSE @@ -130,7 +130,7 @@ GLOBAL(l2_xenmap) .quad 0 idx = 1 .rept 7 - .quad sym_phys(__image_base__) + (idx << L2_PAGETABLE_SHIFT) + (PAGE_HYPERVISOR | _PAGE_PSE) + .quad sym_offs(__image_base__) + (idx << L2_PAGETABLE_SHIFT) + (PAGE_HYPERVISOR | _PAGE_PSE) idx = idx + 1 .endr .fill L2_PAGETABLE_ENTRIES - 8, 8, 0 @@ -141,7 +141,7 @@ l2_fixmap: idx = 0 .rept L2_PAGETABLE_ENTRIES .if idx == l2_table_offset(FIXADDR_TOP - 1) - .quad sym_phys(l1_fixmap) + __PAGE_HYPERVISOR + .quad sym_offs(l1_fixmap) + __PAGE_HYPERVISOR .else .quad 0 .endif @@ -153,7 +153,7 @@ l2_fixmap: l3_identmap: idx = 0 .rept 4 - .quad sym_phys(l2_identmap) + (idx << PAGE_SHIFT) + __PAGE_HYPERVISOR + .quad sym_offs(l2_identmap) + (idx << PAGE_SHIFT) + __PAGE_HYPERVISOR idx = idx + 1 .endr .fill L3_PAGETABLE_ENTRIES - 4, 8, 0 @@ -164,9 +164,9 @@ l3_xenmap: idx = 0 .rept L3_PAGETABLE_ENTRIES .if idx == l3_table_offset(XEN_VIRT_START) - .quad sym_phys(l2_xenmap) + __PAGE_HYPERVISOR + .quad sym_offs(l2_xenmap) + __PAGE_HYPERVISOR .elseif idx == l3_table_offset(FIXADDR_TOP - 1) - .quad sym_phys(l2_fixmap) + __PAGE_HYPERVISOR + .quad sym_offs(l2_fixmap) + __PAGE_HYPERVISOR .else .quad 0 .endif @@ -176,13 +176,13 @@ l3_xenmap: /* Top-level master (and idle-domain) page directory. */ GLOBAL(idle_pg_table) - .quad sym_phys(l3_bootmap) + __PAGE_HYPERVISOR + .quad sym_offs(l3_bootmap) + __PAGE_HYPERVISOR idx = 1 .rept L4_PAGETABLE_ENTRIES - 1 .if idx == l4_table_offset(DIRECTMAP_VIRT_START) - .quad sym_phys(l3_identmap) + __PAGE_HYPERVISOR + .quad sym_offs(l3_identmap) + __PAGE_HYPERVISOR .elseif idx == l4_table_offset(XEN_VIRT_START) - .quad sym_phys(l3_xenmap) + __PAGE_HYPERVISOR + .quad sym_offs(l3_xenmap) + __PAGE_HYPERVISOR .else .quad 0 .endif