Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

i386/kernel/traps.c File Reference

#include <linux/config.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/ptrace.h>
#include <linux/timer.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/spinlock.h>
#include <asm/atomic.h>
#include <asm/debugreg.h>
#include <asm/desc.h>
#include <asm/smp.h>
#include "irq.h"

Include dependency graph for i386/kernel/traps.c:

Go to the source code of this file.

Defines

#define DO_ERROR(trapnr, signr, str, name, tsk)
#define DO_VM86_ERROR(trapnr, signr, str, name, tsk)
#define VMALLOC_OFFSET   (8*1024*1024)
#define MODULE_RANGE   (8*1024*1024)
#define _set_gate(gate_addr, type, dpl, addr)
#define _set_seg_desc(gate_addr, type, dpl, base, limit)
#define _set_tssldt_desc(n, addr, limit, type)

Functions

asmlinkage int system_call (void)
asmlinkage void lcall7 (void)
desc_struct idt_table[256] __attribute__ ((__section__(".data.idt")))
static void console_verbose (void)
void page_exception (void)
asmlinkage void divide_error (void)
asmlinkage void debug (void)
asmlinkage void nmi (void)
asmlinkage void int3 (void)
asmlinkage void overflow (void)
asmlinkage void bounds (void)
asmlinkage void invalid_op (void)
asmlinkage void device_not_available (void)
asmlinkage void double_fault (void)
asmlinkage void coprocessor_segment_overrun (void)
asmlinkage void invalid_TSS (void)
asmlinkage void segment_not_present (void)
asmlinkage void stack_segment (void)
asmlinkage void general_protection (void)
asmlinkage void page_fault (void)
asmlinkage void coprocessor_error (void)
asmlinkage void alignment_check (void)
asmlinkage void spurious_interrupt_bug (void)
asmlinkage void machine_check (void)
static void show_registers (struct pt_regs *regs)
void die (const char *str, struct pt_regs *regs, long err)
static void die_if_kernel (const char *str, struct pt_regs *regs, long err)
static void die_if_no_fixup (const char *str, struct pt_regs *regs, long err)
asmlinkage void cache_flush_denied (struct pt_regs *regs, long error_code)
asmlinkage void do_general_protection (struct pt_regs *regs, long error_code)
static void mem_parity_error (unsigned char reason, struct pt_regs *regs)
static void io_check_error (unsigned char reason, struct pt_regs *regs)
static void unknown_nmi_error (unsigned char reason, struct pt_regs *regs)
asmlinkage void do_nmi (struct pt_regs *regs, long error_code)
asmlinkage void do_debug (struct pt_regs *regs, long error_code)
void math_error (void)
asmlinkage void do_coprocessor_error (struct pt_regs *regs, long error_code)
asmlinkage void do_spurious_interrupt_bug (struct pt_regs *regs, long error_code)
asmlinkage void math_state_restore (struct pt_regs regs)
asmlinkage void math_emulate (long arg)
 __initfunc (void trap_init_f00f_bug(void))
void set_intr_gate (unsigned int n, void *addr)
static void __init set_trap_gate (unsigned int n, void *addr)
static void __init set_system_gate (unsigned int n, void *addr)
static void __init set_call_gate (void *a, void *addr)
void set_tss_desc (unsigned int n, void *addr)
void set_ldt_desc (unsigned int n, void *addr, unsigned int size)
void __init trap_init (void)

Variables

desc_struct default_ldt = { 0, 0 }
int kstack_depth_to_print = 24
spinlock_t die_lock


Define Documentation

#define _set_gate gate_addr,
type,
dpl,
addr   ) 
 

Value:

do { \
  int __d0, __d1; \
  __asm__ __volatile__ ("movw %%dx,%%ax\n\t" \
        "movw %4,%%dx\n\t" \
        "movl %%eax,%0\n\t" \
        "movl %%edx,%1" \
        :"=m" (*((long *) (gate_addr))), \
         "=m" (*(1+(long *) (gate_addr))), "=&a" (__d0), "=&d" (__d1) \
        :"i" ((short) (0x8000+(dpl<<13)+(type<<8))), \
         "3" ((char *) (addr)),"2" (__KERNEL_CS << 16)); \
} while (0)

