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 .globl _alignment_check
  19 .globl _page_fault
  20 
  21 _divide_error:
  22         pushl $0                # no error code
  23         pushl $_do_divide_error
  24 error_code:
  25         push %fs
  26         push %es
  27         push %ds
  28         pushl %eax
  29         pushl %ebp
  30         pushl %edi
  31         pushl %esi
  32         pushl %edx
  33         pushl %ecx
  34         pushl %ebx
  35         cld
  36         movl $-1, %eax
  37         xchgl %eax, 0x2c(%esp)  # orig_eax (get the error code. )
  38         xorl %ebx,%ebx          # zero ebx
  39         mov %gs,%bx             # get the lower order bits of gs
  40         xchgl %ebx, 0x28(%esp)  # get the address and save gs.
  41         pushl %eax              # push the error code
  42         lea 52(%esp),%edx
  43         pushl %edx
  44         movl $0x10,%edx
  45         mov %dx,%ds
  46         mov %dx,%es
  47         mov %dx,%fs
  48         call *%ebx
  49         addl $8,%esp
  50         popl %ebx
  51         popl %ecx
  52         popl %edx
  53         popl %esi
  54         popl %edi
  55         popl %ebp
  56         popl %eax
  57         pop %ds
  58         pop %es
  59         pop %fs
  60         pop %gs
  61         addl $4,%esp
  62         iret
  63 
  64 _debug:
  65         pushl $0
  66         pushl $_do_int3         # _do_debug
  67         jmp error_code
  68 
  69 _nmi:
  70         pushl $0
  71         pushl $_do_nmi
  72         jmp error_code
  73 
  74 _int3:
  75         pushl $0
  76         pushl $_do_int3
  77         jmp error_code
  78 
  79 _overflow:
  80         pushl $0
  81         pushl $_do_overflow
  82         jmp error_code
  83 
  84 _bounds:
  85         pushl $0
  86         pushl $_do_bounds
  87         jmp error_code
  88 
  89 _invalid_op:
  90         pushl $0
  91         pushl $_do_invalid_op
  92         jmp error_code
  93 
  94 _coprocessor_segment_overrun:
  95         pushl $0
  96         pushl $_do_coprocessor_segment_overrun
  97         jmp error_code
  98 
  99 _reserved:
 100         pushl $0
 101         pushl $_do_reserved
 102         jmp error_code
 103 
 104 _irq13:
 105         pushl %eax
 106         xorb %al,%al
 107         outb %al,$0xF0
 108         movb $0x20,%al
 109         outb %al,$0x20
 110         jmp 1f
 111 1:      jmp 1f
 112 1:      outb %al,$0xA0
 113         popl %eax
 114         jmp _coprocessor_error
 115 
 116 _double_fault:
 117         pushl $_do_double_fault
 118         jmp error_code
 119 
 120 _invalid_TSS:
 121         pushl $_do_invalid_TSS
 122         jmp error_code
 123 
 124 _segment_not_present:
 125         pushl $_do_segment_not_present
 126         jmp error_code
 127 
 128 _stack_segment:
 129         pushl $_do_stack_segment
 130         jmp error_code
 131 
 132 _general_protection:
 133         pushl $_do_general_protection
 134         jmp error_code
 135 
 136 _alignment_check:
 137         pushl $_do_alignment_check
 138         jmp error_code
 139 
 140 _page_fault:
 141         pushl $_do_page_fault
 142         jmp error_code

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