123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #ifndef _BITS_ELF_DSBT_H
- #define _BITS_ELF_DSBT_H
- #include <elf.h>
- struct elf32_dsbt_loadseg
- {
-
- Elf32_Addr addr;
-
- Elf32_Addr p_vaddr;
-
- Elf32_Word p_memsz;
- };
- struct elf32_dsbt_loadmap {
-
- Elf32_Half version;
-
- Elf32_Half nsegs;
-
- struct elf32_dsbt_loadseg segs[0];
- };
- struct elf32_dsbt_loadaddr {
- struct elf32_dsbt_loadmap *map;
- };
- static __always_inline void *
- __reloc_pointer (void *p,
- const struct elf32_dsbt_loadmap *map)
- {
- int c;
- #if 0
- if (map->version != 0)
-
- ((void(*)())0)();
- #endif
-
- for (c = 0; c < map->nsegs; c++)
- {
- unsigned long offset = (char*)p - (char*)map->segs[c].p_vaddr;
-
- if (offset < map->segs[c].p_memsz
- || (offset == map->segs[c].p_memsz && c == 1))
- return (char*)map->segs[c].addr + offset;
- }
-
- return (void*)-1;
- }
- # define __RELOC_POINTER(ptr, loadaddr) \
- (__reloc_pointer ((void*)(ptr), \
- (loadaddr).map))
- #endif
|