Definition at line 526 of file i386/kernel/traps.c.

Referenced by set_call_gate(), set_intr_gate(), set_system_gate(), and set_trap_gate().

#define _set_seg_desc gate_addr,
type,
dpl,
base,
limit   ) 
 

Value:

{\
        *((gate_addr)+1) = ((base) & 0xff000000) | \
                (((base) & 0x00ff0000)>>16) | \
                ((limit) & 0xf0000) | \
                ((dpl)<<13) | \
                (0x00408000) | \
                ((type)<<8); \
        *(gate_addr) = (((base) & 0x0000ffff)<<16) | \
                ((limit) & 0x0ffff); }

Definition at line 566 of file i386/kernel/traps.c.

#define _set_tssldt_desc n,
addr,
limit,
type   ) 
 

Value:

__asm__ __volatile__ ("movw %3,0(%2)\n\t" \
        "movw %%ax,2(%2)\n\t" \
        "rorl $16,%%eax\n\t" \
        "movb %%al,4(%2)\n\t" \
        "movb %4,5(%2)\n\t" \
        "movb $0,6(%2)\n\t" \
        "movb %%ah,7(%2)\n\t" \
        "rorl $16,%%eax" \
        : "=m"(*(n)) : "a" (addr), "r"(n), "ir"(limit), "i"(type))

Definition at line 576 of file i386/kernel/traps.c.

Referenced by set_ldt_desc(), and set_tss_desc().

#define DO_ERROR trapnr,
signr,
str,
name,
tsk   ) 
 

Value:

asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
{ \
        tsk->tss.error_code = error_code; \
        tsk->tss.trap_no = trapnr; \
        force_sig(signr, tsk); \
        die_if_no_fixup(str,regs,error_code); \
}

Definition at line 65 of file i386/kernel/traps.c.

#define DO_VM86_ERROR trapnr,
signr,
str,
name,
tsk   ) 
 

Value:

asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
{ \
        lock_kernel(); \
        if (regs->eflags & VM_MASK) { \
                if (!handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, trapnr)) \
                        goto out; \
                /* else fall through */ \
        } \
        tsk->tss.error_code = error_code; \
        tsk->tss.trap_no = trapnr; \
        force_sig(signr, tsk); \
        die_if_kernel(str,regs,error_code); \
out: \
        unlock_kernel(); \
}

Definition at line 74 of file i386/kernel/traps.c.

#define MODULE_RANGE   (8*1024*1024)
 

Definition at line 121 of file i386/kernel/traps.c.

#define VMALLOC_OFFSET   (8*1024*1024)
 

Definition at line 120 of file i386/kernel/traps.c.


Function Documentation

struct desc_struct idt_table [256] __attribute__ (__section__(".data.idt"))   ) 
 

__initfunc void   trap_init_f00f_bug(void)  ) 
 

Definition at line 498 of file i386/kernel/traps.c.

References __asm__(), free_page, idt_descr, init_mm, local_flush_tlb, long, mk_pte, page, PAGE_KERNEL_RO, PAGE_SIZE, pgd_offset, pmd_offset, pte_offset, pte_page, and vmalloc().

Here is the call graph for this function:

asmlinkage void alignment_check void   ) 
 

Referenced by trap_init().

asmlinkage void bounds void   ) 
 

Referenced by trap_init().

asmlinkage void cache_flush_denied struct pt_regs regs,
long  error_code
 

Definition at line 252 of file i386/kernel/traps.c.

References current, die_if_kernel(), force_sig(), handle_vm86_fault(), and VM_MASK.

Here is the call graph for this function:

static void console_verbose void   )  [inline, static]
 

Definition at line 59 of file i386/kernel/traps.c.

References console_loglevel.

asmlinkage void coprocessor_error void   ) 
 

Referenced by trap_init().

asmlinkage void coprocessor_segment_overrun void   ) 
 

Referenced by trap_init().

asmlinkage void debug void   ) 
 

