mirror of https://github.com/mgba-emu/mgba.git
HLE BIOS SVC handler stores r11 and r12 instead of r4 and r5
This commit is contained in:
parent
8a6254cc73
commit
2c5fd6acd5
|
@ -7,12 +7,12 @@ const uint8_t hleBios[SIZE_BIOS] = {
|
|||
0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x00, 0x00, 0xa0, 0xe1,
|
||||
0x24, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x02, 0xf3, 0xa0, 0xe3,
|
||||
0x00, 0x00, 0x5d, 0xe3, 0x01, 0xd3, 0xa0, 0x03, 0x20, 0xd0, 0x4d, 0x02,
|
||||
0x30, 0x40, 0x2d, 0xe9, 0x02, 0x40, 0x5e, 0xe5, 0x7c, 0x50, 0xa0, 0xe3,
|
||||
0x04, 0x41, 0x95, 0xe7, 0x00, 0x00, 0x54, 0xe3, 0x00, 0x50, 0x4f, 0xe1,
|
||||
0x20, 0x00, 0x2d, 0xe9, 0x80, 0x50, 0x05, 0xe2, 0x1f, 0x50, 0x85, 0xe3,
|
||||
0x05, 0xf0, 0x29, 0xe1, 0x00, 0x40, 0x2d, 0xe9, 0x0f, 0xe0, 0xa0, 0xe1,
|
||||
0x14, 0xff, 0x2f, 0x11, 0x00, 0x40, 0xbd, 0xe8, 0x93, 0xf0, 0x29, 0xe3,
|
||||
0x20, 0x00, 0xbd, 0xe8, 0x05, 0xf0, 0x69, 0xe1, 0x30, 0x40, 0xbd, 0xe8,
|
||||
0x00, 0x58, 0x2d, 0xe9, 0x02, 0xb0, 0x5e, 0xe5, 0x7c, 0xc0, 0xa0, 0xe3,
|
||||
0x0b, 0xb1, 0x9c, 0xe7, 0x00, 0x00, 0x5b, 0xe3, 0x00, 0xc0, 0x4f, 0xe1,
|
||||
0x00, 0x10, 0x2d, 0xe9, 0x80, 0xc0, 0x0c, 0xe2, 0x1f, 0xc0, 0x8c, 0xe3,
|
||||
0x0c, 0xf0, 0x29, 0xe1, 0x00, 0x40, 0x2d, 0xe9, 0x0f, 0xe0, 0xa0, 0xe1,
|
||||
0x1b, 0xff, 0x2f, 0x11, 0x00, 0x40, 0xbd, 0xe8, 0x93, 0xf0, 0x29, 0xe3,
|
||||
0x00, 0x10, 0xbd, 0xe8, 0x0c, 0xf0, 0x69, 0xe1, 0x00, 0x58, 0xbd, 0xe8,
|
||||
0x0e, 0xf0, 0xb0, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00,
|
||||
0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -20,11 +20,11 @@ const uint8_t hleBios[SIZE_BIOS] = {
|
|||
0x0c, 0x01, 0x00, 0x00, 0x9c, 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, 0x01, 0x00, 0xa0, 0xe3,
|
||||
0x01, 0x10, 0xa0, 0xe3, 0x0c, 0x40, 0x2d, 0xe9, 0x01, 0x43, 0xa0, 0xe3,
|
||||
0x01, 0x10, 0xa0, 0xe3, 0x0c, 0x40, 0x2d, 0xe9, 0x01, 0xc3, 0xa0, 0xe3,
|
||||
0x00, 0x00, 0x50, 0xe3, 0x00, 0x00, 0xa0, 0xe3, 0x01, 0x20, 0xa0, 0xe3,
|
||||
0x00, 0x00, 0x00, 0x0a, 0x01, 0x03, 0xc4, 0xe5, 0x08, 0x02, 0xc4, 0xe5,
|
||||
0xb8, 0x30, 0x54, 0xe1, 0x01, 0x30, 0x13, 0xe0, 0x01, 0x30, 0x23, 0x10,
|
||||
0xb8, 0x30, 0x44, 0x11, 0x08, 0x22, 0xc4, 0xe5, 0xf7, 0xff, 0xff, 0x0a,
|
||||
0x00, 0x00, 0x00, 0x0a, 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,
|
||||
|
|
|
@ -18,24 +18,24 @@ swiBase:
|
|||
cmp sp, #0
|
||||
moveq sp, #0x04000000
|
||||
subeq sp, #0x20
|
||||
stmfd sp!, {r4-r5, lr}
|
||||
ldrb r4, [lr, #-2]
|
||||
mov r5, #swiTable
|
||||
ldr r4, [r5, r4, lsl #2]
|
||||
cmp r4, #0
|
||||
mrs r5, spsr
|
||||
stmfd sp!, {r5}
|
||||
and r5, #0x80
|
||||
orr r5, #0x1F
|
||||
msr cpsr, r5
|
||||
stmfd sp!, {r11-r12, lr}
|
||||
ldrb r11, [lr, #-2]
|
||||
mov r12, #swiTable
|
||||
ldr r11, [r12, r11, lsl #2]
|
||||
cmp r11, #0
|
||||
mrs r12, spsr
|
||||
stmfd sp!, {r12}
|
||||
and r12, #0x80
|
||||
orr r12, #0x1F
|
||||
msr cpsr, r12
|
||||
stmfd sp!, {lr}
|
||||
mov lr, pc
|
||||
bxne r4
|
||||
bxne r11
|
||||
ldmfd sp!, {lr}
|
||||
msr cpsr, #0x93
|
||||
ldmfd sp!, {r5}
|
||||
msr spsr, r5
|
||||
ldmfd sp!, {r4-r5, lr}
|
||||
ldmfd sp!, {r12}
|
||||
msr spsr, r12
|
||||
ldmfd sp!, {r11-r12, lr}
|
||||
movs pc, lr
|
||||
|
||||
swiTable:
|
||||
|
@ -68,7 +68,7 @@ mov r1, #1
|
|||
IntrWait:
|
||||
stmfd sp!, {r2-r3, lr}
|
||||
# Pull current interrupts enabled and add the ones we need
|
||||
mov r4, #0x04000000
|
||||
mov r12, #0x04000000
|
||||
# See if we want to return immediately
|
||||
cmp r0, #0
|
||||
mov r0, #0
|
||||
|
@ -76,15 +76,15 @@ mov r2, #1
|
|||
beq 1f
|
||||
# Halt
|
||||
0:
|
||||
strb r0, [r4, #0x301]
|
||||
strb r0, [r12, #0x301]
|
||||
1:
|
||||
# Check which interrupts were acknowledged
|
||||
strb r0, [r4, #0x208]
|
||||
ldrh r3, [r4, #-8]
|
||||
strb r0, [r12, #0x208]
|
||||
ldrh r3, [r12, #-8]
|
||||
ands r3, r1
|
||||
eorne r3, r1
|
||||
strneh r3, [r4, #-8]
|
||||
strb r2, [r4, #0x208]
|
||||
strneh r3, [r12, #-8]
|
||||
strb r2, [r12, #0x208]
|
||||
beq 0b
|
||||
ldmfd sp!, {r2-r3, pc}
|
||||
|
||||
|
|
Loading…
Reference in New Issue