Subject: Re: ARM exception handlers -- question
To: Ben Harris <bjh21@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: port-arm
Date: 11/09/2001 07:37:01
On Fri, Nov 09, 2001 at 01:30:08PM +0000, Ben Harris wrote:

 > The comment means that it shouldn't be called from an exception handler
 > that's entered in SVC32 mode (which I think is just SWI).  Data aborts are
 > handled in ABT32 mode, so using PUSHFRAMEINSVC is fine.

Ah, duh, of course.

 > > Obviously, I want to be storing SVC_sp and SVC_lr (which should be no
 > > problem in a fixed fault handler, since this op is done after switing
 > > from ABT mode to SVC mode).
 > 
 > A few lines earlier:
 > 
 >         str     r0, [sp, #-4]!;         /* Push return address */          \
 >         str     lr, [sp, #-4]!;         /* Push SVC lr */                  \
 >         str     r2, [sp, #-4]!;         /* Push SVC sp */                  \
 > 
 > These get restored by the final LDMIA in PULLFRAMEFROMSVCANDEXIT.

Wow, blind, I am.  Okay, and the r0 there (which is copied from ABT_lr)
is stored in tf_pc?

 > As above, PUSHFRAMEINSVC puts both the SVC and USR registers in the
 > trapframe, and PULLFRAMEFROMSVCANDEXIT pops them.  data_abort_handler
 > twiddles tf_pc as necessary to return to the right place.

Ok, so I'm back to my original problem then, I suppose -- "Why didn't
my original badaddr() work?"  I've also attempted implementing it like
the pcb_onfault stuff is implemented, and I lose, as well.  Sigh, I'm
beginning to think I'm going to have to use the (Windows-only) JTAG
debugger to figure this one out :-/

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>