summaryrefslogtreecommitdiff
path: root/ldso/ldso/sparc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-02-10 09:26:57 +0000
committerEric Andersen <andersen@codepoet.org>2004-02-10 09:26:57 +0000
commit70709408336e483de74947eb53e9ba01ef4ab140 (patch)
treefe17e15c0f272c571607172fc5c89d094de5f60c /ldso/ldso/sparc
parentc201ba7c107edbb5fe81c641e87715a4930a4ff1 (diff)
Rework file naming, aiming for at least a vague level of consistancy
Diffstat (limited to 'ldso/ldso/sparc')
-rw-r--r--ldso/ldso/sparc/boot1_arch.h7
-rw-r--r--ldso/ldso/sparc/ld_syscalls.h156
-rw-r--r--ldso/ldso/sparc/ld_sysdep.h112
-rw-r--r--ldso/ldso/sparc/resolve.S2
4 files changed, 1 insertions, 276 deletions
diff --git a/ldso/ldso/sparc/boot1_arch.h b/ldso/ldso/sparc/boot1_arch.h
deleted file mode 100644
index 42c96a6f5..000000000
--- a/ldso/ldso/sparc/boot1_arch.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Any assmbly language/system dependent hacks needed to setup boot1.c so it
- * will work as expected and cope with whatever platform specific wierdness is
- * needed for this architecture. See arm/boot1_arch.h for an example of what
- * can be done.
- */
-
-#define DL_BOOT(X) void __attribute__ ((unused)) _dl_boot (X)
diff --git a/ldso/ldso/sparc/ld_syscalls.h b/ldso/ldso/sparc/ld_syscalls.h
deleted file mode 100644
index 4222b2468..000000000
--- a/ldso/ldso/sparc/ld_syscalls.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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_getpid 20
-#define __NR_getuid 24
-#define __NR_getgid 47
-#define __NR_geteuid 49
-#define __NR_getegid 50
-#define __NR_readlink 58
-#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/ld_sysdep.h b/ldso/ldso/sparc/ld_sysdep.h
deleted file mode 100644
index 1930a937f..000000000
--- a/ldso/ldso/sparc/ld_sysdep.h
+++ /dev/null
@@ -1,112 +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,SYMTAB) \
- 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 do_rem(result, n, base) result = (n % base)
-
-/*
- * dbx wants the binder to have a specific name. Mustn't disappoint it.
- */
-#ifdef SOLARIS_COMPATIBLE
-#define _dl_linux_resolve _elf_rtbndr
-#endif
-
-/* 4096 bytes alignment */
-#define PAGE_ALIGN 0xfffff000
-#define ADDR_ALIGN 0xfff
-#define OFFS_ALIGN 0x7ffff000
diff --git a/ldso/ldso/sparc/resolve.S b/ldso/ldso/sparc/resolve.S
index 57c4b6804..a21facfbc 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 "ld_sysdep.h"
+#include "dl-sysdep.h"
.text
.align 16