GP32 Thumb Questions


ingeras

Certified Guru
Joined
Mar 4, 2004
Messages
388
Location
Europe
Website
www.gp32linux.com
hi
i was wondering if the differents sdk for gp32
provide support for thumb instructions
and in which case should someone use thumb instructions ?

thank you
 
a) The SWI handler in the bios is stupid, means it accepts only SWIs done from ARM mode.
(I don't know how to change the firmware, but it looks like this:
stmdb sp!, {r0, r1, lr}
mrs r0, SPSR
orr r1, r0, #0x80
msr CPSR_fsxc, r1 // back to old mode, but with interrupts disabled
ldr r0, [lr, -#4] // get SWI number..
bic r0, r0, #0xff000000 // mask it out

but:
stmdb sp!,{
mrs r12,spsr // get saved CPU state
orr r0,r12,#0x80
bic r0,r0,#0x20
msr CPSR_fsxc,r0 // old mode, but ARM !
tst r12,#0x20 // is it thumb mode ?
LDRNEH R12,[LR,#-2] // yes, swi only 16bit
BICNE R12,R12,#0xff00
LDREQ R12,[LR,#-4] // no, swi 32bit
BICEQ R12,R12,#0xff000000
would do it.

B) The devkit libs are linked without interworking, thus the linker will complain.
 
Back
Top