root/kernel/asm.s

/* [previous][next][first][last][top][bottom][index][help] */
   1 /*
   2  *  linux/kernel/asm.s
   3  *
   4  *  (C) 1991  Linus Torvalds
   5  */
   6 
   7 /*
   8  * asm.s contains the low-level code for most hardware faults.
   9  * page_exception is handled by the mm, so that isn't here. This
  10  * file also handles (hopefully) fpu-exceptions due to TS-bit, as
  11  * the fpu must be properly saved/resored. This hasn't been tested.
  12  */
  13 
  14 .globl _divide_error,_debug,_nmi,_int3,_overflow,_bounds,_invalid_op
  15 .globl _double_fault,_coprocessor_segment_overrun
  16 .globl _invalid_TSS,_segment_not_present,_stack_segment
  17 .globl _general_protection,_coprocessor_error,_irq13,_reserved
  18 
  19 _divide_error:
  20         pushl $_do_divide_error
  21 no_error_code:
  22         xchgl %eax,(%esp)
  23         pushl %ebx
  24         pushl %ecx
  25         pushl %edx
  26         pushl %edi
  27         pushl %esi
  28         pushl %ebp
  29         push %ds
  30         push %es
  31         push %fs
  32         pushl $0                # "error code"
  33         lea 44(%esp),%edx
  34         pushl %edx
  35         movl $0x10,%edx
  36         mov %dx,%ds
  37         mov %dx,%es
  38         mov %dx,%fs
  39         call *%eax
  40         addl $8,%esp
  41         pop %fs
  42         pop %es
  43         pop %ds
  44         popl %ebp
  45         popl %esi
  46         popl %edi
  47         popl %edx
  48         popl %ecx
  49         popl %ebx
  50         popl %eax
  51         iret
  52 
  53 _debug:
  54         pushl $_do_int3         # _do_debug
  55         jmp no_error_code
  56 
  57 _nmi:
  58         pushl $_do_nmi
  59         jmp no_error_code
  60 
  61 _int3:
  62         pushl $_do_int3
  63         jmp no_error_code
  64 
  65 _overflow:
  66         pushl $_do_overflow
  67         jmp no_error_code
  68 
  69 _bounds:
  70         pushl $_do_bounds
  71         jmp no_error_code
  72 
  73 _invalid_op:
  74         pushl $_do_invalid_op
  75         jmp no_error_code
  76 
  77 _coprocessor_segment_overrun:
  78         pushl $_do_coprocessor_segment_overrun
  79         jmp no_error_code
  80 
  81 _reserved:
  82         pushl $_do_reserved
  83         jmp no_error_code
  84 
  85 _irq13:
  86         pushl %eax
  87         xorb %al,%al
  88         outb %al,$0xF0
  89         movb $0x20,%al
  90         outb %al,$0x20
  91         jmp 1f
  92 1:      jmp 1f
  93 1:      outb %al,$0xA0
  94         popl %eax
  95         jmp _coprocessor_error
  96 
  97 _double_fault:
  98         pushl $_do_double_fault
  99 error_code:
 100         xchgl %eax,4(%esp)              # error code <-> %eax
 101         xchgl %ebx,(%esp)               # &function <-> %ebx
 102         pushl %ecx
 103         pushl %edx
 104         pushl %edi
 105         pushl %esi
 106         pushl %ebp
 107         push %ds
 108         push %es
 109         push %fs
 110         pushl %eax                      # error code
 111         lea 44(%esp),%eax               # offset
 112         pushl %eax
 113         movl $0x10,%eax
 114         mov %ax,%ds
 115         mov %ax,%es
 116         mov %ax,%fs
 117         call *%ebx
 118         addl $8,%esp
 119         pop %fs
 120         pop %es
 121         pop %ds
 122         popl %ebp
 123         popl %esi
 124         popl %edi
 125         popl %edx
 126         popl %ecx
 127         popl %ebx
 128         popl %eax
 129         iret
 130 
 131 _invalid_TSS:
 132         pushl $_do_invalid_TSS
 133         jmp error_code
 134 
 135 _segment_not_present:
 136         pushl $_do_segment_not_present
 137         jmp error_code
 138 
 139 _stack_segment:
 140         pushl $_do_stack_segment
 141         jmp error_code
 142 
 143 _general_protection:
 144         pushl $_do_general_protection
 145         jmp error_code
 146 

/* [previous][next][first][last][top][bottom][index][help] */