1/* 2 * HNDRTE arm trap handling. 3 * 4 * Copyright (C) 1999-2013, Broadcom Corporation 5 * 6 * Permission to use, copy, modify, and/or distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * 18 * $Id: hndrte_armtrap.h 261365 2011-05-24 20:42:23Z $ 19 */ 20 21#ifndef _hndrte_armtrap_h 22#define _hndrte_armtrap_h 23 24 25/* ARM trap handling */ 26 27/* Trap types defined by ARM (see arminc.h) */ 28 29/* Trap locations in lo memory */ 30#define TRAP_STRIDE 4 31#define FIRST_TRAP TR_RST 32#define LAST_TRAP (TR_FIQ * TRAP_STRIDE) 33 34#if defined(__ARM_ARCH_4T__) 35#define MAX_TRAP_TYPE (TR_FIQ + 1) 36#elif defined(__ARM_ARCH_7M__) 37#define MAX_TRAP_TYPE (TR_ISR + ARMCM3_NUMINTS) 38#endif /* __ARM_ARCH_7M__ */ 39 40/* The trap structure is defined here as offsets for assembly */ 41#define TR_TYPE 0x00 42#define TR_EPC 0x04 43#define TR_CPSR 0x08 44#define TR_SPSR 0x0c 45#define TR_REGS 0x10 46#define TR_REG(n) (TR_REGS + (n) * 4) 47#define TR_SP TR_REG(13) 48#define TR_LR TR_REG(14) 49#define TR_PC TR_REG(15) 50 51#define TRAP_T_SIZE 80 52 53#ifndef _LANGUAGE_ASSEMBLY 54 55#include <typedefs.h> 56 57typedef struct _trap_struct { 58 uint32 type; 59 uint32 epc; 60 uint32 cpsr; 61 uint32 spsr; 62 uint32 r0; /* a1 */ 63 uint32 r1; /* a2 */ 64 uint32 r2; /* a3 */ 65 uint32 r3; /* a4 */ 66 uint32 r4; /* v1 */ 67 uint32 r5; /* v2 */ 68 uint32 r6; /* v3 */ 69 uint32 r7; /* v4 */ 70 uint32 r8; /* v5 */ 71 uint32 r9; /* sb/v6 */ 72 uint32 r10; /* sl/v7 */ 73 uint32 r11; /* fp/v8 */ 74 uint32 r12; /* ip */ 75 uint32 r13; /* sp */ 76 uint32 r14; /* lr */ 77 uint32 pc; /* r15 */ 78} trap_t; 79 80#endif /* !_LANGUAGE_ASSEMBLY */ 81 82#endif /* _hndrte_armtrap_h */ 83