David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 1 | /* MN10300 Microcontroller core exceptions |
| 2 | * |
| 3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public Licence |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the Licence, or (at your option) any later version. |
| 10 | */ |
| 11 | #ifndef _ASM_EXCEPTIONS_H |
| 12 | #define _ASM_EXCEPTIONS_H |
| 13 | |
| 14 | #include <linux/linkage.h> |
| 15 | |
| 16 | /* |
| 17 | * define the breakpoint instruction opcode to use |
Akira Takeuchi | 86c0f93 | 2010-10-27 17:28:41 +0100 | [diff] [blame] | 18 | * - note that the JTAG unit steals 0xFF, so you can't use JTAG and GDBSTUB at |
| 19 | * the same time. |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 20 | */ |
| 21 | #define GDBSTUB_BKPT 0xFF |
| 22 | |
| 23 | #ifndef __ASSEMBLY__ |
| 24 | |
| 25 | /* |
| 26 | * enumeration of exception codes (as extracted from TBR MSW) |
| 27 | */ |
| 28 | enum exception_code { |
| 29 | EXCEP_RESET = 0x000000, /* reset */ |
| 30 | |
| 31 | /* MMU exceptions */ |
| 32 | EXCEP_ITLBMISS = 0x000100, /* instruction TLB miss */ |
| 33 | EXCEP_DTLBMISS = 0x000108, /* data TLB miss */ |
| 34 | EXCEP_IAERROR = 0x000110, /* instruction address */ |
| 35 | EXCEP_DAERROR = 0x000118, /* data address */ |
| 36 | |
| 37 | /* system exceptions */ |
| 38 | EXCEP_TRAP = 0x000128, /* program interrupt (PI instruction) */ |
| 39 | EXCEP_ISTEP = 0x000130, /* single step */ |
| 40 | EXCEP_IBREAK = 0x000150, /* instruction breakpoint */ |
| 41 | EXCEP_OBREAK = 0x000158, /* operand breakpoint */ |
| 42 | EXCEP_PRIVINS = 0x000160, /* privileged instruction execution */ |
| 43 | EXCEP_UNIMPINS = 0x000168, /* unimplemented instruction execution */ |
| 44 | EXCEP_UNIMPEXINS = 0x000170, /* unimplemented extended instruction execution */ |
| 45 | EXCEP_MEMERR = 0x000178, /* illegal memory access */ |
| 46 | EXCEP_MISALIGN = 0x000180, /* misalignment */ |
| 47 | EXCEP_BUSERROR = 0x000188, /* bus error */ |
| 48 | EXCEP_ILLINSACC = 0x000190, /* illegal instruction access */ |
| 49 | EXCEP_ILLDATACC = 0x000198, /* illegal data access */ |
| 50 | EXCEP_IOINSACC = 0x0001a0, /* I/O space instruction access */ |
| 51 | EXCEP_PRIVINSACC = 0x0001a8, /* privileged space instruction access */ |
| 52 | EXCEP_PRIVDATACC = 0x0001b0, /* privileged space data access */ |
| 53 | EXCEP_DATINSACC = 0x0001b8, /* data space instruction access */ |
| 54 | EXCEP_DOUBLE_FAULT = 0x000200, /* double fault */ |
| 55 | |
| 56 | /* FPU exceptions */ |
| 57 | EXCEP_FPU_DISABLED = 0x0001c0, /* FPU disabled */ |
| 58 | EXCEP_FPU_UNIMPINS = 0x0001c8, /* FPU unimplemented operation */ |
| 59 | EXCEP_FPU_OPERATION = 0x0001d0, /* FPU operation */ |
| 60 | |
| 61 | /* interrupts */ |
| 62 | EXCEP_WDT = 0x000240, /* watchdog timer overflow */ |
| 63 | EXCEP_NMI = 0x000248, /* non-maskable interrupt */ |
| 64 | EXCEP_IRQ_LEVEL0 = 0x000280, /* level 0 maskable interrupt */ |
| 65 | EXCEP_IRQ_LEVEL1 = 0x000288, /* level 1 maskable interrupt */ |
| 66 | EXCEP_IRQ_LEVEL2 = 0x000290, /* level 2 maskable interrupt */ |
| 67 | EXCEP_IRQ_LEVEL3 = 0x000298, /* level 3 maskable interrupt */ |
| 68 | EXCEP_IRQ_LEVEL4 = 0x0002a0, /* level 4 maskable interrupt */ |
| 69 | EXCEP_IRQ_LEVEL5 = 0x0002a8, /* level 5 maskable interrupt */ |
| 70 | EXCEP_IRQ_LEVEL6 = 0x0002b0, /* level 6 maskable interrupt */ |
| 71 | |
| 72 | /* system calls */ |
| 73 | EXCEP_SYSCALL0 = 0x000300, /* system call 0 */ |
| 74 | EXCEP_SYSCALL1 = 0x000308, /* system call 1 */ |
| 75 | EXCEP_SYSCALL2 = 0x000310, /* system call 2 */ |
| 76 | EXCEP_SYSCALL3 = 0x000318, /* system call 3 */ |
| 77 | EXCEP_SYSCALL4 = 0x000320, /* system call 4 */ |
| 78 | EXCEP_SYSCALL5 = 0x000328, /* system call 5 */ |
| 79 | EXCEP_SYSCALL6 = 0x000330, /* system call 6 */ |
| 80 | EXCEP_SYSCALL7 = 0x000338, /* system call 7 */ |
| 81 | EXCEP_SYSCALL8 = 0x000340, /* system call 8 */ |
| 82 | EXCEP_SYSCALL9 = 0x000348, /* system call 9 */ |
| 83 | EXCEP_SYSCALL10 = 0x000350, /* system call 10 */ |
| 84 | EXCEP_SYSCALL11 = 0x000358, /* system call 11 */ |
| 85 | EXCEP_SYSCALL12 = 0x000360, /* system call 12 */ |
| 86 | EXCEP_SYSCALL13 = 0x000368, /* system call 13 */ |
| 87 | EXCEP_SYSCALL14 = 0x000370, /* system call 14 */ |
| 88 | EXCEP_SYSCALL15 = 0x000378, /* system call 15 */ |
| 89 | }; |
| 90 | |
| 91 | extern void __set_intr_stub(enum exception_code code, void *handler); |
| 92 | extern void set_intr_stub(enum exception_code code, void *handler); |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 93 | |
| 94 | struct pt_regs; |
| 95 | |
| 96 | extern asmlinkage void __common_exception(void); |
| 97 | extern asmlinkage void itlb_miss(void); |
| 98 | extern asmlinkage void dtlb_miss(void); |
| 99 | extern asmlinkage void itlb_aerror(void); |
| 100 | extern asmlinkage void dtlb_aerror(void); |
| 101 | extern asmlinkage void raw_bus_error(void); |
| 102 | extern asmlinkage void double_fault(void); |
| 103 | extern asmlinkage int system_call(struct pt_regs *); |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 104 | extern asmlinkage void nmi(struct pt_regs *, enum exception_code); |
| 105 | extern asmlinkage void uninitialised_exception(struct pt_regs *, |
| 106 | enum exception_code); |
| 107 | extern asmlinkage void irq_handler(void); |
| 108 | extern asmlinkage void profile_handler(void); |
| 109 | extern asmlinkage void nmi_handler(void); |
| 110 | extern asmlinkage void misalignment(struct pt_regs *, enum exception_code); |
| 111 | |
| 112 | extern void die(const char *, struct pt_regs *, enum exception_code) |
Joe Perches | ff2d8b1 | 2012-01-12 17:17:21 -0800 | [diff] [blame] | 113 | __noreturn; |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 114 | |
| 115 | extern int die_if_no_fixup(const char *, struct pt_regs *, enum exception_code); |
| 116 | |
Akira Takeuchi | 368dd5a | 2010-10-27 17:28:55 +0100 | [diff] [blame] | 117 | #define NUM2EXCEP_IRQ_LEVEL(num) (EXCEP_IRQ_LEVEL0 + (num) * 8) |
| 118 | |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 119 | #endif /* __ASSEMBLY__ */ |
| 120 | |
| 121 | #endif /* _ASM_EXCEPTIONS_H */ |