Subversion Repositories Kolibri OS

Rev

Rev 1074 | Rev 1086 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1074 Rev 1076
Line 9... Line 9...
9
;;  Distributed under GPL. See file COPYING for details.        ;;
9
;;  Distributed under GPL. See file COPYING for details.        ;;
10
;;  Copyright 2003 Ville Turjanmaa                              ;;
10
;;  Copyright 2003 Ville Turjanmaa                              ;;
11
;;                                                              ;;
11
;;                                                              ;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 13... Line 13...
13
 
13
 
Line 14... Line 14...
14
$Revision: 1074 $
14
$Revision: 1076 $
15
 
15
 
16
 
16
 
Line 31... Line 31...
31
 
31
 
32
iglobal
32
iglobal
33
  align 4
33
  align 4
34
  sys_int:
34
  sys_int:
35
    ;exception handlers addresses (for interrupt gate construction)
35
    ;exception handlers addresses (for interrupt gate construction)
36
        dd      e0,e1,e2,e3,e4,e5,e6,except_7
36
        dd      e0,e1,e2,e3,e4,e5,e6,except_7 ; SEE: core/fpu.inc
37
        dd      e8,e9,e10,e11,e12,e13,page_fault_exc,e15
37
        dd      e8,e9,e10,e11,e12,e13,page_fault_exc,e15
38
        dd      e16, e17,e18, e19
38
        dd      e16, e17,e18, e19
Line 39... Line 39...
39
        times   12 dd unknown_interrupt ;int_20..int_31
39
        times   12 dd unknown_interrupt ;int_20..int_31
Line 51... Line 51...
51
        times   16 dd unknown_interrupt ;int_0x30..int_0x3F
51
        times   16 dd unknown_interrupt ;int_0x30..int_0x3F
Line 52... Line 52...
52
 
52
 
53
    ;int_0x40 gate trap (for directly copied)
53
    ;int_0x40 gate trap (for directly copied)
Line 54... Line 54...
54
        dw      i40 and 0xFFFF, os_code, 11101111b shl 8, i40 shr 16
54
        dw      i40 and 0xFFFF, os_code, 11101111b shl 8, i40 shr 16
55
 
55
 
56
  idtreg: ; data for LIDT instruction (must be immediately below sys_int data)
56
  idtreg: ; data for LIDT instruction (!!! must be immediately below sys_int data)
57
        dw      2*($-sys_int-4)-1
57
        dw      2*($-sys_int-4)-1
Line 58... Line 58...
58
        dd      idts ;0x8000B100
58
        dd      idts ;0x8000B100
Line 128... Line 128...
128
; redirect to V86 manager? (EFLAGS & 0x20000) != 0?
128
; redirect to V86 manager? (EFLAGS & 0x20000) != 0?
129
        test    byte[reg_eflags+2],2
129
        test    byte[reg_eflags+2],2
130
        jnz     v86_exc_c
130
        jnz     v86_exc_c
131
        cmp     bl,14           ; #PF
131
        cmp     bl,14           ; #PF
132
        jne     @f
132
        jne     @f
133
        call    page_fault_handler
133
        call    page_fault_handler ; SEE: core/memory.inc
134
  @@:   mov     esi, [current_slot]
134
  @@:   mov     esi, [current_slot]
135
        btr     [esi+APPDATA.except_mask], ebx
135
        btr     [esi+APPDATA.except_mask], ebx
136
        jnc     @f
136
        jnc     @f
137
        mov     eax,[esi+APPDATA.exc_handler]
137
        mov     eax,[esi+APPDATA.exc_handler]
138
        test    eax, eax
138
        test    eax, eax
Line 144... Line 144...
144
        sti
144
        sti
145
; not debuggee => say error and terminate
145
; not debuggee => say error and terminate
146
        call    show_error_parameters ;; only ONE using, inline ???
146
        call    show_error_parameters ;; only ONE using, inline ???
147
       ;mov     edx, [TASK_BASE]
147
       ;mov     edx, [TASK_BASE]
148
        mov     [edx + TASKDATA.state], byte 4 ; terminate
148
        mov     [edx + TASKDATA.state], byte 4 ; terminate
149
        jmp     change_task     ; stack - here it does not matter at all
149
        jmp     change_task     ; stack - here it does not matter at all, SEE: core/shed.inc
150
.debug:
150
.debug:
151
; we are debugged process, notify debugger and suspend ourself
151
; we are debugged process, notify debugger and suspend ourself
152
; eax=debugger PID
152
; eax=debugger PID
153
        cmp     bl,1            ; #DB
-
 
154
        je      debug_ex
-
 
155
        mov     edx, ebx        ; debug_message data=Number_Of_Exception
-
 
156
        mov     ecx,1           ; debug_message code=other_exception
153
        mov     ecx,1           ; debug_message code=other_exception
-
 
154
        cmp     bl,1            ; #DB
157
        jmp     debug_ex.notify ; notify debugger and suspend ourself
155
        jne     .notify         ; notify debugger and suspend ourself
-
 
156
        mov     ebx, dr6        ; debug_message data=DR6_image
-
 
157
        xor     edx, edx
-
 
158
        mov     dr6, edx
-
 
159
        mov     edx, dr7
-
 
160
        mov     cl, not 8
-
 
161
  .l1:  shl     dl,2
-
 
162
        jc      @f
-
 
163
        and     bl, cl
-
 
164
  @@:   sar     cl,1
-
 
165
        jc      .l1
-
 
166
        mov     cl, 3           ; debug_message code=debug_exception
-
 
167
.notify:
-
 
168
        push    ebx             ; debug_message data
-
 
169
        mov     ebx, [TASK_BASE]
-
 
170
        push    [ebx+TASKDATA.pid] ; PID
-
 
171
        push    ecx             ; debug_message code ((here: ecx==1/3))
-
 
172
        mov     cl, 12          ; debug_message size
-
 
173
        call    debugger_notify ;; only ONE using, inline ??? SEE: core/debug.inc
-
 
174
        add     esp,12
-
 
175
        mov     edx, [TASK_BASE]
-
 
176
        mov     byte [edx+TASKDATA.state], 1 ; suspended
-
 
177
        call    change_task     ; SEE: core/shed.inc
-
 
178
        restore_ring3_context
-
 
179
        iretd
Line 158... Line 180...
158
 
180
 
159
IRetToUserHook:
181
IRetToUserHook:
160
        xchg    eax, [reg_eip]
182
        xchg    eax, [reg_eip]
161
        sub     dword[reg_esp3], 8
183
        sub     dword[reg_esp3], 8