Prepare for 64-bit support
This commit is contained in:
@@ -177,7 +177,7 @@ namespace Il2CppInspector
|
||||
return true;
|
||||
}
|
||||
|
||||
public override Dictionary<string, uint> GetSymbolTable() {
|
||||
public override Dictionary<string, ulong> GetSymbolTable() {
|
||||
// Three possible symbol tables in ELF files
|
||||
var pTables = new List<(uint offset, uint count, uint strings)>();
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace Il2CppInspector
|
||||
}
|
||||
|
||||
// Now iterate through all of the symbol and string tables we found to build a full list
|
||||
var symbolTable = new Dictionary<string, uint>();
|
||||
var symbolTable = new Dictionary<string, ulong>();
|
||||
|
||||
foreach (var pTab in pTables) {
|
||||
var symbol_table = ReadArray<elf_32_sym>(pTab.offset, (int) pTab.count);
|
||||
@@ -238,10 +238,10 @@ namespace Il2CppInspector
|
||||
// Map a virtual address to an offset into the image file. Throws an exception if the virtual address is not mapped into the file.
|
||||
// Note if uiAddr is a valid segment but filesz < memsz and the adjusted uiAddr falls between the range of filesz and memsz,
|
||||
// an exception will be thrown. This area of memory is assumed to contain all zeroes.
|
||||
public override uint MapVATR(uint uiAddr)
|
||||
{
|
||||
var program_header_table = this.program_header_table.First(x => uiAddr >= x.p_vaddr && uiAddr <= (x.p_vaddr + x.p_filesz));
|
||||
return uiAddr - (program_header_table.p_vaddr - program_header_table.p_offset);
|
||||
public override uint MapVATR(ulong uiAddr) {
|
||||
var addr32 = (uint) uiAddr; // 32-bit implementation
|
||||
var program_header_table = this.program_header_table.First(x => addr32 >= x.p_vaddr && addr32 <= (x.p_vaddr + x.p_filesz));
|
||||
return addr32 - (program_header_table.p_vaddr - program_header_table.p_offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,13 +132,13 @@ namespace Il2CppInspector
|
||||
return functionPointers.ToArray();
|
||||
}
|
||||
|
||||
public override uint MapVATR(uint uiAddr) {
|
||||
public override uint MapVATR(ulong uiAddr) {
|
||||
if (!is64) {
|
||||
var section = sections.First(x => uiAddr >= x.Address && uiAddr <= (x.Address + x.Size));
|
||||
return uiAddr - (section.Address - section.ImageOffset);
|
||||
return (uint) (uiAddr - (section.Address - section.ImageOffset));
|
||||
}
|
||||
var section64 = sections64.First(x => uiAddr >= x.Address && uiAddr <= (x.Address + x.Size));
|
||||
return uiAddr - ((uint)section64.Address - section64.ImageOffset);
|
||||
return (uint) (uiAddr - ((uint)section64.Address - section64.ImageOffset));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,13 +91,13 @@ namespace Il2CppInspector
|
||||
return addrs.ToArray();
|
||||
}
|
||||
|
||||
public override uint MapVATR(uint uiAddr) {
|
||||
public override uint MapVATR(ulong uiAddr) {
|
||||
if (uiAddr == 0)
|
||||
return 0;
|
||||
|
||||
var section = sections.First(x => uiAddr - GlobalOffset >= x.BaseMemory &&
|
||||
uiAddr - GlobalOffset < x.BaseMemory + x.SizeImage);
|
||||
return uiAddr - section.BaseMemory - GlobalOffset + section.BaseImage;
|
||||
return (uint) (uiAddr - section.BaseMemory - GlobalOffset + section.BaseImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user