Home | History | Annotate | Line # | Download | only in arm32
exception.S revision 1.1.2.4
      1  1.1.2.4  jdolecek /*	$NetBSD: exception.S,v 1.1.2.4 2002/02/11 20:07:18 jdolecek Exp $	*/
      2  1.1.2.2     lukem 
      3  1.1.2.2     lukem /*
      4  1.1.2.2     lukem  * Copyright (c) 1994-1997 Mark Brinicombe.
      5  1.1.2.2     lukem  * Copyright (c) 1994 Brini.
      6  1.1.2.2     lukem  * All rights reserved.
      7  1.1.2.2     lukem  *
      8  1.1.2.2     lukem  * This code is derived from software written for Brini by Mark Brinicombe
      9  1.1.2.2     lukem  *
     10  1.1.2.2     lukem  * Redistribution and use in source and binary forms, with or without
     11  1.1.2.2     lukem  * modification, are permitted provided that the following conditions
     12  1.1.2.2     lukem  * are met:
     13  1.1.2.2     lukem  * 1. Redistributions of source code must retain the above copyright
     14  1.1.2.2     lukem  *    notice, this list of conditions and the following disclaimer.
     15  1.1.2.2     lukem  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1.2.2     lukem  *    notice, this list of conditions and the following disclaimer in the
     17  1.1.2.2     lukem  *    documentation and/or other materials provided with the distribution.
     18  1.1.2.2     lukem  * 3. All advertising materials mentioning features or use of this software
     19  1.1.2.2     lukem  *    must display the following acknowledgement:
     20  1.1.2.2     lukem  *	This product includes software developed by Brini.
     21  1.1.2.2     lukem  * 4. The name of the company nor the name of the author may be used to
     22  1.1.2.2     lukem  *    endorse or promote products derived from this software without specific
     23  1.1.2.2     lukem  *    prior written permission.
     24  1.1.2.2     lukem  *
     25  1.1.2.2     lukem  * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
     26  1.1.2.2     lukem  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     27  1.1.2.2     lukem  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     28  1.1.2.2     lukem  * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     29  1.1.2.2     lukem  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     30  1.1.2.2     lukem  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     31  1.1.2.2     lukem  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     32  1.1.2.2     lukem  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     33  1.1.2.2     lukem  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     34  1.1.2.2     lukem  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     35  1.1.2.2     lukem  * SUCH DAMAGE.
     36  1.1.2.2     lukem  *
     37  1.1.2.2     lukem  * RiscBSD kernel project
     38  1.1.2.2     lukem  *
     39  1.1.2.2     lukem  * exception.S
     40  1.1.2.2     lukem  *
     41  1.1.2.2     lukem  * Low level handlers for exception vectors
     42  1.1.2.2     lukem  *
     43  1.1.2.2     lukem  * Created      : 24/09/94
     44  1.1.2.2     lukem  *
     45  1.1.2.2     lukem  * Based on kate/display/abort.s
     46  1.1.2.2     lukem  */
     47  1.1.2.2     lukem 
     48  1.1.2.2     lukem #include "opt_ipkdb.h"
     49  1.1.2.2     lukem #include <machine/asm.h>
     50  1.1.2.2     lukem #include <machine/cpu.h>
     51  1.1.2.2     lukem #include <machine/frame.h>
     52  1.1.2.2     lukem #include "assym.h"
     53  1.1.2.2     lukem 
     54  1.1.2.2     lukem 	.text
     55  1.1.2.2     lukem 	.align	0
     56  1.1.2.2     lukem 
     57  1.1.2.2     lukem Lastpending:
     58  1.1.2.2     lukem         .word   _C_LABEL(astpending)
     59  1.1.2.2     lukem 
     60  1.1.2.2     lukem /*
     61  1.1.2.2     lukem  * General exception exit handler
     62  1.1.2.2     lukem  *
     63  1.1.2.2     lukem  * It exits straight away if not returning to USR mode.
     64  1.1.2.2     lukem  * This loops around delivering any pending ASTs.
     65  1.1.2.2     lukem  * Interrupts are disabled at suitable points to avoid ASTs
     66  1.1.2.2     lukem  * being posted between testing and exit to user mode.
     67  1.1.2.2     lukem  *
     68  1.1.2.2     lukem  * This function uses PULLFRAMEFROMSVCANDEXIT thus should
     69  1.1.2.2     lukem  * only be called if the exception handler used PUSHFRAMEINSVC
     70  1.1.2.2     lukem  */
     71  1.1.2.2     lukem 
     72  1.1.2.2     lukem exception_exit:
     73  1.1.2.2     lukem 	mrs     r4, cpsr_all		/* Get CPSR */
     74  1.1.2.2     lukem 
     75  1.1.2.2     lukem 	ldr	r0, [sp]		/* Get the SPSR from stack */
     76  1.1.2.2     lukem 	and	r0, r0, #(PSR_MODE)	/* Test for USR32 mode before the AST */
     77  1.1.2.2     lukem 	teq	r0, #(PSR_USR32_MODE)
     78  1.1.2.2     lukem 	bne	do_exit			/* Not USR mode so no AST delivery */
     79  1.1.2.2     lukem 
     80  1.1.2.2     lukem 	ldr	r5, Lastpending		/* Get address of astpending */
     81  1.1.2.2     lukem 
     82  1.1.2.2     lukem Lexception_exit_loop:
     83  1.1.2.2     lukem 	orr     r0, r4, #(I32_bit)	/* Block IRQs */
     84  1.1.2.2     lukem 	msr     cpsr_all, r0
     85  1.1.2.2     lukem 
     86  1.1.2.2     lukem 	ldr	r1, [r5]		/* Do we have an AST pending */
     87  1.1.2.2     lukem 	teq	r1, #0x00000000
     88  1.1.2.2     lukem 	bne	do_ast
     89  1.1.2.2     lukem 
     90  1.1.2.2     lukem 	PULLFRAMEFROMSVCANDEXIT		/* No AST so exit */
     91  1.1.2.2     lukem 
     92  1.1.2.2     lukem do_ast:
     93  1.1.2.2     lukem 	mov	r1, #0x00000000		/* Clear ast pending */
     94  1.1.2.2     lukem 	str	r1, [r5]
     95  1.1.2.2     lukem 
     96  1.1.2.3   thorpej 	msr     cpsr_all, r4		/* Restore interrupts */
     97  1.1.2.3   thorpej 
     98  1.1.2.2     lukem 	mov	r0, sp			/* arg 0 = trap frame */
     99  1.1.2.2     lukem 	bl	_C_LABEL(ast)		/* call the AST handler */
    100  1.1.2.2     lukem 	b	Lexception_exit_loop	/* Try and exit again */
    101  1.1.2.2     lukem 
    102  1.1.2.2     lukem do_exit:
    103  1.1.2.2     lukem 	orr     r0, r4, #(I32_bit)	/* Disable interupts */
    104  1.1.2.2     lukem 	msr     cpsr_all, r0
    105  1.1.2.2     lukem 
    106  1.1.2.2     lukem 	PULLFRAMEFROMSVCANDEXIT		/* Restore the trap frame and exit */
    107  1.1.2.2     lukem 
    108  1.1.2.3   thorpej /*
    109  1.1.2.3   thorpej  * reset_entry:
    110  1.1.2.3   thorpej  *
    111  1.1.2.3   thorpej  *	Handler for Reset exception.
    112  1.1.2.3   thorpej  */
    113  1.1.2.3   thorpej ASENTRY_NP(reset_entry)
    114  1.1.2.3   thorpej 	adr	r0, Lreset_panicmsg
    115  1.1.2.3   thorpej 	mov	r1, lr
    116  1.1.2.3   thorpej 	bl	_C_LABEL(panic)
    117  1.1.2.3   thorpej 	/* NOTREACHED */
    118  1.1.2.3   thorpej Lreset_panicmsg:
    119  1.1.2.3   thorpej 	.asciz	"Reset vector called, LR = 0x%08x"
    120  1.1.2.3   thorpej 	.balign	4
    121  1.1.2.2     lukem 
    122  1.1.2.3   thorpej /*
    123  1.1.2.3   thorpej  * swi_entry
    124  1.1.2.3   thorpej  *
    125  1.1.2.3   thorpej  *	Handler for the Software Interrupt exception.
    126  1.1.2.3   thorpej  */
    127  1.1.2.3   thorpej ASENTRY_NP(swi_entry)
    128  1.1.2.3   thorpej 	PUSHFRAME
    129  1.1.2.2     lukem 
    130  1.1.2.3   thorpej 	mov	r0, sp			/* Pass the frame to any function */
    131  1.1.2.2     lukem 
    132  1.1.2.4  jdolecek 	bl	_C_LABEL(swi_handler)	/* It's a SWI ! */
    133  1.1.2.2     lukem 
    134  1.1.2.3   thorpej 	ldr	r5, Lastpending		/* Get address of astpending */
    135  1.1.2.3   thorpej 	mrs     r4, cpsr_all		/* Get CPSR */
    136  1.1.2.2     lukem 
    137  1.1.2.3   thorpej swi_exit_loop:
    138  1.1.2.3   thorpej 	orr     r0, r4, #(I32_bit)	/* Disable IRQs */
    139  1.1.2.3   thorpej 	msr     cpsr_all, r0
    140  1.1.2.2     lukem 
    141  1.1.2.3   thorpej 	ldr	r1, [r5]		/* Do we have an AST pending */
    142  1.1.2.3   thorpej 	teq	r1, #0x00000000
    143  1.1.2.3   thorpej 	bne	do_swi_ast
    144  1.1.2.2     lukem 
    145  1.1.2.3   thorpej 	PULLFRAME
    146  1.1.2.3   thorpej 	movs	pc, lr			/* Exit */
    147  1.1.2.3   thorpej 
    148  1.1.2.3   thorpej do_swi_ast:
    149  1.1.2.3   thorpej 	mov	r1, #0x00000000		/* Clear ast pending */
    150  1.1.2.3   thorpej 	str	r1, [r5]
    151  1.1.2.2     lukem 
    152  1.1.2.3   thorpej 	msr     cpsr_all, r4		/* Restore interrupts */
    153  1.1.2.2     lukem 
    154  1.1.2.3   thorpej 	mov	r0, sp			/* arg 0 = trap frame */
    155  1.1.2.3   thorpej 	bl	_C_LABEL(ast)		/* call the AST handler */
    156  1.1.2.3   thorpej 	b	swi_exit_loop		/* Try and exit again */
    157  1.1.2.3   thorpej 
    158  1.1.2.3   thorpej /*
    159  1.1.2.3   thorpej  * prefetch_abort_entry:
    160  1.1.2.3   thorpej  *
    161  1.1.2.3   thorpej  *	Handler for the Prefetch Abort exception.
    162  1.1.2.3   thorpej  */
    163  1.1.2.2     lukem ASENTRY_NP(prefetch_abort_entry)
    164  1.1.2.2     lukem         sub     lr, lr, #0x00000004     /* Adjust the lr */
    165  1.1.2.2     lukem 
    166  1.1.2.2     lukem 	PUSHFRAMEINSVC
    167  1.1.2.2     lukem 
    168  1.1.2.2     lukem  	mov	r0, sp			/* pass the stack pointer as r0 */
    169  1.1.2.2     lukem 
    170  1.1.2.2     lukem 	add	lr, pc, #exception_exit - . - 8
    171  1.1.2.2     lukem 	ldr	r1, Lprefetch_abort_handler_address
    172  1.1.2.2     lukem 	ldr	pc, [r1]
    173  1.1.2.2     lukem 
    174  1.1.2.2     lukem Lprefetch_abort_handler_address:
    175  1.1.2.2     lukem 	.word	_C_LABEL(prefetch_abort_handler_address)
    176  1.1.2.2     lukem 
    177  1.1.2.2     lukem 	.data
    178  1.1.2.2     lukem 	.global	_C_LABEL(prefetch_abort_handler_address)
    179  1.1.2.2     lukem 
    180  1.1.2.2     lukem _C_LABEL(prefetch_abort_handler_address):
    181  1.1.2.2     lukem 	.word	abortprefetch
    182  1.1.2.2     lukem 
    183  1.1.2.2     lukem 	.text
    184  1.1.2.2     lukem abortprefetch:
    185  1.1.2.2     lukem         add     r0, pc, #abortprefetchmsg - . - 8
    186  1.1.2.2     lukem 	b	_C_LABEL(panic)
    187  1.1.2.2     lukem 
    188  1.1.2.2     lukem abortprefetchmsg:
    189  1.1.2.2     lukem         .asciz  "abortprefetch"
    190  1.1.2.2     lukem         .align  0
    191  1.1.2.2     lukem 
    192  1.1.2.2     lukem /*
    193  1.1.2.3   thorpej  * data_abort_entry:
    194  1.1.2.2     lukem  *
    195  1.1.2.3   thorpej  *	Handler for the Data Abort exception.
    196  1.1.2.2     lukem  */
    197  1.1.2.3   thorpej ASENTRY_NP(data_abort_entry)
    198  1.1.2.3   thorpej         sub     lr, lr, #0x00000008     /* Adjust the lr */
    199  1.1.2.2     lukem 
    200  1.1.2.3   thorpej 	PUSHFRAMEINSVC			/* Push trap frame and switch */
    201  1.1.2.3   thorpej 					/* to SVC32 mode */
    202  1.1.2.2     lukem 
    203  1.1.2.3   thorpej 	mov	r0, sp			/* pass the stack pointer as r0 */
    204  1.1.2.2     lukem 
    205  1.1.2.3   thorpej 	add	lr, pc, #exception_exit - . - 8
    206  1.1.2.3   thorpej 	ldr	r1, Ldata_abort_handler_address
    207  1.1.2.3   thorpej 	ldr	pc, [r1]
    208  1.1.2.2     lukem 
    209  1.1.2.3   thorpej Ldata_abort_handler_address:
    210  1.1.2.3   thorpej 	.word	_C_LABEL(data_abort_handler_address)
    211  1.1.2.2     lukem 
    212  1.1.2.3   thorpej 	.data
    213  1.1.2.3   thorpej 	.global	_C_LABEL(data_abort_handler_address)
    214  1.1.2.3   thorpej _C_LABEL(data_abort_handler_address):
    215  1.1.2.3   thorpej 	.word	abortdata
    216  1.1.2.2     lukem 
    217  1.1.2.3   thorpej 	.text
    218  1.1.2.3   thorpej abortdata:
    219  1.1.2.3   thorpej         add     r0, pc, #abortdatamsg - . - 8
    220  1.1.2.3   thorpej 	b	_C_LABEL(panic)
    221  1.1.2.2     lukem 
    222  1.1.2.3   thorpej abortdatamsg:
    223  1.1.2.3   thorpej         .asciz  "abortdata"
    224  1.1.2.3   thorpej         .align  0
    225  1.1.2.2     lukem 
    226  1.1.2.2     lukem /*
    227  1.1.2.3   thorpej  * address_exception_entry:
    228  1.1.2.3   thorpej  *
    229  1.1.2.3   thorpej  *	Handler for the Address Exception exception.
    230  1.1.2.3   thorpej  *
    231  1.1.2.3   thorpej  *	NOTE: This exception isn't really used on arm32.  We
    232  1.1.2.3   thorpej  *	print a warning message to the console and then treat
    233  1.1.2.3   thorpej  *	it like a Data Abort.
    234  1.1.2.2     lukem  */
    235  1.1.2.3   thorpej ASENTRY_NP(address_exception_entry)
    236  1.1.2.3   thorpej 	mrs	r1, cpsr_all
    237  1.1.2.3   thorpej 	mrs	r2, spsr_all
    238  1.1.2.3   thorpej 	mov	r3, lr
    239  1.1.2.3   thorpej 	adr	r0, Laddress_exception_msg
    240  1.1.2.3   thorpej 	bl	_C_LABEL(printf)	/* XXX CLOBBERS LR!! */
    241  1.1.2.3   thorpej 	b	data_abort_entry
    242  1.1.2.3   thorpej Laddress_exception_msg:
    243  1.1.2.3   thorpej 	.asciz	"Address Exception CPSR=0x%08x SPSR=0x%08x LR=0x%08x\n"
    244  1.1.2.3   thorpej 	.balign	4
    245  1.1.2.2     lukem 
    246  1.1.2.3   thorpej /*
    247  1.1.2.3   thorpej  * undefined_entry:
    248  1.1.2.3   thorpej  *
    249  1.1.2.3   thorpej  *	Handler for the Undefined Instruction exception.
    250  1.1.2.3   thorpej  *
    251  1.1.2.3   thorpej  *	We indirect the undefined vector via the handler address
    252  1.1.2.3   thorpej  *	in the data area.  Entry to the undefined handler must
    253  1.1.2.3   thorpej  *	look like direct entry from the vector.
    254  1.1.2.3   thorpej  */
    255  1.1.2.2     lukem ASENTRY_NP(undefined_entry)
    256  1.1.2.2     lukem #ifdef IPKDB
    257  1.1.2.2     lukem /*
    258  1.1.2.2     lukem  * IPKDB must be hooked in at the earliest possible entry point.
    259  1.1.2.2     lukem  *
    260  1.1.2.2     lukem  */
    261  1.1.2.2     lukem /*
    262  1.1.2.2     lukem  * Make room for all registers saving real r0-r7 and r15.
    263  1.1.2.2     lukem  * The remaining registers are updated later.
    264  1.1.2.2     lukem  */
    265  1.1.2.2     lukem 	stmfd	sp!, {r0,r1}		/* psr & spsr */
    266  1.1.2.2     lukem 	stmfd	sp!, {lr}		/* pc */
    267  1.1.2.2     lukem 	stmfd	sp!, {r0-r14}		/* r0-r7, r8-r14 */
    268  1.1.2.2     lukem /*
    269  1.1.2.2     lukem  * Get previous psr.
    270  1.1.2.2     lukem  */
    271  1.1.2.2     lukem 	mrs	r7, cpsr_all
    272  1.1.2.2     lukem 	mrs	r0, spsr_all
    273  1.1.2.2     lukem 	str	r0, [sp, #(16*4)]
    274  1.1.2.2     lukem /*
    275  1.1.2.2     lukem  * Test for user mode.
    276  1.1.2.2     lukem  */
    277  1.1.2.2     lukem 	tst	r0, #0xf
    278  1.1.2.2     lukem 	bne	Lprenotuser_push
    279  1.1.2.2     lukem 	add	r1, sp, #(8*4)
    280  1.1.2.2     lukem 	stmia	r1,{r8-r14}^		/* store user mode r8-r14*/
    281  1.1.2.2     lukem 	b	Lgoipkdb
    282  1.1.2.2     lukem /*
    283  1.1.2.2     lukem  * Switch to previous mode to get r8-r13.
    284  1.1.2.2     lukem  */
    285  1.1.2.2     lukem Lprenotuser_push:
    286  1.1.2.2     lukem 	orr	r0, r0, #(I32_bit) /* disable interrupts */
    287  1.1.2.2     lukem 	msr	cpsr_all, r0
    288  1.1.2.2     lukem 	mov	r1, r8
    289  1.1.2.2     lukem 	mov	r2, r9
    290  1.1.2.2     lukem 	mov	r3, r10
    291  1.1.2.2     lukem 	mov	r4, r11
    292  1.1.2.2     lukem 	mov	r5, r12
    293  1.1.2.2     lukem 	mov	r6, r13
    294  1.1.2.2     lukem 	msr	cpsr_all, r7		/* back to undefined mode */
    295  1.1.2.2     lukem 	add	r8, sp, #(8*4)
    296  1.1.2.2     lukem 	stmia	r8, {r1-r6}		/* r8-r13 */
    297  1.1.2.2     lukem /*
    298  1.1.2.2     lukem  * Now back to previous mode to get r14 and spsr.
    299  1.1.2.2     lukem  */
    300  1.1.2.2     lukem 	msr	cpsr_all, r0
    301  1.1.2.2     lukem 	mov	r1, r14
    302  1.1.2.2     lukem 	mrs	r2, spsr
    303  1.1.2.2     lukem 	msr	cpsr_all, r7		/* back to undefined mode */
    304  1.1.2.2     lukem 	str	r1, [sp, #(14*4)]	/* r14 */
    305  1.1.2.2     lukem 	str	r2, [sp, #(17*4)]	/* spsr */
    306  1.1.2.2     lukem /*
    307  1.1.2.2     lukem  * Now to IPKDB.
    308  1.1.2.2     lukem  */
    309  1.1.2.2     lukem Lgoipkdb:
    310  1.1.2.2     lukem 	mov	r0, sp
    311  1.1.2.2     lukem 	bl	_C_LABEL(ipkdb_trap_glue)
    312  1.1.2.2     lukem 	ldr	r1, Lipkdb_trap_return
    313  1.1.2.2     lukem 	str	r0,[r1]
    314  1.1.2.2     lukem /*
    315  1.1.2.2     lukem  * Have to load all registers from the stack.
    316  1.1.2.2     lukem  *
    317  1.1.2.2     lukem  * Start with spsr and pc.
    318  1.1.2.2     lukem  */
    319  1.1.2.2     lukem 	ldr	r0, [sp, #(16*4)]	/* spsr */
    320  1.1.2.2     lukem 	ldr	r1, [sp, #(15*4)]	/* r15 */
    321  1.1.2.2     lukem 	msr	spsr_all, r0
    322  1.1.2.2     lukem 	mov	r14, r1
    323  1.1.2.2     lukem /*
    324  1.1.2.2     lukem  * Test for user mode.
    325  1.1.2.2     lukem  */
    326  1.1.2.2     lukem 	tst	r0, #0xf
    327  1.1.2.2     lukem 	bne	Lprenotuser_pull
    328  1.1.2.2     lukem 	add	r1, sp, #(8*4)
    329  1.1.2.2     lukem 	ldmia	r1, {r8-r14}^		/* load user mode r8-r14 */
    330  1.1.2.2     lukem 	b	Lpull_r0r7
    331  1.1.2.2     lukem Lprenotuser_pull:
    332  1.1.2.2     lukem /*
    333  1.1.2.2     lukem  * Now previous mode spsr and r14.
    334  1.1.2.2     lukem  */
    335  1.1.2.2     lukem 	ldr	r1, [sp, #(17*4)]		/* spsr */
    336  1.1.2.2     lukem 	ldr	r2, [sp, #(14*4)]		/* r14 */
    337  1.1.2.2     lukem 	orr	r0, r0, #(I32_bit)
    338  1.1.2.2     lukem 	msr	cpsr_all, r0			/* switch to previous mode */
    339  1.1.2.2     lukem 	msr	spsr_all, r1
    340  1.1.2.2     lukem 	mov	r14, r2
    341  1.1.2.2     lukem 	msr	cpsr_all, r7			/* back to undefined mode */
    342  1.1.2.2     lukem /*
    343  1.1.2.2     lukem  * Now r8-r13.
    344  1.1.2.2     lukem  */
    345  1.1.2.2     lukem 	add	r8, sp, #(8*4)
    346  1.1.2.2     lukem 	ldmia	r8, {r1-r6}		/* r8-r13 */
    347  1.1.2.2     lukem 	msr	cpsr_all, r0
    348  1.1.2.2     lukem 	mov	r8, r1
    349  1.1.2.2     lukem 	mov	r9, r2
    350  1.1.2.2     lukem 	mov	r10, r3
    351  1.1.2.2     lukem 	mov	r11, r4
    352  1.1.2.2     lukem 	mov	r12, r5
    353  1.1.2.2     lukem 	mov	r13, r6
    354  1.1.2.2     lukem 	msr	cpsr_all, r7
    355  1.1.2.2     lukem Lpull_r0r7:
    356  1.1.2.2     lukem /*
    357  1.1.2.2     lukem  * Now the rest of the registers.
    358  1.1.2.2     lukem  */
    359  1.1.2.2     lukem 	ldr	r1,Lipkdb_trap_return
    360  1.1.2.2     lukem 	ldr	r0,[r1]
    361  1.1.2.2     lukem 	tst	r0,r0
    362  1.1.2.2     lukem 	ldmfd	sp!, {r0-r7}		/* r0-r7 */
    363  1.1.2.2     lukem 	add	sp, sp, #(10*4)		/* adjust sp */
    364  1.1.2.2     lukem 
    365  1.1.2.2     lukem /*
    366  1.1.2.2     lukem  * Did IPKDB handle it?
    367  1.1.2.2     lukem  */
    368  1.1.2.2     lukem 	movnes	pc, lr			/* return */
    369  1.1.2.2     lukem 
    370  1.1.2.2     lukem #endif
    371  1.1.2.2     lukem 	stmfd	sp!, {r0, r1}
    372  1.1.2.2     lukem 	ldr	r0, Lundefined_handler_indirection
    373  1.1.2.2     lukem 	ldr	r1, [sp], #0x0004
    374  1.1.2.2     lukem 	str	r1, [r0, #0x0000]
    375  1.1.2.2     lukem 	ldr	r1, [sp], #0x0004
    376  1.1.2.2     lukem 	str	r1, [r0, #0x0004]
    377  1.1.2.2     lukem 	ldmia	r0, {r0, r1, pc}
    378  1.1.2.2     lukem 
    379  1.1.2.2     lukem #ifdef IPKDB
    380  1.1.2.2     lukem Lipkdb_trap_return:
    381  1.1.2.2     lukem 	.word	Lipkdb_trap_return_data
    382  1.1.2.2     lukem #endif
    383  1.1.2.2     lukem 
    384  1.1.2.2     lukem Lundefined_handler_indirection:
    385  1.1.2.2     lukem 	.word	Lundefined_handler_indirection_data
    386  1.1.2.2     lukem 
    387  1.1.2.2     lukem /*
    388  1.1.2.2     lukem  * assembly bounce code for calling the kernel
    389  1.1.2.2     lukem  * undefined instruction handler. This uses
    390  1.1.2.2     lukem  * a standard trap frame and is called in SVC mode.
    391  1.1.2.2     lukem  */
    392  1.1.2.2     lukem 
    393  1.1.2.2     lukem ENTRY_NP(undefinedinstruction_bounce)
    394  1.1.2.2     lukem 	PUSHFRAMEINSVC
    395  1.1.2.2     lukem 	mov	r0, sp
    396  1.1.2.2     lukem 	bl	_C_LABEL(undefinedinstruction)
    397  1.1.2.2     lukem 
    398  1.1.2.2     lukem 	b	exception_exit
    399  1.1.2.2     lukem 
    400  1.1.2.2     lukem 	.data
    401  1.1.2.2     lukem 	.align	0
    402  1.1.2.2     lukem 
    403  1.1.2.2     lukem #ifdef IPKDB
    404  1.1.2.2     lukem Lipkdb_trap_return_data:
    405  1.1.2.2     lukem 	.word	0
    406  1.1.2.2     lukem #endif
    407  1.1.2.2     lukem 
    408  1.1.2.2     lukem /*
    409  1.1.2.2     lukem  * Indirection data
    410  1.1.2.2     lukem  * 2 words use for preserving r0 and r1
    411  1.1.2.2     lukem  * 3rd word contains the undefined handler address.
    412  1.1.2.2     lukem  */
    413  1.1.2.2     lukem 
    414  1.1.2.2     lukem Lundefined_handler_indirection_data:
    415  1.1.2.2     lukem 	.word	0
    416  1.1.2.2     lukem 	.word	0
    417  1.1.2.2     lukem 
    418  1.1.2.2     lukem 	.global	_C_LABEL(undefined_handler_address)
    419  1.1.2.2     lukem _C_LABEL(undefined_handler_address):
    420  1.1.2.2     lukem 	.word	_C_LABEL(undefinedinstruction_bounce)
    421