Merge branch 'master' into medusa
Vicki Pfau vi@endrift.com
Wed, 22 Jul 2020 00:21:09 -0700
3 files changed,
31 insertions(+),
5 deletions(-)
M
CHANGES
→
CHANGES
@@ -65,6 +65,7 @@ - Debugger: Don't skip undefined instructions when debugger attached
- FFmpeg: Fix some small memory leaks - FFmpeg: Fix encoding of time base - GB Core: Fix extracting SRAM when none is present + - GBA: Fix leak if attempting to load BIOS multiple times - GBA Savedata: Fix extracting save when not yet configured in-game - Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642) - Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769)
M
src/gba/gba.c
→
src/gba/gba.c
@@ -443,7 +443,6 @@ GBARaiseIRQ(gba, IRQ_GAMEPAK, 0);
} void GBALoadBIOS(struct GBA* gba, struct VFile* vf) { - gba->biosVf = vf; if (vf->size(vf) != SIZE_BIOS) { mLOG(GBA, WARN, "Incorrect BIOS size"); return;@@ -453,6 +452,11 @@ if (!bios) {
mLOG(GBA, WARN, "Couldn't map BIOS"); return; } + if (gba->biosVf) { + gba->biosVf->unmap(gba->biosVf, gba->memory.bios, SIZE_BIOS); + gba->biosVf->close(gba->biosVf); + } + gba->biosVf = vf; gba->memory.bios = bios; gba->memory.fullBios = 1; uint32_t checksum = GBAChecksum(gba->memory.bios, SIZE_BIOS);@@ -733,13 +737,13 @@ }
void GBAIllegal(struct ARMCore* cpu, uint32_t opcode) { struct GBA* gba = (struct GBA*) cpu->master; + if (cpu->executionMode == MODE_THUMB && (opcode & 0xFFC0) == 0xE800) { + mLOG(GBA, INFO, "Hit Wii U VC opcode: %08x", opcode); + return; + } if (!gba->yankedRomSize) { // TODO: More sensible category? mLOG(GBA, WARN, "Illegal opcode: %08x", opcode); - } - if (cpu->executionMode == MODE_THUMB && (opcode & 0xFFC0) == 0xE800) { - mLOG(GBA, DEBUG, "Hit Wii U VC opcode: %08x", opcode); - return; } #ifdef USE_DEBUGGERS if (gba->debugger) {
M
src/platform/posix/memory.c
→
src/platform/posix/memory.c
@@ -5,6 +5,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <mgba-util/memory.h> +#ifndef DISABLE_ANON_MMAP +#ifdef __SANITIZE_ADDRESS__ +#define DISABLE_ANON_MMAP +#elif defined(__has_feature) +#if __has_feature(address_sanitizer) +#define DISABLE_ANON_MMAP +#endif +#endif +#endif + +#ifndef DISABLE_ANON_MMAP #include <sys/mman.h> void* anonymousMemoryMap(size_t size) {@@ -14,3 +25,13 @@
void mappedMemoryFree(void* memory, size_t size) { munmap(memory, size); } +#else +void* anonymousMemoryMap(size_t size) { + return calloc(1, size); +} + +void mappedMemoryFree(void* memory, size_t size) { + UNUSED(size); + free(memory); +} +#endif