Main Page | Directories | File List | Globals

faults.c File Reference

#include <agnix/agnix.h>
#include <agnix/init.h>
#include <agnix/adi/adi.h>
#include <agnix/linkage.h>
#include <agnix/console.h>
#include <agnix/irq.h>
#include <agnix/faults.h>
#include <asm/regs.h>
#include <asm/segment.h>

Include dependency graph for faults.c:

Go to the source code of this file.

Defines

#define TRAP_BUILD(nr, routine)
#define TRAP_BUILD_ERROR(nr, routine)
#define TRAP_BUILD_NAME(name, text)

Functions

asmlinkage void TRAP_dev_not_avail (u32 error)
asmlinkage void TRAP_general_protection (u32 error)
asmlinkage void TRAP_page_fault (u32 error)
 TRAP_BUILD_NAME (divide_fault,"divide fault")
 TRAP_BUILD_NAME (debug,"debug")
 TRAP_BUILD_NAME (nmi,"nmi")
 TRAP_BUILD_NAME (int_3,"int 3")
 TRAP_BUILD_NAME (overflow,"overflow")
 TRAP_BUILD_NAME (bounds,"bounds")
 TRAP_BUILD_NAME (invalid_op,"invalid op")
 TRAP_BUILD_NAME (double_fault,"double fault")
 TRAP_BUILD_NAME (coprocessor_seg_overrun,"coprocessor segment overrun")
 TRAP_BUILD_NAME (invalid_TSS,"invalid TSS")
 TRAP_BUILD_NAME (seg_not_present,"segment not present")
 TRAP_BUILD_NAME (stack_seg,"stack segment")
 TRAP_BUILD_NAME (coprocessor_error,"coprocessor error")
 TRAP_BUILD_NAME (align_check,"alignment check")
 TRAP_BUILD_NAME (reserved,"reserved")
 TRAP_BUILD (00, TRAP_divide_fault)
 TRAP_BUILD (01, TRAP_debug)
 TRAP_BUILD_ERROR (02, TRAP_nmi)
 TRAP_BUILD (03, TRAP_int_3)
 TRAP_BUILD (04, TRAP_overflow)
 TRAP_BUILD (05, TRAP_bounds)
 TRAP_BUILD (06, TRAP_invalid_op)
 TRAP_BUILD (07, TRAP_dev_not_avail)
 TRAP_BUILD_ERROR (08, TRAP_double_fault)
 TRAP_BUILD (09, TRAP_coprocessor_seg_overrun)
 TRAP_BUILD_ERROR (10, TRAP_invalid_TSS)
 TRAP_BUILD_ERROR (11, TRAP_seg_not_present)
 TRAP_BUILD_ERROR (12, TRAP_stack_seg)
 TRAP_BUILD_ERROR (13, TRAP_general_protection)
 TRAP_BUILD_ERROR (14, TRAP_page_fault)
 TRAP_BUILD (15, TRAP_reserved)
 TRAP_BUILD (16, TRAP_coprocessor_error)
 TRAP_BUILD_ERROR (17, TRAP_align_check)
int faults_init (void)

Variables

int was_pgfault = 0


Define Documentation

#define TRAP_BUILD nr,
routine   ) 
 

Value:

asmlinkage void TRAP_##nr(void);\
    __asm__ (   \
    "\n.align 16,0x90\n"        \
    "TRAP_"#nr":\n\t"           \
    "pushl $0\n\t"              \
    REG_SAVE                    \
    "call "#routine"\n\t"       \
    REG_RESTORE                 \
    "addl $4, %esp\n\t"         \
    "iret\n\t"                  \
    );

Definition at line 24 of file faults.c.

#define TRAP_BUILD_ERROR nr,
routine   ) 
 

Value:

asmlinkage void TRAP_##nr(void);\
    __asm__ (   \
    "\n.align 16,0x90\n"        \
    "TRAP_"#nr":\n\t"           \
    REG_SAVE                    \
    "call "#routine"\n\t"       \
    REG_RESTORE                 \
    "addl $4, %esp\n\t"         \
    "iret\n\t"                  \
    );

Definition at line 37 of file faults.c.

#define TRAP_BUILD_NAME name,
text   ) 
 

Value:

asmlinkage void TRAP_##name(u32 error)  \
{                                       \
    printk(#text);                      \
    for(;;);                            \
}

Definition at line 49 of file faults.c.


Function Documentation

int faults_init void   ) 
 

Definition at line 122 of file faults.c.

References flags, set_interrupt_gate(), and set_trap_gate().

Referenced by i386_init().

