mirror of https://github.com/mgba-emu/mgba.git
Core: Fix ELF loading regression (fixes #1669)
This commit is contained in:
parent
9c88d48806
commit
7d382e82a6
1
CHANGES
1
CHANGES
|
@ -12,6 +12,7 @@ Emulation fixes:
|
||||||
- GBA Video: Fix Hblank timing
|
- GBA Video: Fix Hblank timing
|
||||||
Other fixes:
|
Other fixes:
|
||||||
- Core: Ensure ELF regions can be written before trying
|
- Core: Ensure ELF regions can be written before trying
|
||||||
|
- Core: Fix ELF loading regression (fixes mgba.io/i/1669)
|
||||||
- Debugger: Don't skip undefined instructions when debugger attached
|
- Debugger: Don't skip undefined instructions when debugger attached
|
||||||
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)
|
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)
|
||||||
Misc:
|
Misc:
|
||||||
|
|
|
@ -377,7 +377,7 @@ bool mCoreLoadELF(struct mCore* core, struct ELF* elf) {
|
||||||
Elf32_Phdr* phdr = ELFProgramHeadersGetPointer(&ph, i);
|
Elf32_Phdr* phdr = ELFProgramHeadersGetPointer(&ph, i);
|
||||||
void* block = mCoreGetMemoryBlockMasked(core, phdr->p_paddr, &bsize, mCORE_MEMORY_WRITE | mCORE_MEMORY_WORM);
|
void* block = mCoreGetMemoryBlockMasked(core, phdr->p_paddr, &bsize, mCORE_MEMORY_WRITE | mCORE_MEMORY_WORM);
|
||||||
char* bytes = ELFBytes(elf, &esize);
|
char* bytes = ELFBytes(elf, &esize);
|
||||||
if (block && bsize >= phdr->p_filesz && bsize > phdr->p_offset && esize >= phdr->p_filesz + phdr->p_offset) {
|
if (block && bsize >= phdr->p_filesz && esize > phdr->p_offset && esize >= phdr->p_filesz + phdr->p_offset) {
|
||||||
memcpy(block, &bytes[phdr->p_offset], phdr->p_filesz);
|
memcpy(block, &bytes[phdr->p_offset], phdr->p_filesz);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue