haiku/src/kernel/core/faults.c
David Reid 48377a24b0 Few changes...
- catch up with the changes to the interrupt functions
- change the way we handle the list of handlers to use a standard
  function rather than a home spun one :)
- don't add every function on a pci device as a seperate device
- add more info to the pci_info structure
- when FULL_MONTY turned on show more information


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@340 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-19 16:07:36 +00:00

65 lines
1.3 KiB
C

/* Contains the basic code for fault handling. */
/*
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#include <kernel.h>
#include <faults.h>
#include <faults_priv.h>
#include <debug.h>
#include <arch/int.h>
#include <int.h>
#include <arch/faults.h>
#include <stage2.h>
#include <string.h>
#include <stdio.h>
int faults_init(kernel_args *ka)
{
dprintf("init_fault_handlers: entry\n");
return arch_faults_init(ka);
}
int general_protection_fault(int errorcode)
{
panic("GENERAL PROTECTION FAULT: errcode 0x%x. Killing system.\n", errorcode);
return B_HANDLED_INTERRUPT;
}
static const char *fpu_fault_to_str(enum fpu_faults fpu_fault)
{
switch(fpu_fault) {
default:
case FPU_FAULT_CODE_UNKNOWN:
return "unknown";
case FPU_FAULT_CODE_DIVBYZERO:
return "divbyzero";
case FPU_FAULT_CODE_INVALID_OP:
return "invalid op";
case FPU_FAULT_CODE_OVERFLOW:
return "overflow";
case FPU_FAULT_CODE_UNDERFLOW:
return "underflow";
case FPU_FAULT_CODE_INEXACT:
return "inexact";
}
}
int fpu_fault(int fpu_fault)
{
panic("FPU FAULT: errcode 0x%x (%s), Killing system.\n", fpu_fault, fpu_fault_to_str(fpu_fault));
return B_HANDLED_INTERRUPT;
}
int fpu_disable_fault(void)
{
panic("FPU DISABLE FAULT: Killing system.\n");
return B_HANDLED_INTERRUPT;
}