All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Kiper <daniel.kiper@oracle.com>
To: xen-devel@lists.xenproject.org
Cc: jgross@suse.com, sstabellini@kernel.org,
	andrew.cooper3@citrix.com, cardoe@cardoe.com,
	pgnet.dev@gmail.com, ning.sun@intel.com, david.vrabel@citrix.com,
	jbeulich@suse.com, qiaowei.ren@intel.com,
	richard.l.maliszewski@intel.com, gang.wei@intel.com,
	fu.wei@linaro.org
Subject: [PATCH v4 05/19] x86/boot: call reloc() using stdcall calling convention
Date: Sat,  6 Aug 2016 01:04:28 +0200	[thread overview]
Message-ID: <1470438282-4226-6-git-send-email-daniel.kiper@oracle.com> (raw)
In-Reply-To: <1470438282-4226-1-git-send-email-daniel.kiper@oracle.com>

Current reloc() call method makes confusion and does not scale
well for more arguments. And patch adding multiboot2 protocol
support have to pass 3 arguments instead of 2. Hence, move reloc()
call to stdcall calling convention. This way, in comparison to
cdecl calling convention, we do not need to remove arguments from
stack in xen/arch/x86/boot/head.S assembly file too.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
v4 - suggestions/fixes:
   - move to stdcall calling convention
     (suggested by Jan Beulich).

v3 - suggestions/fixes:
   - simplify assembly in xen/arch/x86/boot/reloc.c file
     (suggested by Jan Beulich),
   - reorder arguments for reloc() call from xen/arch/x86/boot/head.S
     (suggested by Jan Beulich),
   - improve commit message
     (suggested by Jan Beulich).
---
 xen/arch/x86/boot/head.S  |    3 ++-
 xen/arch/x86/boot/reloc.c |   11 ++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index e34351c..7e5ae12 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -119,7 +119,8 @@ __start:
 
         /* Save the Multiboot info struct (after relocation) for later use. */
         mov     $sym_phys(cpu0_stack)+1024,%esp
-        push    %ebx
+        push    %eax                /* Boot trampoline address. */
+        push    %ebx                /* Multiboot information address. */
         call    reloc
         mov     %eax,sym_phys(multiboot_ptr)
 
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 9ae42e2..28c6cea 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -10,15 +10,16 @@
  *    Keir Fraser <keir@xen.org>
  */
 
