vectors.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/coldfire/vectors.c
  4. *
  5. * Copyright (C) 1999-2007, Greg Ungerer <gerg@snapgear.com>
  6. */
  7. /***************************************************************************/
  8. #include <linux/kernel.h>
  9. #include <linux/init.h>
  10. #include <linux/irq.h>
  11. #include <asm/traps.h>
  12. #include <asm/machdep.h>
  13. #include <asm/coldfire.h>
  14. #include <asm/mcfsim.h>
  15. #include <asm/mcfwdebug.h>
  16. /***************************************************************************/
  17. #ifdef TRAP_DBG_INTERRUPT
  18. asmlinkage void dbginterrupt_c(struct frame *fp)
  19. {
  20. extern void dump(struct pt_regs *fp);
  21. printk(KERN_DEBUG "%s(%d): BUS ERROR TRAP\n", __FILE__, __LINE__);
  22. dump((struct pt_regs *) fp);
  23. asm("halt");
  24. }
  25. #endif
  26. /***************************************************************************/
  27. extern e_vector *_ramvec;
  28. void set_evector(int vecnum, void (*handler)(void))
  29. {
  30. if (vecnum >= 0 && vecnum <= 255)
  31. _ramvec[vecnum] = handler;
  32. }
  33. /***************************************************************************/
  34. /* Assembler routines */
  35. asmlinkage void buserr(void);
  36. asmlinkage void trap(void);
  37. asmlinkage void system_call(void);
  38. asmlinkage void inthandler(void);
  39. void __init init_vectors(void)
  40. {
  41. int i;
  42. /*
  43. * There is a common trap handler and common interrupt
  44. * handler that handle almost every vector. We treat
  45. * the system call and bus error special, they get their
  46. * own first level handlers.
  47. */
  48. for (i = 3; (i <= 23); i++)
  49. _ramvec[i] = trap;
  50. for (i = 33; (i <= 63); i++)
  51. _ramvec[i] = trap;
  52. for (i = 24; (i <= 31); i++)
  53. _ramvec[i] = inthandler;
  54. for (i = 64; (i < 255); i++)
  55. _ramvec[i] = inthandler;
  56. _ramvec[255] = 0;
  57. _ramvec[2] = buserr;
  58. _ramvec[32] = system_call;
  59. #ifdef TRAP_DBG_INTERRUPT
  60. _ramvec[12] = dbginterrupt;
  61. #endif
  62. }
  63. /***************************************************************************/