vectors.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * vectors.c
  3. *
  4. * Copyright (C) 1993, 1994 by Hamish Macdonald
  5. *
  6. * 68040 fixes by Michael Rausch
  7. * 68040 fixes by Martin Apel
  8. * 68040 fixes and writeback by Richard Zidlicky
  9. * 68060 fixes by Roman Hodek
  10. * 68060 fixes by Jesper Skov
  11. *
  12. * This file is subject to the terms and conditions of the GNU General Public
  13. * License. See the file COPYING in the main directory of this archive
  14. * for more details.
  15. */
  16. /*
  17. * Sets up all exception vectors
  18. */
  19. #include <linux/sched.h>
  20. #include <linux/kernel.h>
  21. #include <linux/linkage.h>
  22. #include <linux/init.h>
  23. #include <linux/kallsyms.h>
  24. #include <asm/setup.h>
  25. #include <asm/fpu.h>
  26. #include <asm/traps.h>
  27. /* assembler routines */
  28. asmlinkage void system_call(void);
  29. asmlinkage void buserr(void);
  30. asmlinkage void trap(void);
  31. asmlinkage void nmihandler(void);
  32. #ifdef CONFIG_M68KFPU_EMU
  33. asmlinkage void fpu_emu(void);
  34. #endif
  35. e_vector vectors[256];
  36. /* nmi handler for the Amiga */
  37. asm(".text\n"
  38. __ALIGN_STR "\n"
  39. "nmihandler: rte");
  40. /*
  41. * this must be called very early as the kernel might
  42. * use some instruction that are emulated on the 060
  43. * and so we're prepared for early probe attempts (e.g. nf_init).
  44. */
  45. void __init base_trap_init(void)
  46. {
  47. if (MACH_IS_SUN3X) {
  48. extern e_vector *sun3x_prom_vbr;
  49. __asm__ volatile ("movec %%vbr, %0" : "=r" (sun3x_prom_vbr));
  50. }
  51. /* setup the exception vector table */
  52. __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
  53. if (CPU_IS_060) {
  54. /* set up ISP entry points */
  55. asmlinkage void unimp_vec(void) asm ("_060_isp_unimp");
  56. vectors[VEC_UNIMPII] = unimp_vec;
  57. }
  58. vectors[VEC_BUSERR] = buserr;
  59. vectors[VEC_ILLEGAL] = trap;
  60. vectors[VEC_SYS] = system_call;
  61. }
  62. void __init trap_init (void)
  63. {
  64. int i;
  65. for (i = VEC_SPUR; i <= VEC_INT7; i++)
  66. vectors[i] = bad_inthandler;
  67. for (i = 0; i < VEC_USER; i++)
  68. if (!vectors[i])
  69. vectors[i] = trap;
  70. for (i = VEC_USER; i < 256; i++)
  71. vectors[i] = bad_inthandler;
  72. #ifdef CONFIG_M68KFPU_EMU
  73. if (FPU_IS_EMU)
  74. vectors[VEC_LINE11] = fpu_emu;
  75. #endif
  76. if (CPU_IS_040 && !FPU_IS_EMU) {
  77. /* set up FPSP entry points */
  78. asmlinkage void dz_vec(void) asm ("dz");
  79. asmlinkage void inex_vec(void) asm ("inex");
  80. asmlinkage void ovfl_vec(void) asm ("ovfl");
  81. asmlinkage void unfl_vec(void) asm ("unfl");
  82. asmlinkage void snan_vec(void) asm ("snan");
  83. asmlinkage void operr_vec(void) asm ("operr");
  84. asmlinkage void bsun_vec(void) asm ("bsun");
  85. asmlinkage void fline_vec(void) asm ("fline");
  86. asmlinkage void unsupp_vec(void) asm ("unsupp");
  87. vectors[VEC_FPDIVZ] = dz_vec;
  88. vectors[VEC_FPIR] = inex_vec;
  89. vectors[VEC_FPOVER] = ovfl_vec;
  90. vectors[VEC_FPUNDER] = unfl_vec;
  91. vectors[VEC_FPNAN] = snan_vec;
  92. vectors[VEC_FPOE] = operr_vec;
  93. vectors[VEC_FPBRUC] = bsun_vec;
  94. vectors[VEC_LINE11] = fline_vec;
  95. vectors[VEC_FPUNSUP] = unsupp_vec;
  96. }
  97. if (CPU_IS_060 && !FPU_IS_EMU) {
  98. /* set up IFPSP entry points */
  99. asmlinkage void snan_vec6(void) asm ("_060_fpsp_snan");
  100. asmlinkage void operr_vec6(void) asm ("_060_fpsp_operr");
  101. asmlinkage void ovfl_vec6(void) asm ("_060_fpsp_ovfl");
  102. asmlinkage void unfl_vec6(void) asm ("_060_fpsp_unfl");
  103. asmlinkage void dz_vec6(void) asm ("_060_fpsp_dz");
  104. asmlinkage void inex_vec6(void) asm ("_060_fpsp_inex");
  105. asmlinkage void fline_vec6(void) asm ("_060_fpsp_fline");
  106. asmlinkage void unsupp_vec6(void) asm ("_060_fpsp_unsupp");
  107. asmlinkage void effadd_vec6(void) asm ("_060_fpsp_effadd");
  108. vectors[VEC_FPNAN] = snan_vec6;
  109. vectors[VEC_FPOE] = operr_vec6;
  110. vectors[VEC_FPOVER] = ovfl_vec6;
  111. vectors[VEC_FPUNDER] = unfl_vec6;
  112. vectors[VEC_FPDIVZ] = dz_vec6;
  113. vectors[VEC_FPIR] = inex_vec6;
  114. vectors[VEC_LINE11] = fline_vec6;
  115. vectors[VEC_FPUNSUP] = unsupp_vec6;
  116. vectors[VEC_UNIMPEA] = effadd_vec6;
  117. }
  118. /* if running on an amiga, make the NMI interrupt do nothing */
  119. if (MACH_IS_AMIGA) {
  120. vectors[VEC_INT7] = nmihandler;
  121. }
  122. }