-/* entered with %eax = BOOT_TRAMPOLINE */
+/*
+ * This entry point is entered from xen/arch/x86/boot/head.S with:
+ *   - 0x4(%esp) = MULTIBOOT_INFORMATION_ADDRESS,
+ *   - 0x8(%esp) = BOOT_TRAMPOLINE_ADDRESS.
+ */
 asm (
     "    .text                         \n"
     "    .globl _start                 \n"
     "_start:                           \n"
-    "    push %eax                     \n"
-    "    push 0x8(%esp)                \n"
-    "    call reloc                    \n"
-    "    ret  $0x4                     \n"
+    "    jmp  reloc                    \n"
     );
 
 typedef unsigned int u32;
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-08-05 23:05 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05 23:04 [PATCH v4 00/19] x86: multiboot2 protocol support Daniel Kiper
2016-08-05 23:04 ` [PATCH v4 01/19] x86: allow EFI reboot method neither on EFI platforms Daniel Kiper
2016-08-09 12:08   ` Jan Beulich
2016-08-05 23:04 ` [PATCH v4 02/19] x86/boot: remove multiboot1_header_end from symbol table Daniel Kiper
2016-08-09 13:24   ` Andrew Cooper
2016-08-09 13:52     ` Jan Beulich
2016-08-09 14:09       ` Andrew Cooper
2016-08-09 14:30         ` Jan Beulich
2016-08-05 23:04 ` [PATCH v4 03/19] x86/boot: create *.lnk files with linker script Daniel Kiper
2016-08-11 13:40   ` Jan Beulich
2016-08-05 23:04 ` [PATCH v4 04/19] x86/boot/reloc: reduce assembly usage as much as possible Daniel Kiper
2016-08-11 13:56   ` Jan Beulich
2016-08-05 23:04 ` Daniel Kiper [this message]
2016-08-11 13:59   ` [PATCH v4 05/19] x86/boot: call reloc() using stdcall calling convention Jan Beulich
2016-08-05 23:04 ` [PATCH v4 06/19] x86/boot/reloc: create generic alloc and copy functions Daniel Kiper
2016-08-11 14:12   ` Jan Beulich
2016-08-11 14:17     ` Jan Beulich
2016-08-18  8:53       ` Daniel Kiper
2016-08-18  9:41         ` Jan Beulich
2016-08-18 12:18           ` Daniel Kiper
2016-08-18 13:21             ` Jan Beulich
2016-08-05 23:04 ` [PATCH v4 07/19] x86/boot: use %ecx instead of %eax Daniel Kiper
2016-08-05 23:04 ` [PATCH v4 08/19] x86/boot/reloc: Rename some variables and rearrange code a bit Daniel Kiper
2016-08-11 14:16   ` Jan Beulich
2016-08-05 23:04 ` [PATCH v4 09/19] x86: add multiboot2 protocol support Daniel Kiper
2016-08-17 15:39   ` Jan Beulich
2016-08-18  9:23     ` Daniel Kiper
2016-08-18  9:43       ` Jan Beulich
2016-08-18 11:41         ` Daniel Kiper
2016-08-18 13:19           ` Jan Beulich
2016-08-05 23:04 ` [PATCH v4 10/19] efi: move efi struct initialization to xen/common/lib.c Daniel Kiper
2016-08-17 15:56   ` Jan Beulich
2016-08-18 10:17     ` Daniel Kiper
2016-08-18 11:17       ` Jan Beulich
2016-08-05 23:04 ` [PATCH v4 11/19] efi: create efi_enabled() Daniel Kiper
2016-08-17 16:08   ` Jan Beulich
2016-08-05 23:04 ` [PATCH v4 12/19] efi: introduce EFI_RS to ease control on runtime services usage Daniel Kiper
2016-08-17 16:12   ` Jan Beulich
2016-08-18 10:30     ` Daniel Kiper
2016-08-18 11:18       ` Jan Beulich
2016-08-18 11:49         ` Daniel Kiper
2016-08-05 23:04 ` [PATCH v4 13/19] efi: EFI_RS bit in efi.flags must be controlled by efi=[no-]rs command line argument Daniel Kiper
2016-08-05 23:04 ` [PATCH v4 14/19] efi: build xen.gz with EFI code Daniel Kiper
2016-08-19  9:24   ` Jan Beulich
2016-08-19 10:09     ` Daniel Kiper
2016-08-05 23:04 ` [PATCH v4 15/19] x86/efi: create new early memory allocator Daniel Kiper
2016-08-05 23:04 ` [PATCH v4 16/19] x86: add multiboot2 protocol support for EFI platforms Daniel Kiper
2016-08-05 23:04 ` [PATCH v4 17/19] x86/boot: implement early command line parser in C Daniel Kiper
2016-08-05 23:04 ` [PATCH v4 18/19] x86: make Xen early boot code relocatable Daniel Kiper
2016-08-05 23:04 ` [PATCH v4 19/19] x86: add multiboot2 protocol support for relocatable images Daniel Kiper

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=1470438282-4226-6-git-send-email-daniel.kiper@oracle.com \
    --to=daniel.kiper@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=cardoe@cardoe.com \
    --cc=david.vrabel@citrix.com \
    --cc=fu.wei@linaro.org \
    --cc=gang.wei@intel.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=ning.sun@intel.com \
    --cc=pgnet.dev@gmail.com \
    --cc=qiaowei.ren@intel.com \
    --cc=richard.l.maliszewski@intel.com \
    --cc=sstabellini@kernel.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.