Message ID | 1470438282-4226-6-git-send-email-daniel.kiper@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
>>> On 06.08.16 at 01:04, <daniel.kiper@oracle.com> wrote: > 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> Acked-by: Jan Beulich <jbeulich@suse.com> Albeit I think the commit message could do with some further cleanup. Jan
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;
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(-)