asmlinkage void device_not_available void   ) 
 

Referenced by trap_init().

void die const char *  str,
struct pt_regs regs,
long  err
 

Definition at line 206 of file i386/kernel/traps.c.

static void die_if_kernel const char *  str,
struct pt_regs regs,
long  err
[inline, static]
 

Definition at line 216 of file i386/kernel/traps.c.

References die(), pt_regs::eflags, VM_MASK, and pt_regs::xcs.

Here is the call graph for this function:

static void die_if_no_fixup const char *  str,
struct pt_regs regs,
long  err
[static]
 

Definition at line 222 of file i386/kernel/traps.c.

References die(), pt_regs::eflags, pt_regs::eip, fixup, search_exception_table(), VM_MASK, and pt_regs::xcs.

Here is the call graph for this function:

asmlinkage void divide_error void   ) 
 

Referenced by trap_init().

asmlinkage void do_coprocessor_error struct pt_regs regs,
long  error_code
 

Definition at line 446 of file i386/kernel/traps.c.

References ignore_irq13, and math_error().

Here is the call graph for this function:

asmlinkage void do_debug struct pt_regs regs,
long  error_code
 

Definition at line 359 of file i386/kernel/traps.c.

References __asm__(), clear_TF(), current, DR_STATUS, DR_STEP, DR_TRAP0, DR_TRAP1, DR_TRAP2, DR_TRAP3, pt_regs::eflags, pt_regs::eip, force_sig(), handle_vm86_trap(), lock_kernel, NT_MASK, PAGE_OFFSET, PT_PTRACED, SIGTRAP, TF_MASK, unlock_kernel, VM_MASK, and pt_regs::xcs.

Here is the call graph for this function:

asmlinkage void do_general_protection struct pt_regs regs,
long  error_code
 

Definition at line 264 of file i386/kernel/traps.c.

References current, die(), pt_regs::eflags, fixup, force_sig(), handle_vm86_fault(), lock_kernel, search_exception_table(), SIGSEGV, unlock_kernel, VM_MASK, and pt_regs::xcs.

Here is the call graph for this function:

asmlinkage void do_nmi struct pt_regs regs,
long  error_code
 

Definition at line 332 of file i386/kernel/traps.c.

References atomic_inc, inb, io_check_error(), mem_parity_error(), nmi_counter, unknown_nmi_error(), x40, x61, x80, and xc0.

Here is the call graph for this function:

asmlinkage void do_spurious_interrupt_bug struct pt_regs regs,
long  error_code
 

Definition at line 452 of file i386/kernel/traps.c.

References printk.

asmlinkage void double_fault void   ) 
 

Referenced by trap_init().

asmlinkage void general_protection void   ) 
 

Referenced by trap_init().

asmlinkage void int3 void   ) 
 

Referenced by trap_init().

asmlinkage void invalid_op void   ) 
 

Referenced by trap_init().

asmlinkage void invalid_TSS void   ) 
 

Referenced by trap_init().

static void io_check_error unsigned char  reason,
struct pt_regs regs
[static]
 

Definition at line 301 of file i386/kernel/traps.c.

References i, outb, printk, show_registers(), udelay, and x61.

Referenced by do_nmi().

Here is the call graph for this function:

asmlinkage void lcall7 void   ) 
 

Referenced by trap_init().

asmlinkage void machine_check void   ) 
 

Referenced by trap_init().

asmlinkage void math_emulate long  arg  ) 
 

Definition at line 486 of file i386/kernel/traps.c.

void math_error void   ) 
 

Definition at line 431 of file i386/kernel/traps.c.

References current, force_sig(), save_fpu, SIGFPE, and task.

Referenced by do_coprocessor_error(), and math_error_irq().

Here is the call graph for this function:

asmlinkage void math_state_restore struct pt_regs  regs  ) 
 

Definition at line 468 of file i386/kernel/traps.c.

References __asm__(), and current.

Here is the call graph for this function:

static void mem_parity_error unsigned char  reason,
struct pt_regs regs
[static]
 

Definition at line 295 of file i386/kernel/traps.c.

References printk.

