all repos — mgba @ 28f26e5d1ca61466789d88d70cbbfb69a91d1d60

mGBA Game Boy Advance Emulator

GBA BIOS: Fix clobbered registers in CpuSet (fixes #1531)
Vicki Pfau vi@endrift.com
Sat, 21 Sep 2019 17:47:29 -0700
commit

28f26e5d1ca61466789d88d70cbbfb69a91d1d60

parent

b851cc332e6e1491c176107cf3a6b322b86cb7fe

3 files changed, 46 insertions(+), 41 deletions(-)

jump to
M CHANGESCHANGES

@@ -71,6 +71,7 @@ - Qt: Scale pixel color values to full range (fixes mgba.io/i/1511)

- Qt, OpenGL: Disable integer scaling for dimensions that don't fit - Feature: Switch from ImageMagick to FFmpeg for GIF generation - OpenGL: Only resize textures when needed + - GBA BIOS: Fix clobbered registers in CpuSet (fixes mgba.io/i/1531) 0.7.3: (2019-09-15) Emulation fixes:
M src/gba/hle-bios.csrc/gba/hle-bios.c

@@ -6,7 +6,7 @@ const uint8_t hleBios[SIZE_BIOS] = {

0x06, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x0b, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x00, 0x00, 0xa0, 0xe1, 0x2c, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x02, 0x03, 0xa0, 0xe3, - 0x03, 0x10, 0xd0, 0xe5, 0xea, 0x00, 0x51, 0xe3, 0xec, 0x01, 0x9f, 0x15, + 0x03, 0x10, 0xd0, 0xe5, 0xea, 0x00, 0x51, 0xe3, 0xf8, 0x01, 0x9f, 0x15, 0x10, 0xff, 0x2f, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x29, 0xe1, 0x00, 0x00, 0x5d, 0xe3, 0x01, 0xd3, 0xa0, 0x03, 0x20, 0xd0, 0x4d, 0x02, 0x00, 0x58, 0x2d, 0xe9, 0x02, 0xb0, 0x5e, 0xe5, 0x9c, 0xc0, 0xa0, 0xe3,

@@ -20,7 +20,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, - 0xc8, 0x01, 0x00, 0x00, 0x0f, 0x50, 0x2d, 0xe9, 0x01, 0x03, 0xa0, 0xe3, + 0xd4, 0x01, 0x00, 0x00, 0x0f, 0x50, 0x2d, 0xe9, 0x01, 0x03, 0xa0, 0xe3, 0x00, 0xe0, 0x8f, 0xe2, 0x04, 0xf0, 0x10, 0xe5, 0x0f, 0x50, 0xbd, 0xe8, 0x04, 0xf0, 0x5e, 0xe2, 0x00, 0x00, 0x00, 0x00, 0x02, 0xc0, 0x5e, 0xe5, 0x01, 0x00, 0xa0, 0xe3, 0x01, 0x10, 0xa0, 0xe3, 0x0c, 0x40, 0x2d, 0xe9,

@@ -29,18 +29,19 @@ 0x01, 0x20, 0xa0, 0xe3, 0x03, 0x00, 0x00, 0x0a, 0xb8, 0x30, 0x5c, 0xe1,

0x01, 0x30, 0xc3, 0xe1, 0xb8, 0x30, 0x4c, 0xe1, 0x01, 0x03, 0xcc, 0xe5, 0x08, 0x02, 0xcc, 0xe5, 0xb8, 0x30, 0x5c, 0xe1, 0x01, 0x30, 0x13, 0xe0, 0x01, 0x30, 0x23, 0x10, 0xb8, 0x30, 0x4c, 0x11, 0x08, 0x22, 0xcc, 0xe5, - 0xf7, 0xff, 0xff, 0x0a, 0x0c, 0x80, 0xbd, 0xe8, 0x00, 0x40, 0x2d, 0xe9, - 0x02, 0x36, 0xa0, 0xe1, 0x01, 0x04, 0x12, 0xe3, 0x0f, 0x00, 0x00, 0x0a, - 0x01, 0x03, 0x12, 0xe3, 0x05, 0x00, 0x00, 0x0a, 0x23, 0x35, 0x81, 0xe0, - 0x04, 0x00, 0xb0, 0xe8, 0x03, 0x00, 0x51, 0xe1, 0x04, 0x00, 0xa1, 0xb8, - 0xfc, 0xff, 0xff, 0xba, 0x14, 0x00, 0x00, 0xea, 0x01, 0x00, 0xc0, 0xe3, - 0x01, 0x10, 0xc1, 0xe3, 0xa3, 0x35, 0x81, 0xe0, 0xb0, 0x20, 0xd0, 0xe1, - 0x03, 0x00, 0x51, 0xe1, 0xb2, 0x20, 0xc1, 0xb0, 0xfc, 0xff, 0xff, 0xba, - 0x0c, 0x00, 0x00, 0xea, 0x01, 0x03, 0x12, 0xe3, 0x05, 0x00, 0x00, 0x0a, - 0x23, 0x35, 0x81, 0xe0, 0x03, 0x00, 0x51, 0xe1, 0x04, 0x00, 0xb0, 0xb8, - 0x04, 0x00, 0xa1, 0xb8, 0xfb, 0xff, 0xff, 0xba, 0x04, 0x00, 0x00, 0xea, - 0xa3, 0x35, 0x81, 0xe0, 0x03, 0x00, 0x51, 0xe1, 0xb2, 0x20, 0xd0, 0xb0, - 0xb2, 0x20, 0xc1, 0xb0, 0xfb, 0xff, 0xff, 0xba, 0x00, 0x80, 0xbd, 0xe8, + 0xf7, 0xff, 0xff, 0x0a, 0x0c, 0x80, 0xbd, 0xe8, 0x30, 0x40, 0x2d, 0xe9, + 0x02, 0x46, 0xa0, 0xe1, 0x00, 0xc0, 0xa0, 0xe1, 0x01, 0x50, 0xa0, 0xe1, + 0x01, 0x04, 0x12, 0xe3, 0x0f, 0x00, 0x00, 0x0a, 0x01, 0x03, 0x12, 0xe3, + 0x05, 0x00, 0x00, 0x0a, 0x24, 0x45, 0x85, 0xe0, 0x08, 0x00, 0xbc, 0xe8, + 0x04, 0x00, 0x55, 0xe1, 0x08, 0x00, 0xa5, 0xb8, 0xfc, 0xff, 0xff, 0xba, + 0x14, 0x00, 0x00, 0xea, 0x01, 0xc0, 0xcc, 0xe3, 0x01, 0x50, 0xc5, 0xe3, + 0xa4, 0x45, 0x85, 0xe0, 0xb0, 0x30, 0xdc, 0xe1, 0x04, 0x00, 0x55, 0xe1, + 0xb2, 0x30, 0xc5, 0xb0, 0xfc, 0xff, 0xff, 0xba, 0x0c, 0x00, 0x00, 0xea, + 0x01, 0x03, 0x12, 0xe3, 0x05, 0x00, 0x00, 0x0a, 0x24, 0x45, 0x85, 0xe0, + 0x04, 0x00, 0x55, 0xe1, 0x08, 0x00, 0xbc, 0xb8, 0x08, 0x00, 0xa5, 0xb8, + 0xfb, 0xff, 0xff, 0xba, 0x04, 0x00, 0x00, 0xea, 0xa4, 0x45, 0x85, 0xe0, + 0x04, 0x00, 0x55, 0xe1, 0xb2, 0x30, 0xdc, 0xb0, 0xb2, 0x30, 0xc5, 0xb0, + 0xfb, 0xff, 0xff, 0xba, 0x17, 0x3e, 0xa0, 0xe3, 0x30, 0x80, 0xbd, 0xe8, 0xf0, 0x47, 0x2d, 0xe9, 0x01, 0x04, 0x12, 0xe3, 0x02, 0x36, 0xa0, 0xe1, 0x23, 0x25, 0x81, 0xe0, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x30, 0x90, 0xe5, 0x03, 0x40, 0xa0, 0xe1, 0x03, 0x50, 0xa0, 0xe1, 0x03, 0x60, 0xa0, 0xe1,
M src/gba/hle-bios.ssrc/gba/hle-bios.s

@@ -106,54 +106,57 @@ beq 0b

ldmfd sp!, {r2-r3, pc} CpuSet: -stmfd sp!, {lr} -mov r3, r2, lsl #12 +stmfd sp!, {r4, r5, lr} +mov r4, r2, lsl #12 +mov r12, r0 +mov r5, r1 tst r2, #0x01000000 beq 0f -# Fill +@ Fill tst r2, #0x04000000 beq 1f -# Word -add r3, r1, r3, lsr #10 -ldmia r0!, {r2} +@ Word +add r4, r5, r4, lsr #10 +ldmia r12!, {r3} 2: -cmp r1, r3 -stmltia r1!, {r2} +cmp r5, r4 +stmltia r5!, {r3} blt 2b b 3f -# Halfword +@ Halfword 1: -bic r0, #1 -bic r1, #1 -add r3, r1, r3, lsr #11 -ldrh r2, [r0] +bic r12, #1 +bic r5, #1 +add r4, r5, r4, lsr #11 +ldrh r3, [r12] 2: -cmp r1, r3 -strlth r2, [r1], #2 +cmp r5, r4 +strlth r3, [r5], #2 blt 2b b 3f -# Copy +@ Copy 0: tst r2, #0x04000000 beq 1f -# Word -add r3, r1, r3, lsr #10 +@ Word +add r4, r5, r4, lsr #10 2: -cmp r1, r3 -ldmltia r0!, {r2} -stmltia r1!, {r2} +cmp r5, r4 +ldmltia r12!, {r3} +stmltia r5!, {r3} blt 2b b 3f -# Halfword +@ Halfword 1: -add r3, r1, r3, lsr #11 +add r4, r5, r4, lsr #11 2: -cmp r1, r3 -ldrlth r2, [r0], #2 -strlth r2, [r1], #2 +cmp r5, r4 +ldrlth r3, [r12], #2 +strlth r3, [r5], #2 blt 2b 3: -ldmfd sp!, {pc} +mov r3, #0x170 @ Match official BIOS's clobbered r3 +ldmfd sp!, {r4, r5, pc} CpuFastSet: stmfd sp!, {r4-r10, lr}