FireBirdLib - Topfield TMS PVR TAP Programming Library
FindGotPointer.c
Go to the documentation of this file.
1#include "libFireBird.h"
2
3dword *FindGotPointer(dword FunctionAddress)
4{
6
7 static dword gotStart = 0, gotEnd = 0;
8 dword SectionIndex;
9 dword *got;
10
11 if(!gotStart)
12 {
14 {
15 SectionIndex = ELFGetSectionIndex(".got");
16 if(SectionIndex)
17 {
18 ELFGetSectionAddress(SectionIndex, &gotStart, &gotEnd);
19 gotEnd += gotStart;
20 }
21 }
22 ELFCleanup();
23 }
24
25 got = (dword*)gotStart;
26 while(got < (dword*)gotEnd)
27 {
28 if(*got == FunctionAddress)
29 {
30 TRACEEXIT();
31
32 return got;
33 }
34 got++;
35 }
36
37 TRACEEXIT();
38 return 0;
39}
void ELFCleanup(void)
Definition: ELFCleanup.c:5
bool ELFGetSectionAddress(dword SectionIndex, dword *SectionAddress, dword *SectionSize)
dword ELFGetSectionIndex(const char *SectionName)
bool ELFOpenFile(const char *FileName)
Definition: ELFOpenFile.c:12
bool ELFReadELFHeader(void)
bool ELFReadSectionHeaders(void)
bool ELFReadShstrtabSection(void)
dword * FindGotPointer(dword FunctionAddress)
Definition: FindGotPointer.c:3
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243