diff options
author | Markos Chandras <markos.chandras@imgtec.com> | 2008-02-05 14:51:48 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2013-03-14 22:45:15 +0100 |
commit | 22686a1383c4a4a319eaaa6b16b1a9540114bd66 (patch) | |
tree | 04e12086f9187c150ba6a33db0368b9903e50363 /ldso/ldso/metag/dl-startup.h | |
parent | 37439e66a31f251eba39604885f57099a43d943d (diff) |
Add support for the Meta architecture
Meta cores are 32-bit, hardware multithreaded, general purpose, embedded
processors which also feature a DSP instruction set, and can be found in
many digital radios. They are capable of running different operating
systems on different hardware threads, for example a digital radio might
run RTOSes for DAB decoding and audio decoding on 3 hardware threads,
and run Linux on the 4th hardware thread to manage the user interface,
networking etc. HTPs are also capable of running SMP Linux on multiple
hardware threads.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'ldso/ldso/metag/dl-startup.h')
-rw-r--r-- | ldso/ldso/metag/dl-startup.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/ldso/ldso/metag/dl-startup.h b/ldso/ldso/metag/dl-startup.h new file mode 100644 index 000000000..8dbf747e1 --- /dev/null +++ b/ldso/ldso/metag/dl-startup.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2013 Imagination Technologies Ltd. + * + * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. + */ + +/* + * This code fixes the stack pointer so that the dynamic linker + * can find argc, argv and auxvt (Auxillary Vector Table). + */ + +__asm__ ( +" .text\n" +" .global __start\n" +" .type __start,@function\n" +" .hidden __start\n" +"_start:\n" +"__start:\n" +" MSETL [A0StP++],D0Ar4,D0Ar2\n" +" MOV D1Ar1,D0Ar2\n" +" CALLR D1RtP,__dl_start\n" +" GETL D0Ar2,D1Ar1,[A0StP+#-(1*8)]\n" +" GETL D0Ar4,D1Ar3,[A0StP+#-(2*8)]\n" +" SUB A0StP,A0StP,#(2*8)\n" +" MOV PC,D0Re0\n" +" .size __start,.-__start\n" +" .previous\n" +); + + +/* + * 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)) + + +/* Handle relocation of the symbols in the dynamic loader. */ +static inline +void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr, + unsigned long symbol_addr, unsigned long load_addr, Elf32_Sym *symtab) +{ + switch (ELF32_R_TYPE(rpnt->r_info)) { + case R_METAG_GLOB_DAT: + case R_METAG_JMP_SLOT: + case R_METAG_ADDR32: + *reloc_addr = symbol_addr; + break; + case R_METAG_RELATIVE: + *reloc_addr = load_addr + rpnt->r_addend; + break; + case R_METAG_RELBRANCH: + *reloc_addr = symbol_addr + rpnt->r_addend - *reloc_addr - 4; + break; + case R_METAG_NONE: + break; + default: + _dl_exit(1); + break; + } +} |