From e4eede7085981db70dc3937c27ec5ebdc15a7044 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 14 Jan 2006 07:14:40 +0000 Subject: fixup so we can at least get to the ldso Standalone execution step --- ldso/ldso/m68k/dl-startup.h | 48 ++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 16 deletions(-) (limited to 'ldso') diff --git a/ldso/ldso/m68k/dl-startup.h b/ldso/ldso/m68k/dl-startup.h index 07857cf38..1a74cb15e 100644 --- a/ldso/ldso/m68k/dl-startup.h +++ b/ldso/ldso/m68k/dl-startup.h @@ -4,23 +4,43 @@ * Copyright (C) 2005 by Erik Andersen */ -asm( - " .text\n" - " .globl _start\n" - " .type _start,@function\n" - "_start:\n" - " .set _start,_dl_start\n" - " .size _start,.-_start\n" - " .previous\n" -); +asm ("\ + .text\n\ + .globl _start\n\ + .type _start,@function\n\ +_start:\n\ + move.l %sp, -(%sp)\n\ + jbsr _dl_start\n\ + addq.l #4, %sp\n\ + # Save the user entry point address in %a4.\n\ + move.l %d0, %a4\n\ + # See if we were run as a command with the executable file\n\ + # name as an extra leading argument.\n\ + move.l _dl_skip_args(%pc), %d0\n\ + # Pop the original argument count\n\ + move.l (%sp)+, %d1\n\ + # Subtract _dl_skip_args from it.\n\ + sub.l %d0, %d1\n\ + # Adjust the stack pointer to skip _dl_skip_args words.\n\ + lea (%sp, %d0*4), %sp\n\ + # Push back the modified argument count.\n\ + move.l %d1, -(%sp)\n\ + # Pass our finalizer function to the user in %a1.\n\ + lea _dl_fini(%pc), %a1\n\ + # Initialize %fp with the stack pointer.\n\ + move.l %sp, %fp\n\ + # Jump to the user's entry point.\n\ + jmp (%a4)\n\ + .size _dl_start_user, . - _dl_start_user\n\ + .previous"); /* Get a pointer to the argv array. On many platforms this can be just * the address if the first argument, on other platforms we need to * do something a little more subtle here. */ -#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned int *) & ARGS) +#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long *) ARGS) + 1) /* Handle relocation of the symbols in the dynamic loader. */ -static inline +static __always_inline void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr, unsigned long symbol_addr, unsigned long load_addr, Elf32_Sym *symtab) { @@ -63,8 +83,4 @@ void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr, /* Transfer control to the user's application, once the dynamic loader is * done. This routine has to exit the current function, then call the * _dl_elf_main function. */ -#define START() \ - __asm__ volatile ( \ - "unlk %%a6\n\t" \ - "jmp %0@" \ - : : "a" (_dl_elf_main)); +#define START() return _dl_elf_main -- cgit v1.2.3