mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-29 04:24:17 +01:00
ELF: Fix crash due to not allocating recompiler ranges (#1154)
This commit is contained in:
parent
85141f17f9
commit
075eac626b
@ -50,6 +50,10 @@ typedef struct
|
|||||||
|
|
||||||
static_assert(sizeof(elfSectionEntry_t) == 0x28, "");
|
static_assert(sizeof(elfSectionEntry_t) == 0x28, "");
|
||||||
|
|
||||||
|
#define PF_X (1 << 0) /* Segment is executable */
|
||||||
|
#define PF_W (1 << 1) /* Segment is writable */
|
||||||
|
#define PF_R (1 << 2) /* Segment is readable */
|
||||||
|
|
||||||
// Map elf into memory
|
// Map elf into memory
|
||||||
uint32 ELF_LoadFromMemory(uint8* elfData, sint32 size, const char* name)
|
uint32 ELF_LoadFromMemory(uint8* elfData, sint32 size, const char* name)
|
||||||
{
|
{
|
||||||
@ -68,6 +72,7 @@ uint32 ELF_LoadFromMemory(uint8* elfData, sint32 size, const char* name)
|
|||||||
uint32 shSize = (uint32)sectionTable[i].shSize;
|
uint32 shSize = (uint32)sectionTable[i].shSize;
|
||||||
uint32 shOffset = (uint32)sectionTable[i].shOffset;
|
uint32 shOffset = (uint32)sectionTable[i].shOffset;
|
||||||
uint32 shType = (uint32)sectionTable[i].shType;
|
uint32 shType = (uint32)sectionTable[i].shType;
|
||||||
|
uint32 shFlags = (uint32)sectionTable[i].shFlags;
|
||||||
|
|
||||||
if (shOffset > (uint32)size)
|
if (shOffset > (uint32)size)
|
||||||
{
|
{
|
||||||
@ -89,6 +94,8 @@ uint32 ELF_LoadFromMemory(uint8* elfData, sint32 size, const char* name)
|
|||||||
}
|
}
|
||||||
// SHT_NOBITS
|
// SHT_NOBITS
|
||||||
}
|
}
|
||||||
|
if((shFlags & PF_X) > 0)
|
||||||
|
PPCRecompiler_allocateRange(shAddr, shSize);
|
||||||
}
|
}
|
||||||
return header->entrypoint;
|
return header->entrypoint;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user