Exceptions.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /**
  2. * FILE: Exceptions_p0.c
  3. *
  4. * COPYRIGHT (c) 2002-2012 Freescale Semiconductor, Inc. All rights reserved.
  5. *
  6. * DESCRIPTION: Setup of Core_0 IVPR to point to the EXCEPTION_HANDLERS memory area
  7. * defined in the linker command file.
  8. * Default setup of the IVORxx registers.
  9. *
  10. * Note: We use "_p0" suffix on functions and section names to reference the
  11. * Core_0, "_p1" for functions and section names using the Core_1.
  12. *
  13. * VERSION: 1.1
  14. */
  15. /*----------------------------------------------------------------------------*/
  16. /* Includes */
  17. /*----------------------------------------------------------------------------*/
  18. #include "Exceptions.h" /* Implement functions from this file */
  19. /*----------------------------------------------------------------------------*/
  20. /* Function Implementations */
  21. /*----------------------------------------------------------------------------*/
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #pragma push /* Save the current state */
  26. /* Symbol EXCEPTION_HANDLERS is defined in the application linker command file (.lcf)
  27. It is defined to the start of the code memory area used for the .__exception_handlers section.
  28. */
  29. /*lint -esym(752, EXCEPTION_HANDLERS) */
  30. __declspec (section ".__exception_handlers_p0") extern long EXCEPTION_HANDLERS;
  31. #pragma force_active on
  32. #pragma function_align 16 /* We use 16 bytes alignment for IVOR exception table entries. */
  33. __declspec(interrupt)
  34. __declspec (section ".__exception_handlers_p0")
  35. void EXCEP_DefaultExceptionHandler(void)
  36. {
  37. }
  38. #pragma force_active off
  39. #pragma pop
  40. __asm void EXCEP_InitExceptionHandlers(void)
  41. {
  42. nofralloc
  43. // Set the IVPR to the exception handlers address defined in the lcf file.
  44. // The IVPR[0-15] bits Vector Base and IVPR[16-31] bits are ignored.
  45. lis r0, EXCEPTION_HANDLERS@h
  46. mtivpr r0
  47. li r0, EXCEPTION_HANDLERS@l
  48. mtivor0 r0
  49. li r0, (EXCEPTION_HANDLERS + 0x10)@l
  50. mtivor1 r0
  51. li r0, (EXCEPTION_HANDLERS + 0x20)@l
  52. mtivor2 r0
  53. li r0, (EXCEPTION_HANDLERS + 0x30)@l
  54. mtivor3 r0
  55. li r0, (EXCEPTION_HANDLERS + 0x40)@l
  56. mtivor4 r0
  57. li r0, (EXCEPTION_HANDLERS + 0x50)@l
  58. mtivor5 r0
  59. li r0, (EXCEPTION_HANDLERS + 0x60)@l
  60. mtivor6 r0
  61. li r0, (EXCEPTION_HANDLERS + 0x70)@l
  62. mtivor7 r0
  63. li r0, (EXCEPTION_HANDLERS + 0x80)@l
  64. mtivor8 r0
  65. li r0, (EXCEPTION_HANDLERS + 0x90)@l
  66. mtivor9 r0
  67. li r0, (EXCEPTION_HANDLERS + 0xA0)@l
  68. mtivor10 r0
  69. li r0, (EXCEPTION_HANDLERS + 0xB0)@l
  70. mtivor11 r0
  71. li r0, (EXCEPTION_HANDLERS + 0xC0)@l
  72. mtivor12 r0
  73. li r0, (EXCEPTION_HANDLERS + 0xD0)@l
  74. mtivor13 r0
  75. li r0, (EXCEPTION_HANDLERS + 0xE0)@l
  76. mtivor14 r0
  77. li r0, (EXCEPTION_HANDLERS + 0xF0)@l
  78. mtivor15 r0
  79. blr
  80. }
  81. #ifdef __cplusplus
  82. }
  83. #endif