GBA BIOS: Fix user stack usage regression

This commit is contained in:
Vicki Pfau 2020-08-13 00:47:17 -07:00
parent 95f07c3131
commit c3a31c8dc9
3 changed files with 14 additions and 14 deletions

View File

@ -423,7 +423,7 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
switch (immediate) {
case 0xF0: // Used for internal stall counting
cpu->gprs[4] = gba->biosStall;
cpu->gprs[12] = gba->biosStall;
return;
case 0xFA:
GBAPrintFlush(gba);

View File

@ -9,17 +9,17 @@ const uint8_t hleBios[SIZE_BIOS] = {
0x03, 0x10, 0xd0, 0xe5, 0xea, 0x00, 0x51, 0xe3, 0x4c, 0x01, 0x9f, 0x15,
0x10, 0xff, 0x2f, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x29, 0xe1,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, 0xe3, 0x01, 0xd3, 0xa0, 0x03,
0x20, 0xd0, 0x4d, 0x02, 0x10, 0x58, 0x2d, 0xe9, 0x02, 0xb0, 0x5e, 0xe5,
0x20, 0xd0, 0x4d, 0x02, 0x00, 0x58, 0x2d, 0xe9, 0x02, 0xb0, 0x5e, 0xe5,
0xd4, 0xc0, 0xa0, 0xe3, 0x0b, 0xb1, 0x9c, 0xe7, 0xd2, 0xcf, 0xa0, 0xe3,
0x0b, 0x00, 0x5c, 0xe1, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0xc0, 0x4f, 0xe1,
0x00, 0x10, 0x2d, 0xe9, 0x80, 0xc0, 0x0c, 0xe2, 0x1f, 0xc0, 0x8c, 0xe3,
0x0c, 0xf0, 0x21, 0xe1, 0x00, 0x40, 0x2d, 0xe9, 0x00, 0x00, 0x5b, 0xe3,
0x0b, 0x00, 0x5c, 0xe1, 0x00, 0xc0, 0x4f, 0xe1, 0x00, 0x10, 0x2d, 0xe9,
0x80, 0xc0, 0x0c, 0xe2, 0x1f, 0xc0, 0x8c, 0xe3, 0x0c, 0xf0, 0x21, 0xe1,
0x00, 0x00, 0xf0, 0x0f, 0x04, 0x40, 0x2d, 0xe9, 0x00, 0x00, 0x5b, 0xe3,
0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1,
0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1,
0x0f, 0xe0, 0xa0, 0xe1, 0x1b, 0xff, 0x2f, 0x11, 0x00, 0x00, 0xa0, 0xe1,
0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1, 0x00, 0x40, 0xbd, 0xe8,
0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1, 0x04, 0x40, 0xbd, 0xe8,
0x93, 0xf0, 0x29, 0xe3, 0x00, 0x10, 0xbd, 0xe8, 0x0c, 0xf0, 0x69, 0xe1,
0x10, 0x58, 0xbd, 0xe8, 0x0e, 0xf0, 0xb0, 0xe1, 0x00, 0x00, 0x00, 0x00,
0x00, 0x58, 0xbd, 0xe8, 0x0e, 0xf0, 0xb0, 0xe1, 0x00, 0x00, 0x00, 0x00,
0x04, 0x20, 0xa0, 0xe3, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
0xb0, 0x01, 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
0xcc, 0x01, 0x00, 0x00, 0xc4, 0x01, 0x00, 0x00, 0x48, 0x03, 0x00, 0x00,
@ -73,5 +73,5 @@ const uint8_t hleBios[SIZE_BIOS] = {
0x01, 0xa0, 0xa0, 0xe1, 0xfa, 0x07, 0xa0, 0xe8, 0xfa, 0x07, 0xa0, 0xe8,
0xfa, 0x07, 0xa0, 0xe8, 0xfa, 0x07, 0xa0, 0xe8, 0x00, 0x10, 0xa0, 0xe3,
0xf0, 0x07, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, 0xb0, 0x01, 0x00, 0x00,
0x04, 0x40, 0x54, 0xe2, 0xfd, 0xff, 0xff, 0x8a, 0x1e, 0xff, 0x2f, 0xe1
0x04, 0xc0, 0x5c, 0xe2, 0xfd, 0xff, 0xff, 0x8a, 0x1e, 0xff, 0x2f, 0xe1
};

View File

@ -31,19 +31,19 @@ swiBase:
cmp sp, #0
moveq sp, #0x04000000
subeq sp, #0x20
stmfd sp!, {r4, r11-r12, lr}
stmfd sp!, {r11-r12, lr}
ldrb r11, [lr, #-2]
mov r12, #swiTable
ldr r11, [r12, r11, lsl #2]
mov r12, #StallCall
cmp r12, r11
swieq 0xF00000 @ Special mGBA-internal call to load the stall count into r4
mrs r12, spsr
stmfd sp!, {r12}
and r12, #0x80
orr r12, #0x1F
msr cpsr_c, r12
stmfd sp!, {lr}
swieq 0xF00000 @ Special mGBA-internal call to load the stall count into r12
stmfd sp!, {r2, lr}
cmp r11, #0
nop
nop
@ -56,11 +56,11 @@ bxne r11
nop
nop
nop
ldmfd sp!, {lr}
ldmfd sp!, {r2, lr}
msr cpsr, #0x93
ldmfd sp!, {r12}
msr spsr, r12
ldmfd sp!, {r4, r11-r12, lr}
ldmfd sp!, {r11-r12, lr}
movs pc, lr
.word 0
.word 0xE3A02004
@ -310,6 +310,6 @@ ArcTan:
ArcTan2:
StallCall:
subs r4, #4
subs r12, #4
bhi StallCall
bx lr