20 #include "DynamicLinker.h" 21 #include "modules/Module.h" 22 #include "modules/system/vfs/VFS.h" 23 #include "pedigree/kernel/Log.h" 24 #include "pedigree/kernel/panic.h" 25 #include "pedigree/kernel/process/Scheduler.h" 26 #include "pedigree/kernel/processor/KernelCoreSyscallManager.h" 27 #include "pedigree/kernel/processor/PhysicalMemoryManager.h" 28 #include "pedigree/kernel/processor/Processor.h" 29 #include "pedigree/kernel/processor/VirtualAddressSpace.h" 30 #include "pedigree/kernel/utilities/StaticString.h" 32 extern "C" void plt_resolve(
void);
34 #define HA(x) (((x >> 16) + ((x & 0x8000) ? 1 : 0)) & 0xFFFF) 49 uintptr_t pltEntries = prePlt + 72;
51 uintptr_t postPlt = pltEntries + pltSize;
59 reinterpret_cast<uint8_t *>(prePlt),
60 reinterpret_cast<uint8_t *>(&::plt_resolve),
70 uint32_t *pWord = (uint32_t *) (prePlt + 4 * 4);
71 *pWord = (*pWord) | HA(value);
74 *pWord = (*pWord) | (value & 0xFFFF);
76 pWord = (uint32_t *) (prePlt + 13 * 4);
77 *pWord = (*pWord) | HA(postPlt);
80 *pWord = (*pWord) | (postPlt & 0xFFFF);
87 for (
int i = 0; i < pltSize / 8; i++)
94 uint32_t addi = 0x39600000 | (4 * i);
101 int32_t offset = (int32_t) postPlt - (int32_t)(pltEntries + 8 * i + 4);
102 uint32_t b = 0x48000000 | offset;
104 uint32_t *pEntry = (uint32_t *) (pltEntries + i * 8);
115 uintptr_t loadBase = 0;
117 pOrigElf = m_ProcessElfs.lookup(
121 pElf = m_ProcessElfs.lookup(
132 it != pList->
end(); it++)
134 pElf = findElf(libraryId, *it, loadBase);
142 symIdx / 4, pOrigElf->getSymbolTable(), loadBase,
static ProcessorInformation & information()
uintptr_t resolvePltSymbol(uintptr_t libraryId, uintptr_t symIdx)
::Iterator< T, node_t > Iterator
uintptr_t applySpecificRelocation(uintptr_t off, SymbolTable *pSymtab, uintptr_t loadBase, SymbolTable::Policy policy=SymbolTable::LocalFirst)
uintptr_t getGlobalOffsetTable()
void initPlt(Elf *pElf, uintptr_t value)