| 1 | /*
|
|---|
| 2 | * Copyright (c) 2007 Michal Kebrt, Petr Stepan
|
|---|
| 3 | *
|
|---|
| 4 | * All rights reserved.
|
|---|
| 5 | *
|
|---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
|---|
| 7 | * modification, are permitted provided that the following conditions
|
|---|
| 8 | * are met:
|
|---|
| 9 | *
|
|---|
| 10 | * - Redistributions of source code must retain the above copyright
|
|---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
|---|
| 12 | * - Redistributions in binary form must reproduce the above copyright
|
|---|
| 13 | * notice, this list of conditions and the following disclaimer in the
|
|---|
| 14 | * documentation and/or other materials provided with the distribution.
|
|---|
| 15 | * - The name of the author may not be used to endorse or promote products
|
|---|
| 16 | * derived from this software without specific prior written permission.
|
|---|
| 17 | *
|
|---|
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|---|
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|---|
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|---|
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|---|
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|---|
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|---|
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|---|
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|---|
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|---|
| 28 | */
|
|---|
| 29 |
|
|---|
| 30 | /** @addtogroup arm32
|
|---|
| 31 | * @{
|
|---|
| 32 | */
|
|---|
| 33 | /** @file
|
|---|
| 34 | * @brief Exception declarations.
|
|---|
| 35 | */
|
|---|
| 36 |
|
|---|
| 37 | #ifndef KERN_arm32_EXCEPTION_H_
|
|---|
| 38 | #define KERN_arm32_EXCEPTION_H_
|
|---|
| 39 |
|
|---|
| 40 | #include <typedefs.h>
|
|---|
| 41 | #include <arch/istate.h>
|
|---|
| 42 |
|
|---|
| 43 | /** If defined, forces using of high exception vectors. */
|
|---|
| 44 | #define HIGH_EXCEPTION_VECTORS
|
|---|
| 45 |
|
|---|
| 46 | #ifdef HIGH_EXCEPTION_VECTORS
|
|---|
| 47 | #define EXC_BASE_ADDRESS 0xffff0000
|
|---|
| 48 | #else
|
|---|
| 49 | #define EXC_BASE_ADDRESS 0x0
|
|---|
| 50 | #endif
|
|---|
| 51 |
|
|---|
| 52 | /* Exception Vectors */
|
|---|
| 53 | #define EXC_RESET_VEC (EXC_BASE_ADDRESS + 0x0)
|
|---|
| 54 | #define EXC_UNDEF_INSTR_VEC (EXC_BASE_ADDRESS + 0x4)
|
|---|
| 55 | #define EXC_SWI_VEC (EXC_BASE_ADDRESS + 0x8)
|
|---|
| 56 | #define EXC_PREFETCH_ABORT_VEC (EXC_BASE_ADDRESS + 0xc)
|
|---|
| 57 | #define EXC_DATA_ABORT_VEC (EXC_BASE_ADDRESS + 0x10)
|
|---|
| 58 | #define EXC_IRQ_VEC (EXC_BASE_ADDRESS + 0x18)
|
|---|
| 59 | #define EXC_FIQ_VEC (EXC_BASE_ADDRESS + 0x1c)
|
|---|
| 60 |
|
|---|
| 61 | /* Exception numbers */
|
|---|
| 62 | #define EXC_RESET 0
|
|---|
| 63 | #define EXC_UNDEF_INSTR 1
|
|---|
| 64 | #define EXC_SWI 2
|
|---|
| 65 | #define EXC_PREFETCH_ABORT 3
|
|---|
| 66 | #define EXC_DATA_ABORT 4
|
|---|
| 67 | #define EXC_IRQ 5
|
|---|
| 68 | #define EXC_FIQ 6
|
|---|
| 69 |
|
|---|
| 70 | /** Kernel stack pointer.
|
|---|
| 71 | *
|
|---|
| 72 | * It is set when thread switches to user mode,
|
|---|
| 73 | * and then used for exception handling.
|
|---|
| 74 | *
|
|---|
| 75 | */
|
|---|
| 76 | extern uintptr_t supervisor_sp;
|
|---|
| 77 |
|
|---|
| 78 | /** Temporary exception stack pointer.
|
|---|
| 79 | *
|
|---|
| 80 | * Temporary stack is used in exceptions handling routines
|
|---|
| 81 | * before switching to thread's kernel stack.
|
|---|
| 82 | *
|
|---|
| 83 | */
|
|---|
| 84 | extern uintptr_t exc_stack;
|
|---|
| 85 |
|
|---|
| 86 | extern void install_exception_handlers(void);
|
|---|
| 87 | extern void exception_init(void);
|
|---|
| 88 | extern void reset_exception_entry(void);
|
|---|
| 89 | extern void irq_exception_entry(void);
|
|---|
| 90 | extern void fiq_exception_entry(void);
|
|---|
| 91 | extern void undef_instr_exception_entry(void);
|
|---|
| 92 | extern void prefetch_abort_exception_entry(void);
|
|---|
| 93 | extern void data_abort_exception_entry(void);
|
|---|
| 94 | extern void swi_exception_entry(void);
|
|---|
| 95 |
|
|---|
| 96 | #endif
|
|---|
| 97 |
|
|---|
| 98 | /** @}
|
|---|
| 99 | */
|
|---|