00123 {
00124     u32 flags;
00125     save_flags(flags); __cli();
00126 
00127     set_trap_gate(0, __KERNEL_CS, TRAP_00, 0);
00128     set_trap_gate(1, __KERNEL_CS, TRAP_01, 0);
00129     set_interrupt_gate(2, __KERNEL_CS, TRAP_02, 0);
00130     set_interrupt_gate(3, __KERNEL_CS, TRAP_03, 0);
00131     set_interrupt_gate(4, __KERNEL_CS, TRAP_04, 0);
00132     set_interrupt_gate(5, __KERNEL_CS, TRAP_05, 0);
00133     set_trap_gate(6, __KERNEL_CS, TRAP_06, 0);
00134     set_trap_gate(7, __KERNEL_CS, TRAP_07, 0);
00135     set_trap_gate(8, __KERNEL_CS, TRAP_08, 0);
00136     set_trap_gate(9, __KERNEL_CS, TRAP_09, 0);
00137     set_trap_gate(10, __KERNEL_CS, TRAP_10, 0);
00138     set_trap_gate(11, __KERNEL_CS, TRAP_11, 0);
00139     set_trap_gate(12, __KERNEL_CS, TRAP_12, 0);
00140     set_trap_gate(13, __KERNEL_CS, TRAP_13, 0);
00141     set_interrupt_gate(14, __KERNEL_CS, TRAP_14, 0);
00142     set_trap_gate(15, __KERNEL_CS, TRAP_15, 0);
00143     set_trap_gate(16, __KERNEL_CS, TRAP_16, 0);
00144     set_trap_gate(17, __KERNEL_CS, TRAP_17, 0);
00145     
00146     restore_flags(flags);    
00147 
00148     return 0;
00149 }

Here is the call graph for this function:

TRAP_BUILD 16  ,
TRAP_coprocessor_error 
 

TRAP_BUILD 15  ,
TRAP_reserved 
 

TRAP_BUILD 09  ,
TRAP_coprocessor_seg_overrun 
 

TRAP_BUILD 07  ,
TRAP_dev_not_avail 
 

TRAP_BUILD 06  ,
TRAP_invalid_op 
 

TRAP_BUILD 05  ,
TRAP_bounds 
 

TRAP_BUILD 04  ,
TRAP_overflow 
 

TRAP_BUILD 03  ,
TRAP_int_3 
 

TRAP_BUILD 01  ,
TRAP_debug 
 

TRAP_BUILD 00  ,
TRAP_divide_fault 
 

TRAP_BUILD_ERROR 17  ,
TRAP_align_check 
 

TRAP_BUILD_ERROR 14  ,
TRAP_page_fault 
 

TRAP_BUILD_ERROR 13  ,
TRAP_general_protection 
 

TRAP_BUILD_ERROR 12  ,
TRAP_stack_seg 
 

TRAP_BUILD_ERROR 11  ,
TRAP_seg_not_present 
 

TRAP_BUILD_ERROR 10  ,
TRAP_invalid_TSS 
 

TRAP_BUILD_ERROR 08  ,
TRAP_double_fault 
 

TRAP_BUILD_ERROR 02  ,
TRAP_nmi 
 

TRAP_BUILD_NAME reserved  ,
"reserved" 
 

TRAP_BUILD_NAME align_check  ,
"alignment check" 
 

TRAP_BUILD_NAME coprocessor_error  ,
"coprocessor error" 
 

TRAP_BUILD_NAME stack_seg  ,
"stack segment" 
 

TRAP_BUILD_NAME seg_not_present  ,
"segment not present" 
 

TRAP_BUILD_NAME invalid_TSS  ,
"invalid TSS" 
 

TRAP_BUILD_NAME coprocessor_seg_overrun  ,
"coprocessor segment overrun" 
 

TRAP_BUILD_NAME double_fault  ,
"double fault" 
 

TRAP_BUILD_NAME invalid_op  ,
"invalid op" 
 

TRAP_BUILD_NAME bounds  ,
"bounds" 
 

TRAP_BUILD_NAME overflow  ,
"overflow" 
 

TRAP_BUILD_NAME int_3  ,
"int 3" 
 

TRAP_BUILD_NAME nmi  ,
"nmi" 
 

TRAP_BUILD_NAME debug  ,
"debug" 
 

TRAP_BUILD_NAME divide_fault  ,
"divide fault" 
 

asmlinkage void TRAP_dev_not_avail u32  error  ) 
 

Definition at line 58 of file faults.c.

References __asm__().

00059 {
00060 //    printk("device not available\n");
00061     __asm__ __volatile__ ("clts");
00062 }

Here is the call graph for this function:

asmlinkage void TRAP_general_protection u32  error  ) 
 

Definition at line 64 of file faults.c.

References printk().

00065 {
00066     printk("general protection %x\n", error);
00067     for(;;);
00068 }

Here is the call graph for this function:

asmlinkage void TRAP_page_fault u32  error  ) 
 

Definition at line 70 of file faults.c.

References __asm__(), printk(), and was_pgfault.

00071 {
00072     u32 cr2;
00073     
00074     __asm__ __volatile__ ("movl %%cr2, %%eax"
00075                             :"=a"(cr2)
00076                             :);
00077 
00078     if (!was_pgfault) {
00079     printk("page fault %08x %x\n", cr2, error & 0x03);
00080     for(;;);
00081     printk("cr2 == %x\n", cr2);
00082     was_pgfault = 1;
00083     }
00084     
00085 }

Here is the call graph for this function:


Variable Documentation

int was_pgfault = 0
 

Definition at line 56 of file faults.c.

Referenced by TRAP_page_fault().

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix