diff options
Diffstat (limited to 'ldso/ldso/sparc')
-rw-r--r-- | ldso/ldso/sparc/elfinterp.c | 10 | ||||
-rw-r--r-- | ldso/ldso/sparc/resolve.S | 2 | ||||
-rw-r--r-- | ldso/ldso/sparc/syscalls.h | 156 | ||||
-rw-r--r-- | ldso/ldso/sparc/sysdep.h | 125 |
4 files changed, 5 insertions, 288 deletions
diff --git a/ldso/ldso/sparc/elfinterp.c b/ldso/ldso/sparc/elfinterp.c index 8ca84e564..cd34babf6 100644 --- a/ldso/ldso/sparc/elfinterp.c +++ b/ldso/ldso/sparc/elfinterp.c @@ -41,12 +41,10 @@ an ELF sharable library or a linux style of shared library. */ a more than adequate job of explaining everything required to get this working. */ -#include <sys/types.h> -#include "elf.h" -#include "hash.h" -#include "syscall.h" -#include "string.h" -#include "sysdep.h" +#include "linuxelf.h" +#include "ld_hash.h" +#include "ld_syscall.h" +#include "ld_string.h" extern char *_dl_progname; diff --git a/ldso/ldso/sparc/resolve.S b/ldso/ldso/sparc/resolve.S index ea985b5c8..57c4b6804 100644 --- a/ldso/ldso/sparc/resolve.S +++ b/ldso/ldso/sparc/resolve.S @@ -2,7 +2,7 @@ * These are various helper routines that are needed to run an ELF image. */ #define COMPILE_ASM -#include "sysdep.h" +#include "ld_sysdep.h" .text .align 16 diff --git a/ldso/ldso/sparc/syscalls.h b/ldso/ldso/sparc/syscalls.h deleted file mode 100644 index d7cd3734b..000000000 --- a/ldso/ldso/sparc/syscalls.h +++ /dev/null @@ -1,156 +0,0 @@ -#include <sys/types.h> - -/* - * This file contains the system call macros and syscall - * numbers used by the shared library loader. - */ - -#define __NR_exit 1 -#define __NR_read 3 -#define __NR_write 4 -#define __NR_open 5 -#define __NR_close 6 -#define __NR_getuid 24 -#define __NR_getgid 47 -#define __NR_geteuid 49 -#define __NR_getegid 50 -#define __NR_mmap 71 -#define __NR_munmap 73 -#define __NR_stat 38 -#define __NR_mprotect 74 - -/* Here are the macros which define how this platform makes - * system calls. This particular variant does _not_ set - * errno (note how it is disabled in __syscall_return) since - * these will get called before the errno symbol is dynamicly - * linked. */ - -#define _syscall0(type,name) \ -type name(void) \ -{ \ -long __res; \ -register long __g1 __asm__ ("g1") = __NR_##name; \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__res)\ - : "r" (__g1) \ - : "o0", "cc"); \ -if (__res < -255 || __res >= 0) \ - return (type) __res; \ -/*errno = -__res; */\ -return -1; \ -} - -#define _syscall1(type,name,type1,arg1) \ -type name(type1 arg1) \ -{ \ -long __res; \ -register long __g1 __asm__ ("g1") = __NR_##name; \ -register long __o0 __asm__ ("o0") = (long)(arg1); \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__res), "=&r" (__o0) \ - : "1" (__o0), "r" (__g1) \ - : "cc"); \ -if (__res < -255 || __res >= 0) \ - return (type) __res; \ -/*errno = -__res;*/ \ -return -1; \ -} - -#define _syscall2(type,name,type1,arg1,type2,arg2) \ -type name(type1 arg1,type2 arg2) \ -{ \ -long __res; \ -register long __g1 __asm__ ("g1") = __NR_##name; \ -register long __o0 __asm__ ("o0") = (long)(arg1); \ -register long __o1 __asm__ ("o1") = (long)(arg2); \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__res), "=&r" (__o0) \ - : "1" (__o0), "r" (__o1), "r" (__g1) \ - : "cc"); \ -if (__res < -255 || __res >= 0) \ - return (type) __res; \ -/*errno = -__res;*/ \ -return -1; \ -} - -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ -type name(type1 arg1,type2 arg2,type3 arg3) \ -{ \ -long __res; \ -register long __g1 __asm__ ("g1") = __NR_##name; \ -register long __o0 __asm__ ("o0") = (long)(arg1); \ -register long __o1 __asm__ ("o1") = (long)(arg2); \ -register long __o2 __asm__ ("o2") = (long)(arg3); \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__res), "=&r" (__o0) \ - : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \ - : "cc"); \ -if (__res < -255 || __res>=0) \ - return (type) __res; \ -/*errno = -__res;*/ \ -return -1; \ -} - -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ -long __res; \ -register long __g1 __asm__ ("g1") = __NR_##name; \ -register long __o0 __asm__ ("o0") = (long)(arg1); \ -register long __o1 __asm__ ("o1") = (long)(arg2); \ -register long __o2 __asm__ ("o2") = (long)(arg3); \ -register long __o3 __asm__ ("o3") = (long)(arg4); \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__res), "=&r" (__o0) \ - : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \ - : "cc"); \ -if (__res < -255 || __res>=0) \ - return (type) __res; \ -/*errno = -__res;*/ \ -return -1; \ -} - -#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ -long __res; \ -register long __g1 __asm__ ("g1") = __NR_##name; \ -register long __o0 __asm__ ("o0") = (long)(arg1); \ -register long __o1 __asm__ ("o1") = (long)(arg2); \ -register long __o2 __asm__ ("o2") = (long)(arg3); \ -register long __o3 __asm__ ("o3") = (long)(arg4); \ -register long __o4 __asm__ ("o4") = (long)(arg5); \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__res), "=&r" (__o0) \ - : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \ - : "cc"); \ -if (__res < -255 || __res>=0) \ - return (type) __res; \ -/*errno = -__res; */\ -return -1; \ -} diff --git a/ldso/ldso/sparc/sysdep.h b/ldso/ldso/sparc/sysdep.h deleted file mode 100644 index 3c8d9b8d1..000000000 --- a/ldso/ldso/sparc/sysdep.h +++ /dev/null @@ -1,125 +0,0 @@ - -/* - * Various assmbly language/system dependent hacks that are required - * so that we can minimize the amount of platform specific code. - */ -#define LINUXBIN - -/* - * Define this if the system uses RELOCA. - */ -#define ELF_USES_RELOCA - -/* - * 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. We assume that argc is stored - * at the word just below the argvp that we return here. - */ -#define GET_ARGV(ARGVP, ARGS) __asm__("\tadd %%fp,68,%0\n" : "=r" (ARGVP)); - -/* - * Initialization sequence for a GOT. For the Sparc, this points to the - * PLT, and we need to initialize a couple of the slots. The PLT should - * look like: - * - * save %sp, -64, %sp - * call _dl_linux_resolve - * nop - * .word implementation_dependent - */ -#define INIT_GOT(GOT_BASE,MODULE) \ -{ \ - GOT_BASE[0] = 0x9de3bfc0; /* save %sp, -64, %sp */ \ - GOT_BASE[1] = 0x40000000 | (((unsigned int) _dl_linux_resolve - (unsigned int) GOT_BASE - 4) >> 2); \ - GOT_BASE[2] = 0x01000000; /* nop */ \ - GOT_BASE[3] = (int) MODULE; \ -} - -/* - * Here is a macro to perform a relocation. This is only used when - * bootstrapping the dynamic loader. - */ -#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ - switch(ELF32_R_TYPE((RELP)->r_info)) { \ - case R_SPARC_32: \ - *REL = SYMBOL + (RELP)->r_addend; \ - break; \ - case R_SPARC_GLOB_DAT: \ - *REL = SYMBOL + (RELP)->r_addend; \ - break; \ - case R_SPARC_JMP_SLOT: \ - REL[1] = 0x03000000 | ((SYMBOL >> 10) & 0x3fffff); \ - REL[2] = 0x81c06000 | (SYMBOL & 0x3ff); \ - break; \ - case R_SPARC_NONE: \ - break; \ - case R_SPARC_WDISP30: \ - break; \ - case R_SPARC_RELATIVE: \ - *REL += (unsigned int) LOAD + (RELP)->r_addend; \ - break; \ - default: \ - _dl_exit(1); \ - } - - -/* - * Transfer control to the user's application, once the dynamic loader - * is done. The crt calls atexit with $g1 if not null, so we need to - * ensure that it contains NULL. - */ - -#define START() \ - __asm__ volatile ( \ - "add %%g0,%%g0,%%g1\n\t" \ - "jmpl %0, %%o7\n\t" \ - "restore %%g0,%%g0,%%g0\n\t" \ - : /*"=r" (status) */ : \ - "r" (_dl_elf_main): "g1", "o0", "o1") - - - -/* Here we define the magic numbers that this dynamic loader should accept */ - -#define MAGIC1 EM_SPARC -#undef MAGIC2 -/* Used for error messages */ -#define ELF_TARGET "Sparc" - -#ifndef COMPILE_ASM -extern unsigned int _dl_linux_resolver(unsigned int reloc_entry, - unsigned int * i); -#endif - -/* - * Define this if you want a dynamic loader that works on Solaris. - */ -#define SOLARIS_COMPATIBLE - -/* - * Define this because we do not want to call .udiv in the library. - * Change on the plans -miguel: - * We just statically link against .udiv. This is required - * if we want to be able to run on Sun4c machines. - */ - -/* We now link .urem against this one */ -#ifdef USE_V8 -#define do_rem(result,n,base) ({ \ -volatile int __res; \ -__asm__("mov %%g0,%%Y\n\t" \ - "sdiv %2,%3,%%l6\n\t" \ - "smul %%l6,%3,%%l6\n\t" \ - "sub %2,%%l6,%0\n\t" \ - :"=r" (result),"=r" (__res):"r" (n),"r"(base) : "l6" ); __res; }) -#else -#define do_rem(a,b,c) a = _dl_urem (b,c); -#endif -/* - * dbx wants the binder to have a specific name. Mustn't disappoint it. - */ -#ifdef SOLARIS_COMPATIBLE -#define _dl_linux_resolve _elf_rtbndr -#endif - |