Subject: Re: tf_pc value
To: Ben Harris <bjh21@netbsd.org>
From: Chris Gilbert <chris@paradox.demon.co.uk>
List: port-arm
Date: 03/11/2001 00:57:37
Eeks, when did port-arm mailing list appear?  Checks archive, odd the mail 
from ben to arm26 and arm32 never made it...

On Saturday 10 March 2001  4:07 pm, Ben Harris wrote:
> Right.  I think I've got something approaching a conclusion:

[snip]

> My reason for not having the assembler stubs for the SWI and undef handler
> wind back tf_pc is that in order to do so, they need to know whether the
> processor was in Thumb state (since the PC is advanced by one instruction,
> rather than by a fixed number of bytes).  At the obvious point to do the
> winding back, there are no spare registers to MRS into, so since the C
> handlers will need to know what state the CPU was in anyway, they may as
> well wind back tf_pc at the same time.

the swi they could be done in asm see page A9-12 of the ARM ARM, it's shows 
how to get the right number out for either thumb or arm, so with the same 
text you can move the tf_pc appropriatly.

Something of note is that it shows that thumb only allows for 256 swi codes, 
I believe that netbsd has 512 syscalls at the mo, looks like some kind of 
magic might be needed to make thumb cope with that....

Chris