x86/boot: call reloc() using stdcall calling convention
authorDaniel Kiper <daniel.kiper@oracle.com>
Thu, 25 Aug 2016 12:02:53 +0000 (14:02 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 25 Aug 2016 12:02:53 +0000 (14:02 +0200)
Current reloc() call method makes confusion and does not scale well
for more arguments. And subsequent patch adding multiboot2 protocol
support have to pass 3 arguments instead of 2. Hence, move reloc()
call to stdcall calling convention. One may argue that we should use
standard cdecl calling convention. However, stdcall is better here
than cdecl because we do not need to remove "manually" arguments from
stack in xen/arch/x86/boot/head.S assembly file.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/boot/head.S
xen/arch/x86/boot/reloc.c

index 85770e8e94dda42da6255622774fe23e2ab0ff28..5538a4bda077f218c2ed8a2d70d72ebbaf6d948f 100644 (file)
@@ -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)
 
index 9ae42e23b840a2bdd7ca2b086edeb20dded83b31..28c6cea2a6806d29f187c5b13675e13c9e949092 100644 (file)
  *    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;