bmarcot / vega

vega -- The Unix-like Operating System for micro-controllers (ARM Cortex-M4)
6 stars 1 forks source link

Don't save r7 in svcall entry #17

Closed bmarcot closed 7 years ago

bmarcot commented 7 years ago

Instead of using r7 to do the branch to the requested syscall implementation, rather use the LR which has been saved on svcall prologue.

ldr      r7, =syscall_vector
ldr.w    r7, [r7, r6, lsl #2]
blx      r7

Rather do:

ldr      lr, =syscall_vector
ldr.w    lr, [lr, r6, lsl #2]
blx      lr

NOTE: I am not 100% sure ldr.w addressing modes allow having lr as rt (target register). For sure v6m does not allow.

bmarcot commented 7 years ago

SVcall entry has been redesigned and does not use r7.