vectors.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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/cpu.h>
  20. #include <linux/sched.h>
  21. #include <linux/kernel.h>
  22. #include <linux/linkage.h>
  23. #include <linux/init.h>
  24. #include <linux/kallsyms.h>
  25. #include <asm/setup.h>
  26. #include <asm/fpu.h>
  27. #include <asm/traps.h>
  28. #include "vectors.h"
  29. /* assembler routines */
  30. asmlinkage void system_call(void);
  31. asmlinkage void buserr(void);
  32. asmlinkage void trap(void);
  33. asmlinkage void nmihandler(void);
  34. #ifdef CONFIG_M68KFPU_EMU
  35. asmlinkage void fpu_emu(void);
  36. #endif
  37. e_vector vectors[256];
  38. /* nmi handler for the Amiga */
  39. asm(".text\n"
  40. __ALIGN_STR "\n"
  41. "nmihandler: rte");
  42. /*
  43. * this must be called very early as the kernel might
  44. * use some instruction that are emulated on the 060
  45. * and so we're prepared for early probe attempts (e.g. nf_init).
  46. */
  47. void __init base_trap_init(void)
  48. {
  49. if (MACH_IS_SUN3X) {
  50. extern e_vector *sun3x_prom_vbr;
  51. __asm__ volatile ("movec %%vbr, %0" : "=r" (sun3x_prom_vbr));
  52. }
  53. /* setup the exception vector table */
  54. __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
  55. if (CPU_IS_060) {
  56. /* set up ISP entry points */
  57. asmlinkage void unimp_vec(void) asm ("_060_isp_unimp");
  58. vectors[VEC_UNIMPII] = unimp_vec;
  59. }
  60. vectors[VEC_BUSERR] = buserr;
  61. vectors[VEC_ILLEGAL] = trap;
  62. vectors[VEC_SYS] = system_call;
  63. }
  64. void __init trap_init (void)
  65. {
  66. int i;
  67. for (i = VEC_SPUR; i <= VEC_INT7; i++)
  68. vectors[i] = bad_inthandler;
  69. for (i = 0; i < VEC_USER; i++)
  70. if (!vectors[i])
  71. vectors[i] = trap;
  72. for (i = VEC_USER; i < 256; i++)
  73. vectors[i] = bad_inthandler;
  74. #ifdef CONFIG_M68KFPU_EMU
  75. if (FPU_IS_EMU)
  76. vectors[VEC_LINE11] = fpu_emu;
  77. #endif
  78. if (CPU_IS_040 && !FPU_IS_EMU) {
  79. /* set up FPSP entry points */
  80. asmlinkage void dz_vec(void) asm ("dz");
  81. asmlinkage void inex_vec(void) asm ("inex");
  82. asmlinkage void ovfl_vec(void) asm ("ovfl");
  83. asmlinkage void unfl_vec(void) asm ("unfl");
  84. asmlinkage void snan_vec(void) asm ("snan");
  85. asmlinkage void operr_vec(void) asm ("operr");
  86. asmlinkage void bsun_vec(void) asm ("bsun");
  87. asmlinkage void fline_vec(void) asm ("fline");
  88. asmlinkage void unsupp_vec(void) asm ("unsupp");
  89. vectors[VEC_FPDIVZ] = dz_vec;
  90. vectors[VEC_FPIR] = inex_vec;
  91. vectors[VEC_FPOVER] = ovfl_vec;
  92. vectors[VEC_FPUNDER] = unfl_vec;
  93. vectors[VEC_FPNAN] = snan_vec;
  94. vectors[VEC_FPOE] = operr_vec;
  95. vectors[VEC_FPBRUC] = bsun_vec;
  96. vectors[VEC_LINE11] = fline_vec;
  97. vectors[VEC_FPUNSUP] = unsupp_vec;
  98. }
  99. if (CPU_IS_060 && !FPU_IS_EMU) {
  100. /* set up IFPSP entry points */
  101. asmlinkage void snan_vec6(void) asm ("_060_fpsp_snan");
  102. asmlinkage void operr_vec6(void) asm ("_060_fpsp_operr");
  103. asmlinkage void ovfl_vec6(void) asm ("_060_fpsp_ovfl");
  104. asmlinkage void unfl_vec6(void) asm ("_060_fpsp_unfl");
  105. asmlinkage void dz_vec6(void) asm ("_060_fpsp_dz");
  106. asmlinkage void inex_vec6(void) asm ("_060_fpsp_inex");
  107. asmlinkage void fline_vec6(void) asm ("_060_fpsp_fline");
  108. asmlinkage void unsupp_vec6(void) asm ("_060_fpsp_unsupp");
  109. asmlinkage void effadd_vec6(void) asm ("_060_fpsp_effadd");
  110. vectors[VEC_FPNAN] = snan_vec6;
  111. vectors[VEC_FPOE] = operr_vec6;
  112. vectors[VEC_FPOVER] = ovfl_vec6;
  113. vectors[VEC_FPUNDER] = unfl_vec6;
  114. vectors[VEC_FPDIVZ] = dz_vec6;
  115. vectors[VEC_FPIR] = inex_vec6;
  116. vectors[VEC_LINE11] = fline_vec6;
  117. vectors[VEC_FPUNSUP] = unsupp_vec6;
  118. vectors[VEC_UNIMPEA] = effadd_vec6;
  119. }
  120. /* if running on an amiga, make the NMI interrupt do nothing */
  121. if (MACH_IS_AMIGA) {
  122. vectors[VEC_INT7] = nmihandler;
  123. }
  124. }