Home | History | Annotate | Line # | Download | only in arm32
frame.h revision 1.12
      1  1.12     cube /*	$NetBSD: frame.h,v 1.12 2005/08/11 20:32:55 cube Exp $	*/
      2   1.1  reinoud 
      3   1.1  reinoud /*
      4   1.1  reinoud  * Copyright (c) 1994-1997 Mark Brinicombe.
      5   1.1  reinoud  * Copyright (c) 1994 Brini.
      6   1.1  reinoud  * All rights reserved.
      7   1.1  reinoud  *
      8   1.1  reinoud  * This code is derived from software written for Brini by Mark Brinicombe
      9   1.1  reinoud  *
     10   1.1  reinoud  * Redistribution and use in source and binary forms, with or without
     11   1.1  reinoud  * modification, are permitted provided that the following conditions
     12   1.1  reinoud  * are met:
     13   1.1  reinoud  * 1. Redistributions of source code must retain the above copyright
     14   1.1  reinoud  *    notice, this list of conditions and the following disclaimer.
     15   1.1  reinoud  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1  reinoud  *    notice, this list of conditions and the following disclaimer in the
     17   1.1  reinoud  *    documentation and/or other materials provided with the distribution.
     18   1.1  reinoud  * 3. All advertising materials mentioning features or use of this software
     19   1.1  reinoud  *    must display the following acknowledgement:
     20   1.1  reinoud  *	This product includes software developed by Brini.
     21   1.1  reinoud  * 4. The name of the company nor the name of the author may be used to
     22   1.1  reinoud  *    endorse or promote products derived from this software without specific
     23   1.1  reinoud  *    prior written permission.
     24   1.1  reinoud  *
     25   1.1  reinoud  * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
     26   1.1  reinoud  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     27   1.1  reinoud  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     28   1.1  reinoud  * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     29   1.1  reinoud  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     30   1.1  reinoud  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     31   1.1  reinoud  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     32   1.1  reinoud  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     33   1.1  reinoud  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     34   1.1  reinoud  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     35   1.1  reinoud  * SUCH DAMAGE.
     36   1.1  reinoud  *
     37   1.1  reinoud  * RiscBSD kernel project
     38   1.1  reinoud  *
     39   1.1  reinoud  * frame.h
     40   1.1  reinoud  *
     41   1.1  reinoud  * Stack frames structures
     42   1.1  reinoud  *
     43   1.1  reinoud  * Created      : 30/09/94
     44   1.1  reinoud  */
     45   1.1  reinoud 
     46   1.1  reinoud #ifndef _ARM32_FRAME_H_
     47   1.1  reinoud #define _ARM32_FRAME_H_
     48   1.1  reinoud 
     49   1.1  reinoud #include <arm/frame.h>		/* Common ARM stack frames */
     50   1.1  reinoud 
     51   1.1  reinoud #ifndef _LOCORE
     52   1.1  reinoud 
     53   1.1  reinoud /*
     54   1.1  reinoud  * System stack frames.
     55   1.1  reinoud  */
     56   1.1  reinoud 
     57   1.1  reinoud typedef struct irqframe {
     58   1.1  reinoud 	unsigned int if_spsr;
     59   1.1  reinoud 	unsigned int if_r0;
     60   1.1  reinoud 	unsigned int if_r1;
     61   1.1  reinoud 	unsigned int if_r2;
     62   1.1  reinoud 	unsigned int if_r3;
     63   1.1  reinoud 	unsigned int if_r4;
     64   1.1  reinoud 	unsigned int if_r5;
     65   1.1  reinoud 	unsigned int if_r6;
     66   1.1  reinoud 	unsigned int if_r7;
     67   1.1  reinoud 	unsigned int if_r8;
     68   1.1  reinoud 	unsigned int if_r9;
     69   1.1  reinoud 	unsigned int if_r10;
     70   1.1  reinoud 	unsigned int if_r11;
     71   1.1  reinoud 	unsigned int if_r12;
     72   1.1  reinoud 	unsigned int if_usr_sp;
     73   1.1  reinoud 	unsigned int if_usr_lr;
     74   1.1  reinoud 	unsigned int if_svc_sp;
     75   1.1  reinoud 	unsigned int if_svc_lr;
     76   1.1  reinoud 	unsigned int if_pc;
     77   1.1  reinoud } irqframe_t;
     78   1.1  reinoud 
     79  1.12     cube struct clockframe {
     80  1.12     cube 	struct irqframe cf_if;
     81  1.12     cube };
     82   1.1  reinoud 
     83   1.1  reinoud /*
     84   1.1  reinoud  * Switch frame
     85   1.1  reinoud  */
     86   1.1  reinoud 
     87   1.1  reinoud struct switchframe {
     88   1.1  reinoud 	u_int	sf_r4;
     89   1.1  reinoud 	u_int	sf_r5;
     90   1.1  reinoud 	u_int	sf_r6;
     91   1.1  reinoud 	u_int	sf_r7;
     92   1.5    bjh21 	u_int	sf_pc;
     93   1.1  reinoud };
     94   1.1  reinoud 
     95   1.1  reinoud /*
     96   1.1  reinoud  * Stack frame. Used during stack traces (db_trace.c)
     97   1.1  reinoud  */
     98   1.1  reinoud struct frame {
     99   1.1  reinoud 	u_int	fr_fp;
    100   1.1  reinoud 	u_int	fr_sp;
    101   1.1  reinoud 	u_int	fr_lr;
    102   1.1  reinoud 	u_int	fr_pc;
    103   1.1  reinoud };
    104   1.1  reinoud 
    105   1.1  reinoud #ifdef _KERNEL
    106   1.1  reinoud void validate_trapframe __P((trapframe_t *, int));
    107   1.1  reinoud #endif /* _KERNEL */
    108   1.1  reinoud 
    109   1.1  reinoud #else /* _LOCORE */
    110   1.1  reinoud 
    111   1.7      scw #include "opt_compat_netbsd.h"
    112   1.7      scw #include "opt_execfmt.h"
    113   1.7      scw #include "opt_multiprocessor.h"
    114   1.7      scw 
    115   1.7      scw /*
    116   1.7      scw  * AST_ALIGNMENT_FAULT_LOCALS and ENABLE_ALIGNMENT_FAULTS
    117   1.7      scw  * These are used in order to support dynamic enabling/disabling of
    118   1.7      scw  * alignment faults when executing old a.out ARM binaries.
    119   1.7      scw  */
    120   1.7      scw #if defined(COMPAT_15) && defined(EXEC_AOUT)
    121   1.7      scw #ifndef MULTIPROCESSOR
    122   1.7      scw 
    123   1.7      scw /*
    124   1.7      scw  * Local variables needed by the AST/Alignment Fault macroes
    125   1.7      scw  */
    126   1.7      scw #define	AST_ALIGNMENT_FAULT_LOCALS					\
    127   1.7      scw .Laflt_astpending:							;\
    128   1.7      scw 	.word	_C_LABEL(astpending)					;\
    129   1.7      scw .Laflt_cpufuncs:							;\
    130   1.7      scw 	.word	_C_LABEL(cpufuncs)					;\
    131   1.7      scw .Laflt_curpcb:								;\
    132   1.7      scw 	.word	_C_LABEL(curpcb)					;\
    133   1.7      scw .Laflt_cpu_info_store:							;\
    134   1.7      scw 	.word	_C_LABEL(cpu_info_store)
    135   1.7      scw 
    136   1.7      scw #define	GET_CURPCB_ENTER						\
    137   1.7      scw 	ldr	r1, .Laflt_curpcb					;\
    138   1.7      scw 	ldr	r1, [r1]
    139   1.7      scw 
    140   1.7      scw #define	GET_CPUINFO_ENTER						\
    141   1.7      scw 	ldr	r0, .Laflt_cpu_info_store
    142   1.7      scw 
    143   1.7      scw #define	GET_CURPCB_EXIT							\
    144   1.7      scw 	ldr	r1, .Laflt_curpcb					;\
    145   1.7      scw 	ldr	r2, .Laflt_cpu_info_store				;\
    146   1.7      scw 	ldr	r1, [r1]
    147   1.7      scw 
    148   1.7      scw #else /* !MULTIPROCESSOR */
    149   1.7      scw 
    150   1.7      scw #define	AST_ALIGNMENT_FAULT_LOCALS					\
    151   1.7      scw .Laflt_astpending:							;\
    152   1.7      scw 	.word	_C_LABEL(astpending)					;\
    153   1.7      scw .Laflt_cpufuncs:							;\
    154   1.7      scw 	.word	_C_LABEL(cpufuncs)					;\
    155   1.7      scw .Laflt_cpu_info:							;\
    156   1.7      scw 	.word	_C_LABEL(cpu_info)
    157   1.7      scw 
    158   1.7      scw #define	GET_CURPCB_ENTER						\
    159   1.7      scw 	ldr	r4, .Laflt_cpu_info					;\
    160   1.7      scw 	bl	_C_LABEL(cpu_number)					;\
    161   1.7      scw 	ldr	r0, [r4, r0, lsl #2]					;\
    162   1.7      scw 	ldr	r1, [r0, #CI_CURPCB]
    163   1.7      scw 
    164   1.7      scw #define	GET_CPUINFO_ENTER	/* nothing to do */
    165   1.7      scw 
    166   1.7      scw #define	GET_CURPCB_EXIT							\
    167   1.7      scw 	ldr	r7, .Laflt_cpu_info					;\
    168   1.7      scw 	bl	_C_LABEL(cpu_number)					;\
    169   1.7      scw 	ldr	r2, [r7, r0, lsl #2]					;\
    170   1.7      scw 	ldr	r1, [r2, #CI_CURPCB]
    171   1.7      scw #endif /* MULTIPROCESSOR */
    172   1.7      scw 
    173   1.7      scw /*
    174   1.7      scw  * This macro must be invoked following PUSHFRAMEINSVC or PUSHFRAME at
    175   1.7      scw  * the top of interrupt/exception handlers.
    176   1.7      scw  *
    177   1.7      scw  * When invoked, r0 *must* contain the value of SPSR on the current
    178   1.7      scw  * trap/interrupt frame. This is always the case if ENABLE_ALIGNMENT_FAULTS
    179   1.7      scw  * is invoked immediately after PUSHFRAMEINSVC or PUSHFRAME.
    180   1.7      scw  */
    181   1.7      scw #define	ENABLE_ALIGNMENT_FAULTS						\
    182   1.7      scw 	and	r0, r0, #(PSR_MODE)	/* Test for USR32 mode */	;\
    183   1.7      scw 	teq	r0, #(PSR_USR32_MODE)					;\
    184   1.7      scw 	bne	1f			/* Not USR mode skip AFLT */	;\
    185   1.7      scw 	GET_CURPCB_ENTER		/* r1 = curpcb */		;\
    186   1.7      scw 	cmp	r1, #0x00		/* curpcb NULL? */		;\
    187   1.7      scw 	ldrne	r1, [r1, #PCB_FLAGS]	/* Fetch curpcb->pcb_flags */	;\
    188   1.7      scw 	tstne	r1, #PCB_NOALIGNFLT					;\
    189   1.7      scw 	beq	1f			/* AFLTs already enabled */	;\
    190   1.7      scw 	GET_CPUINFO_ENTER		/* r0 = cpuinfo */		;\
    191   1.7      scw 	ldr	r2, .Laflt_cpufuncs					;\
    192   1.7      scw 	ldr	r1, [r0, #CI_CTRL]	/* Fetch control register */	;\
    193   1.7      scw 	mov	r0, #-1							;\
    194   1.7      scw 	mov	lr, pc							;\
    195   1.7      scw 	ldr	pc, [r2, #CF_CONTROL]	/* Enable alignment faults */	;\
    196   1.7      scw 1:
    197   1.7      scw 
    198   1.7      scw /*
    199   1.7      scw  * This macro must be invoked just before PULLFRAMEFROMSVCANDEXIT or
    200   1.7      scw  * PULLFRAME at the end of interrupt/exception handlers.
    201   1.7      scw  */
    202   1.7      scw #define	DO_AST_AND_RESTORE_ALIGNMENT_FAULTS				\
    203   1.8      scw 	ldr	r0, [sp]		/* Get the SPSR from stack */	;\
    204  1.10      scw 	mrs	r4, cpsr		/* save CPSR */			;\
    205  1.11      scw 	orr	r1, r4, #(I32_bit)					;\
    206  1.11      scw 	msr	cpsr_c, r1		/* Disable interrupts */	;\
    207   1.7      scw 	and	r0, r0, #(PSR_MODE)	/* Returning to USR mode? */	;\
    208   1.7      scw 	teq	r0, #(PSR_USR32_MODE)					;\
    209   1.7      scw 	ldreq	r5, .Laflt_astpending					;\
    210   1.7      scw 	bne	3f			/* Nope, get out now */		;\
    211   1.9      scw 	bic	r4, r4, #(I32_bit)					;\
    212  1.11      scw 1:	ldr	r1, [r5]		/* Pending AST? */		;\
    213   1.7      scw 	teq	r1, #0x00000000						;\
    214   1.7      scw 	bne	2f			/* Yup. Go deal with it */	;\
    215   1.7      scw 	GET_CURPCB_EXIT			/* r1 = curpcb, r2 = cpuinfo */	;\
    216   1.7      scw 	cmp	r1, #0x00		/* curpcb NULL? */		;\
    217   1.7      scw 	ldrne	r1, [r1, #PCB_FLAGS]	/* Fetch curpcb->pcb_flags */	;\
    218   1.7      scw 	tstne	r1, #PCB_NOALIGNFLT					;\
    219   1.7      scw 	beq	3f			/* Keep AFLTs enabled */	;\
    220   1.7      scw 	ldr	r1, [r2, #CI_CTRL]	/* Fetch control register */	;\
    221   1.7      scw 	ldr	r2, .Laflt_cpufuncs					;\
    222   1.7      scw 	mov	r0, #-1							;\
    223   1.7      scw 	bic	r1, r1, #CPU_CONTROL_AFLT_ENABLE  /* Disable AFLTs */	;\
    224   1.7      scw 	adr	lr, 3f							;\
    225   1.7      scw 	ldr	pc, [r2, #CF_CONTROL]	/* Set new CTRL reg value */	;\
    226   1.7      scw 2:	mov	r1, #0x00000000						;\
    227   1.7      scw 	str	r1, [r5]		/* Clear astpending */		;\
    228  1.10      scw 	msr	cpsr_c, r4		/* Restore interrupts */	;\
    229   1.7      scw 	mov	r0, sp							;\
    230  1.11      scw 	bl	_C_LABEL(ast)		/* ast(frame) */		;\
    231  1.11      scw 	orr	r0, r4, #(I32_bit)	/* Disable IRQs */		;\
    232  1.11      scw 	msr	cpsr_c, r0						;\
    233  1.11      scw 	b	1b			/* Back around again */		;\
    234   1.7      scw 3:
    235   1.7      scw 
    236   1.7      scw #else	/* !(COMPAT_15 && EXEC_AOUT) */
    237   1.7      scw 
    238   1.7      scw #define	AST_ALIGNMENT_FAULT_LOCALS					;\
    239   1.7      scw .Laflt_astpending:							;\
    240   1.7      scw 	.word	_C_LABEL(astpending)
    241   1.7      scw 
    242   1.7      scw #define	ENABLE_ALIGNMENT_FAULTS		/* nothing */
    243   1.7      scw 
    244   1.7      scw #define	DO_AST_AND_RESTORE_ALIGNMENT_FAULTS				\
    245   1.8      scw 	ldr	r0, [sp]		/* Get the SPSR from stack */	;\
    246  1.10      scw 	mrs	r4, cpsr		/* save CPSR */			;\
    247  1.11      scw 	orr	r1, r4, #(I32_bit)					;\
    248  1.11      scw 	msr	cpsr_c, r1		/* Disable interrupts */	;\
    249   1.7      scw 	and	r0, r0, #(PSR_MODE)	/* Returning to USR mode? */	;\
    250   1.7      scw 	teq	r0, #(PSR_USR32_MODE)					;\
    251   1.7      scw 	ldreq	r5, .Laflt_astpending					;\
    252   1.7      scw 	bne	2f			/* Nope, get out now */		;\
    253   1.9      scw 	bic	r4, r4, #(I32_bit)					;\
    254   1.8      scw 	ldr	r1, [r5]		/* Pending AST? */		;\
    255   1.7      scw 	teq	r1, #0x00000000						;\
    256   1.7      scw 	beq	2f			/* Nope. Just bail */		;\
    257  1.11      scw 1:	mov	r1, #0x00000000						;\
    258   1.7      scw 	str	r1, [r5]		/* Clear astpending */		;\
    259  1.10      scw 	msr	cpsr_c, r4		/* Restore interrupts */	;\
    260   1.7      scw 	mov	r0, sp							;\
    261  1.11      scw 	bl	_C_LABEL(ast)		/* ast(frame) */		;\
    262  1.11      scw 	orr	r0, r4, #(I32_bit)	/* Disable IRQs */		;\
    263  1.11      scw 	msr	cpsr_c, r0						;\
    264  1.11      scw 	ldr	r1, [r5]		/* Another pending AST? */	;\
    265  1.11      scw 	teq	r1, #0x00000000						;\
    266  1.11      scw 	bne	1b			/* Yup. Back around again */	;\
    267   1.7      scw 2:
    268   1.7      scw #endif /* COMPAT_15 && EXEC_AOUT */
    269   1.7      scw 
    270   1.1  reinoud /*
    271   1.1  reinoud  * ASM macros for pushing and pulling trapframes from the stack
    272   1.1  reinoud  *
    273   1.1  reinoud  * These macros are used to handle the irqframe and trapframe structures
    274   1.1  reinoud  * defined above.
    275   1.1  reinoud  */
    276   1.1  reinoud 
    277   1.1  reinoud /*
    278   1.1  reinoud  * PUSHFRAME - macro to push a trap frame on the stack in the current mode
    279   1.1  reinoud  * Since the current mode is used, the SVC lr field is not defined.
    280   1.1  reinoud  *
    281   1.1  reinoud  * NOTE: r13 and r14 are stored separately as a work around for the
    282   1.1  reinoud  * SA110 rev 2 STM^ bug
    283   1.1  reinoud  */
    284   1.1  reinoud 
    285   1.1  reinoud #define PUSHFRAME							   \
    286   1.1  reinoud 	str	lr, [sp, #-4]!;		/* Push the return address */	   \
    287   1.1  reinoud 	sub	sp, sp, #(4*17);	/* Adjust the stack pointer */	   \
    288   1.1  reinoud 	stmia	sp, {r0-r12};		/* Push the user mode registers */ \
    289   1.1  reinoud 	add	r0, sp, #(4*13);	/* Adjust the stack pointer */	   \
    290   1.1  reinoud 	stmia	r0, {r13-r14}^;		/* Push the user mode registers */ \
    291   1.1  reinoud         mov     r0, r0;                 /* NOP for previous instruction */ \
    292   1.1  reinoud 	mrs	r0, spsr_all;		/* Put the SPSR on the stack */	   \
    293   1.7      scw 	str	r0, [sp, #-4]!
    294   1.1  reinoud 
    295   1.1  reinoud /*
    296   1.1  reinoud  * PULLFRAME - macro to pull a trap frame from the stack in the current mode
    297   1.1  reinoud  * Since the current mode is used, the SVC lr field is ignored.
    298   1.1  reinoud  */
    299   1.1  reinoud 
    300   1.1  reinoud #define PULLFRAME							   \
    301   1.1  reinoud         ldr     r0, [sp], #0x0004;      /* Get the SPSR from stack */	   \
    302   1.1  reinoud         msr     spsr_all, r0;						   \
    303   1.1  reinoud         ldmia   sp, {r0-r14}^;		/* Restore registers (usr mode) */ \
    304   1.1  reinoud         mov     r0, r0;                 /* NOP for previous instruction */ \
    305   1.1  reinoud 	add	sp, sp, #(4*17);	/* Adjust the stack pointer */	   \
    306   1.7      scw  	ldr	lr, [sp], #0x0004	/* Pull the return address */
    307   1.1  reinoud 
    308   1.1  reinoud /*
    309   1.1  reinoud  * PUSHFRAMEINSVC - macro to push a trap frame on the stack in SVC32 mode
    310   1.1  reinoud  * This should only be used if the processor is not currently in SVC32
    311   1.1  reinoud  * mode. The processor mode is switched to SVC mode and the trap frame is
    312   1.1  reinoud  * stored. The SVC lr field is used to store the previous value of
    313   1.1  reinoud  * lr in SVC mode.
    314   1.1  reinoud  *
    315   1.1  reinoud  * NOTE: r13 and r14 are stored separately as a work around for the
    316   1.1  reinoud  * SA110 rev 2 STM^ bug
    317   1.1  reinoud  */
    318   1.1  reinoud 
    319   1.1  reinoud #define PUSHFRAMEINSVC							   \
    320   1.1  reinoud 	stmdb	sp, {r0-r3};		/* Save 4 registers */		   \
    321   1.1  reinoud 	mov	r0, lr;			/* Save xxx32 r14 */		   \
    322   1.1  reinoud 	mov	r1, sp;			/* Save xxx32 sp */		   \
    323   1.3  thorpej 	mrs	r3, spsr;		/* Save xxx32 spsr */		   \
    324   1.3  thorpej 	mrs     r2, cpsr; 		/* Get the CPSR */		   \
    325   1.1  reinoud 	bic     r2, r2, #(PSR_MODE);	/* Fix for SVC mode */		   \
    326   1.1  reinoud 	orr     r2, r2, #(PSR_SVC32_MODE);				   \
    327   1.3  thorpej 	msr     cpsr_c, r2;		/* Punch into SVC mode */	   \
    328   1.1  reinoud 	mov	r2, sp;			/* Save	SVC sp */		   \
    329   1.1  reinoud 	str	r0, [sp, #-4]!;		/* Push return address */	   \
    330   1.1  reinoud 	str	lr, [sp, #-4]!;		/* Push SVC lr */		   \
    331   1.1  reinoud 	str	r2, [sp, #-4]!;		/* Push SVC sp */		   \
    332   1.1  reinoud 	msr     spsr_all, r3;		/* Restore correct spsr */	   \
    333   1.1  reinoud 	ldmdb	r1, {r0-r3};		/* Restore 4 regs from xxx mode */ \
    334   1.1  reinoud 	sub	sp, sp, #(4*15);	/* Adjust the stack pointer */	   \
    335   1.1  reinoud 	stmia	sp, {r0-r12};		/* Push the user mode registers */ \
    336   1.1  reinoud 	add	r0, sp, #(4*13);	/* Adjust the stack pointer */	   \
    337   1.1  reinoud 	stmia	r0, {r13-r14}^;		/* Push the user mode registers */ \
    338   1.1  reinoud         mov     r0, r0;                 /* NOP for previous instruction */ \
    339   1.1  reinoud 	mrs	r0, spsr_all;		/* Put the SPSR on the stack */	   \
    340   1.1  reinoud 	str	r0, [sp, #-4]!
    341   1.1  reinoud 
    342   1.1  reinoud /*
    343   1.1  reinoud  * PULLFRAMEFROMSVCANDEXIT - macro to pull a trap frame from the stack
    344   1.1  reinoud  * in SVC32 mode and restore the saved processor mode and PC.
    345   1.1  reinoud  * This should be used when the SVC lr register needs to be restored on
    346   1.1  reinoud  * exit.
    347   1.1  reinoud  */
    348   1.1  reinoud 
    349   1.1  reinoud #define PULLFRAMEFROMSVCANDEXIT						   \
    350   1.1  reinoud         ldr     r0, [sp], #0x0004;	/* Get the SPSR from stack */	   \
    351   1.1  reinoud         msr     spsr_all, r0;		/* restore SPSR */		   \
    352   1.1  reinoud         ldmia   sp, {r0-r14}^;		/* Restore registers (usr mode) */ \
    353   1.1  reinoud         mov     r0, r0;	  		/* NOP for previous instruction */ \
    354   1.1  reinoud 	add	sp, sp, #(4*15);	/* Adjust the stack pointer */	   \
    355   1.1  reinoud 	ldmia	sp, {sp, lr, pc}^	/* Restore lr and exit */
    356   1.1  reinoud 
    357   1.2   simonb #endif /* _LOCORE */
    358   1.1  reinoud 
    359   1.1  reinoud #endif /* _ARM32_FRAME_H_ */
    360   1.1  reinoud 
    361   1.1  reinoud /* End of frame.h */
    362