Referenced by do_nmi().

asmlinkage void nmi void   ) 
 

Referenced by trap_init().

asmlinkage void overflow void   ) 
 

void page_exception void   ) 
 

asmlinkage void page_fault void   ) 
 

Referenced by trap_init().

asmlinkage void segment_not_present void   ) 
 

Referenced by trap_init().

static void __init set_call_gate void *  a,
void *  addr
[static]
 

Definition at line 561 of file i386/kernel/traps.c.

References _set_gate.

Referenced by trap_init().

void set_intr_gate unsigned int  n,
void *  addr
 

Definition at line 546 of file i386/kernel/traps.c.

References _set_gate.

Referenced by init_IRQ().

void set_ldt_desc unsigned int  n,
void *  addr,
unsigned int  size
 

Definition at line 592 of file i386/kernel/traps.c.

References _set_tssldt_desc, FIRST_LDT_ENTRY, gdt_table, and x82.

Referenced by copy_segments(), trap_init(), and write_ldt().

static void __init set_system_gate unsigned int  n,
void *  addr
[static]
 

Definition at line 556 of file i386/kernel/traps.c.

References _set_gate.

Referenced by trap_init().

static void __init set_trap_gate unsigned int  n,
void *  addr
[static]
 

Definition at line 551 of file i386/kernel/traps.c.

References _set_gate.

Referenced by trap_init().

void set_tss_desc unsigned int  n,
void *  addr
 

Definition at line 587 of file i386/kernel/traps.c.

References _set_tssldt_desc, FIRST_TSS_ENTRY, gdt_table, and x89.

Referenced by copy_thread(), and trap_init().

static void show_registers struct pt_regs regs  )  [static]
 

Definition at line 123 of file i386/kernel/traps.c.

References __KERNEL_DS, _etext, _stext, addr, current, pt_regs::eax, pt_regs::ebp, pt_regs::ebx, pt_regs::ecx, pt_regs::edi, pt_regs::edx, pt_regs::eflags, pt_regs::eip, pt_regs::esi, pt_regs::esp, esp, i, kstack_depth_to_print, long, max_mapnr, MODULE_RANGE, PAGE_OFFSET, PAGE_SHIFT, printk, smp_processor_id, ss, stack, store_TR, VMALLOC_OFFSET, pt_regs::xcs, pt_regs::xds, pt_regs::xes, xffff, and pt_regs::xss.

Referenced by die(), hardware_send_packet(), io_check_error(), mpp_hw_init(), ni5010_get_stats(), and ni5010_open().

asmlinkage void spurious_interrupt_bug void   ) 
 

Referenced by trap_init().

asmlinkage void stack_segment void   ) 
 

Referenced by trap_init().

asmlinkage int system_call void   ) 
 

Referenced by trap_init().

void __init trap_init void   ) 
 

Definition at line 687 of file i386/kernel/traps.c.

References __asm__(), alignment_check(), bounds(), coprocessor_error(), coprocessor_segment_overrun(), debug, device_not_available(), divide_error(), double_fault(), EISA_bus, general_protection(), init_task, int3(), invalid_op(), invalid_TSS(), lcall7(), load_ldt, load_TR, machine_check(), nmi(), overflow, page_fault(), readl, segment_not_present(), set_call_gate(), set_ldt_desc(), set_system_gate(), set_trap_gate(), set_tss_desc(), spurious_interrupt_bug(), stack_segment(), SYSCALL_VECTOR, and system_call().

Here is the call graph for this function:

static void unknown_nmi_error unsigned char  reason,
struct pt_regs regs
[static]
 

Definition at line 317 of file i386/kernel/traps.c.

References MCA_bus, mca_handle_nmi(), and printk.

Referenced by do_nmi().

Here is the call graph for this function:


Variable Documentation

struct desc_struct default_ldt = { 0, 0 }
 

Definition at line 50 of file i386/kernel/traps.c.

spinlock_t die_lock
 

Definition at line 204 of file i386/kernel/traps.c.

int kstack_depth_to_print = 24
 

Definition at line 113 of file i386/kernel/traps.c.