/*
* linux/arch/m68k/kernel/traps.c
*
* Copyright (C) 1993, 1994 by Hamish Macdonald
*
* 68040 fixes by Michael Rausch
* 68040 fixes by Martin Apel
* 68040 fixes and writeback by Richard Zidlicky
* 68060 fixes by Roman Hodek
* 68060 fixes by Jesper Skov
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
* for more details.
*/
/*
* Sets up all exception vectors
*/
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/a.out.h>
#include <linux/user.h>
#include <linux/string.h>
#include <linux/linkage.h>
#include <linux/init.h>
#include <linux/ptrace.h>
#include <linux/kallsyms.h>
#include <asm/setup.h>
#include <asm/fpu.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/traps.h>
#include <asm/pgalloc.h>
#include <asm/machdep.h>
#include <asm/siginfo.h>
/* assembler routines */
asmlinkage void system_call(void);
asmlinkage void buserr(void);
asmlinkage void trap(void);
asmlinkage void inthandler(void);
asmlinkage void nmihandler(void);
#ifdef CONFIG_M68KFPU_EMU
asmlinkage void fpu_emu(void);
#endif
e_vector vectors[256] = {
[VEC_BUSERR] = buserr,
[VEC_ADDRERR] = trap,
[VEC_ILLEGAL] = trap,
[VEC_ZERODIV] = trap,
[VEC_CHK] = trap,
[VEC_TRAP] = trap,
[VEC_PRIV] = trap,
[VEC_TRACE] = trap,
[VEC_LINE10] = trap,
[VEC_LINE11] = trap,
[VEC_RESV12] = trap,
[VEC_COPROC] = trap,
[VEC_FORMAT] = trap,
[VEC_UNINT] = trap,
[VEC_RESV16] = trap,
[VEC_RESV17] = trap,
[VEC_RESV18] = trap,
[VEC_RESV19] = trap,
[VEC_RESV20] = trap,
[VEC_RESV21] = trap,
[VEC_RESV22] = trap,
[VEC_RESV23] = trap,
[VEC_SPUR] = inthandler,
[VEC_INT1] = inthandler,
[VEC_INT2] = inthandler,
[VEC_INT3] = inthandler,
[VEC_INT4] = inthandler,
[VEC_INT5] = inthandler,
[VEC_INT6] = inthandler,
[VEC_INT7] = inthandler,
[VEC_SYS] = system_call,
[VEC_TRAP1] = trap,
[VEC_TRAP2] = trap,
[VEC_TRAP3] = trap,
[VEC_TRAP4] = trap,
[VEC_TRAP5] = trap,
[VEC_TRAP6] = trap,
[VEC_TRAP7] = trap,
[VEC_TRAP8] = trap,
[VEC_TRAP9] = trap,
[VEC_TRAP10] = trap,
[VEC_TRAP11] = trap,
[VEC_TRAP12] = trap,
[VEC_TRAP13] = trap,
[VEC_TRAP14] = trap,
[VEC_TRAP15] = trap,
};
/* nmi handler for the Amiga */
asm(".text\n"
__ALIGN_STR "\n"
"nmihandler: rte");
/*
* this must be called very early as the kernel might
* use some instruction that are emulated on the 060
*/
void __init base_trap_init(void)
{
if(MACH_IS_SUN3X) {
extern e_vector *sun3x_prom_vbr;
__asm__ volatile ("movec %%vbr, %0" : "=r" ((void*)sun3x_prom_vbr));
}
/* setup the exception vector table */
__asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
if (CPU_IS_060) {
/* set up ISP entry points */
asmlinkage void unimp_vec(void) asm ("_060_isp_unimp");
vectors[VEC_UNIMPII] = unimp_vec;
}
}
void __init trap_init (void)
{
int i;
for (i = 48; i < 64; i++)
if (!vectors[i])
vectors[i] = trap;
for (i = 64; i < 256; i++)
vectors[i] = inthandler;
#ifdef CONFIG_M68KFPU_EMU
if (FPU_IS_EMU)
vectors[VEC_LINE11] = fpu_emu;
#endif
if (CPU_IS_040 && !FPU_IS_EMU) {
/* set up FPSP entry points */
asmlinkage void dz_vec(void) asm ("dz");
asmlinkage void inex_vec(void) asm ("inex");
asmlinkage void ovfl_vec(void) asm ("ovfl");
asmlinkage void unfl_vec(void) asm ("unfl");
asmlinkage void snan_vec(void) asm ("snan");
asmlinkage void operr_vec(void) asm ("operr");
asmlinkage void bsun_vec(void) asm ("bsun");
asmlinkage void fline_vec(void) asm ("fline");
asmlinkage void unsupp_vec(void) asm ("unsupp");
vectors[VEC_FPDIVZ] = dz_vec;
vectors[VEC_FPIR] = inex_vec;
vectors[VEC_FPOVER] = ovfl_vec;
vectors[VEC_FPUNDER] = unfl_vec;
vectors[VEC_FPNAN] = snan_vec;
vectors[VEC_FPOE] = operr_vec;
vectors[VEC_FPBRUC] = bsun_vec;
vectors[VEC_LINE11] = fline_vec;
vectors[VEC_FPUNSUP] = unsupp_vec;
}
if (CPU_IS_060 && !FPU_IS_EMU) {
/* set up IFPSP entry points */
asmlinkage void snan_vec6(void) asm ("_060_fpsp_snan");
asmlinkage void operr_vec6(void) asm ("_060_fpsp_operr");
asmlinkage void ovfl_vec6(void) asm ("_060_fpsp_ovfl");
asmlinkage void unfl_vec6(void) asm ("_060_fpsp_unfl");
asmlinkage void dz_vec6(void) asm ("_060_fpsp_dz");
asmlinkage void inex_vec6(void) asm ("_060_fpsp_inex");
asmlinkage void fline_vec6(void) asm ("_060_fpsp_fline");
asmlinkage
|