[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 04/23] x86/boot: call reloc() using cdecl calling convention
From: |
Daniel Kiper |
Subject: |
[PATCH v2 04/23] x86/boot: call reloc() using cdecl calling convention |
Date: |
Mon, 20 Jul 2015 16:28:59 +0200 |
Suggested-by: Jan Beulich <address@hidden>
Signed-off-by: Daniel Kiper <address@hidden>
---
xen/arch/x86/boot/head.S | 4 +++-
xen/arch/x86/boot/reloc.c | 20 ++++++++++++++++----
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index ed42782..3cbb2e6 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -119,8 +119,10 @@ __start:
/* Save the Multiboot info struct (after relocation) for later use. */
mov $sym_phys(cpu0_stack)+1024,%esp
- push %ebx
+ push %ebx /* Multiboot information address. */
+ push %eax /* Boot trampoline address. */
call reloc
+ add $8,%esp /* Remove reloc() args from stack. */
mov %eax,sym_phys(multiboot_ptr)
/* Initialize BSS (no nasty surprises!). */
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 63045c0..708898f 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -10,15 +10,27 @@
* Keir Fraser <address@hidden>
*/
-/* entered with %eax = BOOT_TRAMPOLINE */
+/*
+ * This entry point is entered from xen/arch/x86/boot/head.S with:
+ * - 0x4(%esp) = BOOT_TRAMPOLINE_ADDRESS,
+ * - 0x8(%esp) = MULTIBOOT_INFORMATION_ADDRESS.
+ */
asm (
" .text \n"
" .globl _start \n"
"_start: \n"
+ " push %ebp \n"
+ " mov %esp,%ebp \n"
" call 1f \n"
- "1: pop %ebx \n"
- " mov %eax,alloc-1b(%ebx) \n"
- " jmp reloc \n"
+ "1: pop %ecx \n"
+ " mov 0x8(%ebp),%eax \n"
+ " mov %eax,alloc-1b(%ecx) \n"
+ " mov 0xc(%ebp),%eax \n"
+ " push %eax \n"
+ " call reloc \n"
+ " add $4,%esp \n"
+ " pop %ebp \n"
+ " ret \n"
);
/*
--
1.7.10.4
- [PATCH v2 00/23] x86: multiboot2 protocol support, Daniel Kiper, 2015/07/20
- [PATCH v2 01/23] x86/boot: remove unneeded instruction, Daniel Kiper, 2015/07/20
- [PATCH v2 04/23] x86/boot: call reloc() using cdecl calling convention,
Daniel Kiper <=
- [PATCH v2 03/23] x86: zero BSS using stosl instead of stosb, Daniel Kiper, 2015/07/20
- [PATCH v2 07/23] x86/boot/reloc: Rename some variables and rearrange code a bit, Daniel Kiper, 2015/07/20
- [PATCH v2 06/23] x86/boot: use %ecx instead of %eax, Daniel Kiper, 2015/07/20
- [PATCH v2 05/23] x86/boot/reloc: create generic alloc and copy functions, Daniel Kiper, 2015/07/20
- [PATCH v2 08/23] x86: add multiboot2 protocol support, Daniel Kiper, 2015/07/20
- [PATCH v2 11/23] efi: split out efi_init(), Daniel Kiper, 2015/07/20
- [PATCH v2 12/23] efi: split out efi_console_set_mode(), Daniel Kiper, 2015/07/20
- [PATCH v2 02/23] x86/boot: copy only text section from *.lnk file to *.bin file, Daniel Kiper, 2015/07/20
- [PATCH v2 13/23] efi: split out efi_get_gop(), Daniel Kiper, 2015/07/20
- [PATCH v2 16/23] efi: split out efi_variables(), Daniel Kiper, 2015/07/20