diff options
author | Markos Chandras <markos.chandras@imgtec.com> | 2010-09-21 12:43:19 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2013-03-14 22:47:08 +0100 |
commit | e3436cc40d8ebf4303d0ba5bb24f21edf41fd1e8 (patch) | |
tree | 602f66aec3ddb19cf9af50ce9382c33d1334bfcc /ldso/ldso/metag/dl-inlines.h | |
parent | cf349fcbb555b77f22d96fe3a7b25579337ab989 (diff) |
metag: Add support for loading shared objects into core memories.
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-inlines.h')
-rw-r--r-- | ldso/ldso/metag/dl-inlines.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/ldso/ldso/metag/dl-inlines.h b/ldso/ldso/metag/dl-inlines.h new file mode 100644 index 000000000..82fba93ab --- /dev/null +++ b/ldso/ldso/metag/dl-inlines.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2013, Imagination Technologies Ltd. + * + * Licensed under LGPL v2.1 or later, see the file COPYING.LIB in this tarball. + */ + +static __always_inline int +__dl_is_special_segment (Elf32_Ehdr *epnt, + Elf32_Phdr *ppnt) +{ + if (ppnt->p_type != PT_LOAD && + ppnt->p_type != PT_DYNAMIC) + return 0; + + if (ppnt->p_vaddr >= 0x80000000 && + ppnt->p_vaddr < 0x82060000) + return 1; + + if (ppnt->p_vaddr >= 0xe0200000 && + ppnt->p_vaddr < 0xe0260000) + return 1; + + return 0; +} + +static __always_inline char * +__dl_map_segment (Elf32_Ehdr *epnt, + Elf32_Phdr *ppnt, + int infile, + int flags) +{ + char *addr = (char *)ppnt->p_vaddr; + + if (_DL_PREAD (infile, addr, ppnt->p_filesz, ppnt->p_offset) != ppnt->p_filesz) { + return 0; + } + + return addr; +} |