summaryrefslogtreecommitdiff
path: root/ldso/ldso/powerpc
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/powerpc
parentc201ba7c107edbb5fe81c641e87715a4930a4ff1 (diff)
Rework file naming, aiming for at least a vague level of consistancy
Diffstat (limited to 'ldso/ldso/powerpc')
-rw-r--r--ldso/ldso/powerpc/boot1_arch.h20
-rw-r--r--ldso/ldso/powerpc/ld_syscalls.h244
-rw-r--r--ldso/ldso/powerpc/ld_sysdep.h127
3 files changed, 0 insertions, 391 deletions
diff --git a/ldso/ldso/powerpc/boot1_arch.h b/ldso/ldso/powerpc/boot1_arch.h
deleted file mode 100644
index 70e494331..000000000
--- a/ldso/ldso/powerpc/boot1_arch.h
+++ /dev/null
@@ -1,20 +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. */
-
-/* Overrive the default _dl_boot function, and replace it with a bit of asm.
- * Then call the real _dl_boot function, which is now named _dl_boot2. */
-
-asm("" \
-" .text\n" \
-" .globl _dl_boot\n" \
-"_dl_boot:\n" \
-" mr 3,1\n" \
-" li 4,0\n" \
-" addi 1,1,-16\n" \
-" stw 4,0(1)\n" \
-" bl _dl_boot2\n" \
-".previous\n" \
-);
-
-#define DL_BOOT(X) static void __attribute__ ((unused)) _dl_boot2(X)
diff --git a/ldso/ldso/powerpc/ld_syscalls.h b/ldso/ldso/powerpc/ld_syscalls.h
deleted file mode 100644
index 3e561d661..000000000
--- a/ldso/ldso/powerpc/ld_syscalls.h
+++ /dev/null
@@ -1,244 +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_geteuid 49
-#define __NR_getgid 47
-#define __NR_getegid 50
-#define __NR_readlink 85
-#define __NR_mmap 90
-#define __NR_munmap 91
-#define __NR_stat 106
-#define __NR_mprotect 125
-
-/* 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. */
-
-#undef __syscall_return
-#define __syscall_return(type) \
- return (__sc_err & 0x10000000 ? /*errno = __sc_ret,*/ __sc_ret = -1 : 0), \
- (type) __sc_ret
-
-#undef __syscall_clobbers
-#define __syscall_clobbers \
- "r9", "r10", "r11", "r12"
- //"r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
-
-#undef _syscall0
-#define _syscall0(type,name) \
-type name(void) \
-{ \
- unsigned long __sc_ret, __sc_err; \
- { \
- register unsigned long __sc_0 __asm__ ("r0"); \
- register unsigned long __sc_3 __asm__ ("r3"); \
- \
- __sc_0 = __NR_##name; \
- __asm__ __volatile__ \
- ("sc \n\t" \
- "mfcr %1 " \
- : "=&r" (__sc_3), "=&r" (__sc_0) \
- : "0" (__sc_3), "1" (__sc_0) \
- : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \
- __sc_ret = __sc_3; \
- __sc_err = __sc_0; \
- } \
- __syscall_return (type); \
-}
-
-#undef _syscall1
-#define _syscall1(type,name,type1,arg1) \
-type name(type1 arg1) \
-{ \
- unsigned long __sc_ret, __sc_err; \
- { \
- register unsigned long __sc_0 __asm__ ("r0"); \
- register unsigned long __sc_3 __asm__ ("r3"); \
- \
- __sc_3 = (unsigned long) (arg1); \
- __sc_0 = __NR_##name; \
- __asm__ __volatile__ \
- ("sc \n\t" \
- "mfcr %1 " \
- : "=&r" (__sc_3), "=&r" (__sc_0) \
- : "0" (__sc_3), "1" (__sc_0) \
- : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \
- __sc_ret = __sc_3; \
- __sc_err = __sc_0; \
- } \
- __syscall_return (type); \
-}
-
-#undef _syscall2
-#define _syscall2(type,name,type1,arg1,type2,arg2) \
-type name(type1 arg1, type2 arg2) \
-{ \
- unsigned long __sc_ret, __sc_err; \
- { \
- register unsigned long __sc_0 __asm__ ("r0"); \
- register unsigned long __sc_3 __asm__ ("r3"); \
- register unsigned long __sc_4 __asm__ ("r4"); \
- \
- __sc_3 = (unsigned long) (arg1); \
- __sc_4 = (unsigned long) (arg2); \
- __sc_0 = __NR_##name; \
- __asm__ __volatile__ \
- ("sc \n\t" \
- "mfcr %1 " \
- : "=&r" (__sc_3), "=&r" (__sc_0) \
- : "0" (__sc_3), "1" (__sc_0), \
- "r" (__sc_4) \
- : "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \
- __sc_ret = __sc_3; \
- __sc_err = __sc_0; \
- } \
- __syscall_return (type); \
-}
-
-#undef _syscall3
-#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
-type name(type1 arg1, type2 arg2, type3 arg3) \
-{ \
- unsigned long __sc_ret, __sc_err; \
- { \
- register unsigned long __sc_0 __asm__ ("r0"); \
- register unsigned long __sc_3 __asm__ ("r3"); \
- register unsigned long __sc_4 __asm__ ("r4"); \
- register unsigned long __sc_5 __asm__ ("r5"); \
- \
- __sc_3 = (unsigned long) (arg1); \
- __sc_4 = (unsigned long) (arg2); \
- __sc_5 = (unsigned long) (arg3); \
- __sc_0 = __NR_##name; \
- __asm__ __volatile__ \
- ("sc \n\t" \
- "mfcr %1 " \
- : "=&r" (__sc_3), "=&r" (__sc_0) \
- : "0" (__sc_3), "1" (__sc_0), \
- "r" (__sc_4), \
- "r" (__sc_5) \
- : "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \
- __sc_ret = __sc_3; \
- __sc_err = __sc_0; \
- } \
- __syscall_return (type); \
-}
-
-#undef _syscall4
-#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
-{ \
- unsigned long __sc_ret, __sc_err; \
- { \
- register unsigned long __sc_0 __asm__ ("r0"); \
- register unsigned long __sc_3 __asm__ ("r3"); \
- register unsigned long __sc_4 __asm__ ("r4"); \
- register unsigned long __sc_5 __asm__ ("r5"); \
- register unsigned long __sc_6 __asm__ ("r6"); \
- \
- __sc_3 = (unsigned long) (arg1); \
- __sc_4 = (unsigned long) (arg2); \
- __sc_5 = (unsigned long) (arg3); \
- __sc_6 = (unsigned long) (arg4); \
- __sc_0 = __NR_##name; \
- __asm__ __volatile__ \
- ("sc \n\t" \
- "mfcr %1 " \
- : "=&r" (__sc_3), "=&r" (__sc_0) \
- : "0" (__sc_3), "1" (__sc_0), \
- "r" (__sc_4), \
- "r" (__sc_5), \
- "r" (__sc_6) \
- : "r7", "r8", "r9", "r10", "r11", "r12" ); \
- __sc_ret = __sc_3; \
- __sc_err = __sc_0; \
- } \
- __syscall_return (type); \
-}
-
-#undef _syscall5
-#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) \
-{ \
- unsigned long __sc_ret, __sc_err; \
- { \
- register unsigned long __sc_0 __asm__ ("r0"); \
- register unsigned long __sc_3 __asm__ ("r3"); \
- register unsigned long __sc_4 __asm__ ("r4"); \
- register unsigned long __sc_5 __asm__ ("r5"); \
- register unsigned long __sc_6 __asm__ ("r6"); \
- register unsigned long __sc_7 __asm__ ("r7"); \
- \
- __sc_3 = (unsigned long) (arg1); \
- __sc_4 = (unsigned long) (arg2); \
- __sc_5 = (unsigned long) (arg3); \
- __sc_6 = (unsigned long) (arg4); \
- __sc_7 = (unsigned long) (arg5); \
- __sc_0 = __NR_##name; \
- __asm__ __volatile__ \
- ("sc \n\t" \
- "mfcr %1 " \
- : "=&r" (__sc_3), "=&r" (__sc_0) \
- : "0" (__sc_3), "1" (__sc_0), \
- "r" (__sc_4), \
- "r" (__sc_5), \
- "r" (__sc_6), \
- "r" (__sc_7) \
- : "r8", "r9", "r10", "r11", "r12" ); \
- __sc_ret = __sc_3; \
- __sc_err = __sc_0; \
- } \
- __syscall_return (type); \
-}
-
-
-#undef _syscall6
-#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
-{ \
- unsigned long __sc_ret, __sc_err; \
- { \
- register unsigned long __sc_0 __asm__ ("r0"); \
- register unsigned long __sc_3 __asm__ ("r3"); \
- register unsigned long __sc_4 __asm__ ("r4"); \
- register unsigned long __sc_5 __asm__ ("r5"); \
- register unsigned long __sc_6 __asm__ ("r6"); \
- register unsigned long __sc_7 __asm__ ("r7"); \
- register unsigned long __sc_8 __asm__ ("r8"); \
- \
- __sc_3 = (unsigned long) (arg1); \
- __sc_4 = (unsigned long) (arg2); \
- __sc_5 = (unsigned long) (arg3); \
- __sc_6 = (unsigned long) (arg4); \
- __sc_7 = (unsigned long) (arg5); \
- __sc_8 = (unsigned long) (arg6); \
- __sc_0 = __NR_##name; \
- __asm__ __volatile__ \
- ("sc \n\t" \
- "mfcr %1 " \
- : "=&r" (__sc_3), "=&r" (__sc_0) \
- : "0" (__sc_3), "1" (__sc_0), \
- "r" (__sc_4), \
- "r" (__sc_5), \
- "r" (__sc_6), \
- "r" (__sc_7), \
- "r" (__sc_8) \
- : "r9", "r10", "r11", "r12" ); \
- __sc_ret = __sc_3; \
- __sc_err = __sc_0; \
- } \
- __syscall_return (type); \
-}
-
-
diff --git a/ldso/ldso/powerpc/ld_sysdep.h b/ldso/ldso/powerpc/ld_sysdep.h
deleted file mode 100644
index 8768c9ac4..000000000
--- a/ldso/ldso/powerpc/ld_sysdep.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Various assmbly language/system dependent hacks that are required
- * so that we can minimize the amount of platform specific code.
- */
-
-/*
- * 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.
- */
-#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS)+1)
-
-/*
- * Initialization sequence for a GOT.
- */
-#define INIT_GOT(GOT_BASE,MODULE) _dl_init_got(GOT_BASE,MODULE)
-
-/* Stuff for the PLT. */
-#define PLT_INITIAL_ENTRY_WORDS 18
-#define PLT_LONGBRANCH_ENTRY_WORDS 0
-#define PLT_TRAMPOLINE_ENTRY_WORDS 6
-#define PLT_DOUBLE_SIZE (1<<13)
-#define PLT_ENTRY_START_WORDS(entry_number) \
- (PLT_INITIAL_ENTRY_WORDS + (entry_number)*2 \
- + ((entry_number) > PLT_DOUBLE_SIZE \
- ? ((entry_number) - PLT_DOUBLE_SIZE)*2 \
- : 0))
-#define PLT_DATA_START_WORDS(num_entries) PLT_ENTRY_START_WORDS(num_entries)
-
-/* Macros to build PowerPC opcode words. */
-#define OPCODE_ADDI(rd,ra,simm) \
- (0x38000000 | (rd) << 21 | (ra) << 16 | ((simm) & 0xffff))
-#define OPCODE_ADDIS(rd,ra,simm) \
- (0x3c000000 | (rd) << 21 | (ra) << 16 | ((simm) & 0xffff))
-#define OPCODE_ADD(rd,ra,rb) \
- (0x7c000214 | (rd) << 21 | (ra) << 16 | (rb) << 11)
-#define OPCODE_B(target) (0x48000000 | ((target) & 0x03fffffc))
-#define OPCODE_BA(target) (0x48000002 | ((target) & 0x03fffffc))
-#define OPCODE_BCTR() 0x4e800420
-#define OPCODE_LWZ(rd,d,ra) \
- (0x80000000 | (rd) << 21 | (ra) << 16 | ((d) & 0xffff))
-#define OPCODE_LWZU(rd,d,ra) \
- (0x84000000 | (rd) << 21 | (ra) << 16 | ((d) & 0xffff))
-#define OPCODE_MTCTR(rd) (0x7C0903A6 | (rd) << 21)
-#define OPCODE_RLWINM(ra,rs,sh,mb,me) \
- (0x54000000 | (rs) << 21 | (ra) << 16 | (sh) << 11 | (mb) << 6 | (me) << 1)
-
-#define OPCODE_LI(rd,simm) OPCODE_ADDI(rd,0,simm)
-#define OPCODE_ADDIS_HI(rd,ra,value) \
- OPCODE_ADDIS(rd,ra,((value) + 0x8000) >> 16)
-#define OPCODE_LIS_HI(rd,value) OPCODE_ADDIS_HI(rd,0,value)
-#define OPCODE_SLWI(ra,rs,sh) OPCODE_RLWINM(ra,rs,sh,0,31-sh)
-
-
-#define PPC_DCBST(where) asm volatile ("dcbst 0,%0" : : "r"(where) : "memory")
-#define PPC_SYNC asm volatile ("sync" : : : "memory")
-#define PPC_ISYNC asm volatile ("sync; isync" : : : "memory")
-#define PPC_ICBI(where) asm volatile ("icbi 0,%0" : : "r"(where) : "memory")
-#define PPC_DIE asm volatile ("tweq 0,0")
-
-/*
- * Here is a macro to perform a relocation. This is only used when
- * bootstrapping the dynamic loader. RELP is the relocation that we
- * are performing, REL is the pointer to the address we are relocating.
- * SYMBOL is the symbol involved in the relocation, and LOAD is the
- * load address.
- */
-#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \
- {int type=ELF32_R_TYPE((RELP)->r_info); \
- Elf32_Addr finaladdr=(SYMBOL)+(RELP)->r_addend;\
- if (type==R_PPC_RELATIVE) { \
- *REL=(Elf32_Word)(LOAD)+(RELP)->r_addend;\
- } else if (type==R_PPC_JMP_SLOT) { \
- Elf32_Sword delta=finaladdr-(Elf32_Word)(REL);\
- *REL=OPCODE_B(delta); \
- } else if (type==R_PPC_ADDR32) { \
- *REL=finaladdr; \
- } else { \
- _dl_exit(100+ELF32_R_TYPE((RELP)->r_info)); \
- } \
- PPC_DCBST(REL); PPC_SYNC; PPC_ICBI(REL); \
- }
-/*
- * 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.
- */
-
-/* hgb@ifi.uio.no:
- * Adding a clobber list consisting of r0 for %1. addi on PowerPC
- * takes a register as the second argument, but if the register is
- * r0, the value 0 is used instead. If r0 is used here, the stack
- * pointer (r1) will be zeroed, and the dynamically linked
- * application will seg.fault immediatly when receiving control.
- */
-#define START() \
- __asm__ volatile ( \
- "addi 1,%1,0\n\t" \
- "mtlr %0\n\t" \
- "blrl\n\t" \
- : : "r" (_dl_elf_main), "r" (args) \
- : "r0")
-
-
-/* Here we define the magic numbers that this dynamic loader should accept */
-
-#define MAGIC1 EM_PPC
-#undef MAGIC2
-/* Used for error messages */
-#define ELF_TARGET "powerpc"
-
-struct elf_resolve;
-extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
-void _dl_init_got(unsigned long *lpnt,struct elf_resolve *tpnt);
-
-
-#define do_rem(result, n, base) result = (n % base)
-
-/* 4096 bytes alignment */
-#define PAGE_ALIGN 0xfffff000
-#define ADDR_ALIGN 0xfff
-#define OFFS_ALIGN 0x7ffff000