Subversion Repositories Kolibri OS

Rev

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

Rev 3500 Rev 3555
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: 3500 $
14
$Revision: 3555 $
15
 
15
 
16
align 4 ;3A08
16
align 4 ;3A08
17
build_interrupt_table:
17
build_interrupt_table:
Line 59... Line 59...
59
        dw      i40 and 0xFFFF, os_code, 11101111b shl 8, i40 shr 16
59
        dw      i40 and 0xFFFF, os_code, 11101111b shl 8, i40 shr 16
Line 60... Line 60...
60
 
60
 
61
  idtreg: ; data for LIDT instruction (!!! must be immediately below sys_int data)
61
  idtreg: ; data for LIDT instruction (!!! must be immediately below sys_int data)
62
        dw      2*($-sys_int-4)-1
62
        dw      2*($-sys_int-4)-1
63
        dd      idts ;0x8000B100
63
        dd      idts ;0x8000B100
Line 64... Line 64...
64
        dw      0    ;ïðîñòî âûðàâíèâàíèå
64
        dw      0    ;просто выравнивание
65
 
65
 
Line 66... Line 66...
66
  msg_fault_sel dd  msg_exc_8,msg_exc_u,msg_exc_a,msg_exc_b
66
  msg_fault_sel dd  msg_exc_8,msg_exc_u,msg_exc_a,msg_exc_b
Line 107... Line 107...
107
 
107
 
108
uglobal
108
uglobal
109
  pf_err_code   dd ?
109
  pf_err_code   dd ?
Line 110... Line 110...
110
endg
110
endg
111
 
111
 
112
page_fault_exc:                 ; äóðàêîóñòî÷èâîñòü: ñåëåêòîðû èñïîð÷åíû...
112
page_fault_exc:                 ; дуракоусточивость: селекторы испорчены...
113
        pop     [ss:pf_err_code]; äåéñòâèòåëüíî äî ñëåäóþùåãî #PF
113
        pop     [ss:pf_err_code]; действительно до следующего #PF
Line 114... Line 114...
114
        save_ring3_context
114
        save_ring3_context
115
        mov     bl, 14
115
        mov     bl, 14
116
 
116
 
117
exc_c:                          ; èñêëþ÷åíèÿ (âñå, êðîìå 7-ãî - #NM)
117
exc_c:                          ; исключения (все, кроме 7-го - #NM)
118
; Ôðýéì ñòåêà ïðè èñêëþ÷åíèè/ïðåðûâàíèè èç 3-ãî êîëüöà + pushad (ò.å., èìåííî çäåñü)
118
; Фрэйм стека при исключении/прерывании из 3-го кольца + pushad (т.е., именно здесь)
119
  reg_ss        equ esp+0x30
119
  reg_ss        equ esp+0x30
120
  reg_esp3      equ esp+0x2C
120
  reg_esp3      equ esp+0x2C
121
  reg_eflags    equ esp+0x28
121
  reg_eflags    equ esp+0x28
122
  reg_cs3       equ esp+0x24
122
  reg_cs3       equ esp+0x24
123
  reg_eip       equ esp+0x20
123
  reg_eip       equ esp+0x20
124
 ; ýòî ôðýéì îò pushad
124
 ; это фрэйм от pushad
125
  reg_eax       equ esp+0x1C
125
  reg_eax       equ esp+0x1C
126
  reg_ecx       equ esp+0x18
126
  reg_ecx       equ esp+0x18
127
  reg_edx       equ esp+0x14
127
  reg_edx       equ esp+0x14
128
  reg_ebx       equ esp+0x10
128
  reg_ebx       equ esp+0x10
129
  reg_esp0      equ esp+0x0C
129
  reg_esp0      equ esp+0x0C
Line 130... Line 130...
130
  reg_ebp       equ esp+0x08
130
  reg_ebp       equ esp+0x08
131
  reg_esi       equ esp+0x04
131
  reg_esi       equ esp+0x04
132
  reg_edi       equ esp+0x00
132
  reg_edi       equ esp+0x00
133
 
133
 
134
        mov     ax, app_data        ;èñêëþ÷åíèå
134
        mov     ax, app_data        ;исключение
135
        mov     ds, ax                  ;çàãðóçèì ïðàâèëüíûå çíà÷åíèÿ
135
        mov     ds, ax                  ;загрузим правильные значения
136
        mov     es, ax                  ;â ðåãèñòðû
136
        mov     es, ax                  ;в регистры
137
        cld                     ; è ïðèâîäèì DF ê ñòàíäàðòó
137
        cld                     ; и приводим DF к стандарту
138
        movzx   ebx, bl
138
        movzx   ebx, bl
Line 157... Line 157...
157
        sti
157
        sti
158
; not debuggee => say error and terminate
158
; not debuggee => say error and terminate
159
        call    show_error_parameters ;; only ONE using, inline ???
159
        call    show_error_parameters ;; only ONE using, inline ???
160
       ;mov     edx, [TASK_BASE]
160
       ;mov     edx, [TASK_BASE]
161
        mov     [edx + TASKDATA.state], byte 4 ; terminate
161
        mov     [edx + TASKDATA.state], byte 4 ; terminate
-
 
162
        call    wakeup_osloop
162
        jmp     change_task     ; stack - here it does not matter at all, SEE: core/shed.inc
163
        jmp     change_task     ; stack - here it does not matter at all, SEE: core/shed.inc
163
.debug:
164
.debug:
164
; we are debugged process, notify debugger and suspend ourself
165
; we are debugged process, notify debugger and suspend ourself
165
; eax=debugger PID
166
; eax=debugger PID
166
        mov     ecx, 1          ; debug_message code=other_exception
167
        mov     ecx, 1          ; debug_message code=other_exception
Line 259... Line 260...
259
  restore  reg_esi
260
  restore  reg_esi
260
  restore  reg_edi
261
  restore  reg_edi
Line 261... Line 262...
261
 
262
 
262
 
263
 
263
align 4
264
align 4
-
 
265
lock_application_table:
-
 
266
        push    eax ecx edx
Line 264... Line 267...
264
set_application_table_status:
267
        mov     ecx, application_table_mutex
265
        push    eax
268
        call    mutex_lock
266
 
269
 
267
        mov     eax, [CURRENT_TASK]
270
        mov     eax, [CURRENT_TASK]
Line 268... Line 271...
268
        shl     eax, 5
271
        shl     eax, 5
Line 269... Line 272...
269
        add     eax, CURRENT_TASK+TASKDATA.pid
272
        add     eax, CURRENT_TASK+TASKDATA.pid
Line 270... Line 273...
270
        mov     eax, [eax]
273
        mov     eax, [eax]
Line 271... Line 274...
271
 
274
 
272
        mov     [application_table_status], eax
275
        mov     [application_table_owner], eax
273
 
276
 
Line 274... Line 277...
274
        pop     eax
277
        pop     edx ecx eax
275
 
-
 
276
        ret
-
 
277
 
-
 
278
align 4
-
 
279
clear_application_table_status:
278
 
280
        push    eax
-
 
281
 
279
        ret
282
        mov     eax, [CURRENT_TASK]
-
 
283
        shl     eax, 5
-
 
Line 284... Line 280...
284
        add     eax, CURRENT_TASK+TASKDATA.pid
280
 
Line 285... Line 281...
285
        mov     eax, [eax]
281
align 4
Line 286... Line 282...
286
 
282
unlock_application_table:
287
        cmp     eax, [application_table_status]
283
        push    eax ecx edx
288
        jne     apptsl1
284
 
289
        xor     eax, eax
285
        mov     [application_table_owner], 0
290
        mov     [application_table_status], eax
286
        mov     ecx, application_table_mutex
291
      apptsl1:
287
        call    mutex_unlock
Line 292... Line 288...
292
 
288
 
293
        pop     eax
289
        pop     edx ecx eax
294
 
290
 
295
        ret
291
        ret
Line 336... Line 332...
336
        pop     esi
332
        pop     esi
337
        shl     esi, 5
333
        shl     esi, 5
338
        mov     [CURRENT_TASK+esi+TASKDATA.state], 9
334
        mov     [CURRENT_TASK+esi+TASKDATA.state], 9
339
        ret
335
        ret
340
@@:
336
@@:
-
 
337
        lea     edx, [SLOT_BASE+esi]
-
 
338
        call    scheduler_remove_thread
341
           ;mov    esi,process_terminating
339
           ;mov    esi,process_terminating
342
           ;call   sys_msg_board_str
340
           ;call   sys_msg_board_str
343
@@:
-
 
344
        cli
-
 
345
        cmp     [application_table_status], 0
-
 
346
        je      term9
-
 
347
        sti
-
 
348
        call    change_task
-
 
349
        jmp     @b
-
 
350
term9:
-
 
351
        call    set_application_table_status
341
        call    lock_application_table
Line 352... Line 342...
352
 
342
 
353
; if the process is in V86 mode...
343
; if the process is in V86 mode...
354
        mov     eax, [.slot]
344
        mov     eax, [.slot]
355
        shl     eax, 8
345
        shl     eax, 8
Line 389... Line 379...
389
        mov     eax, [.slot]
379
        mov     eax, [.slot]
390
        shl     eax, 8
380
        shl     eax, 8
391
        stdcall destroy_app_space, [SLOT_BASE+eax+APPDATA.dir_table], [SLOT_BASE+eax+APPDATA.dlls_list_ptr]
381
        stdcall destroy_app_space, [SLOT_BASE+eax+APPDATA.dir_table], [SLOT_BASE+eax+APPDATA.dlls_list_ptr]
Line 392... Line 382...
392
 
382
 
393
        mov     esi, [.slot]
383
        mov     esi, [.slot]
394
        cmp     [fpu_owner], esi ; if user fpu last -> fpu user = 1
384
        cmp     [fpu_owner], esi ; if user fpu last -> fpu user = 2
Line 395... Line 385...
395
        jne     @F
385
        jne     @F
396
 
386
 
397
        mov     [fpu_owner], 1
387
        mov     [fpu_owner], 2
398
        mov     eax, [256+SLOT_BASE+APPDATA.fpu_state]
388
        mov     eax, [256*2+SLOT_BASE+APPDATA.fpu_state]
399
        clts
389
        clts
400
        bt      [cpu_caps], CAPS_SSE
390
        bt      [cpu_caps], CAPS_SSE
401
        jnc     .no_SSE
391
        jnc     .no_SSE
Line 683... Line 673...
683
        call    calculatescreen
673
        call    calculatescreen
684
        xor     eax, eax
674
        xor     eax, eax
685
        xor     esi, esi
675
        xor     esi, esi
686
        call    redrawscreen
676
        call    redrawscreen
Line 687... Line -...
687
 
-
 
688
        mov     [MOUSE_BACKGROUND], byte 0; no mouse background
-
 
689
        mov     [DONT_DRAW_MOUSE], byte 0; draw mouse
-
 
690
 
677
 
691
        and     [application_table_status], 0
678
        call    unlock_application_table
692
    ;mov   esi,process_terminated
679
    ;mov   esi,process_terminated
693
    ;call  sys_msg_board_str
680
    ;call  sys_msg_board_str
694
        add     esp, 4
681
        add     esp, 4
695
        ret
682
        ret
Line 696... Line -...
696
restore .slot
-
 
697
 
-
 
698
;iglobal
-
 
699
;if lang eq ru
-
 
700
;  boot_sched_1    db   '‘®§¤ ­¨¥ GDT TSS 㪠§ â¥«ï',0
-
 
701
;  boot_sched_2    db   '‘®§¤ ­¨¥ IDT â ¡«¨æë',0
-
 
702
;else
-
 
703
;  boot_sched_1    db   'Building gdt tss pointer',0
-
 
704
;  boot_sched_2    db   'Building IDT table',0
-
 
705
;end if
-
 
706
;endg
-
 
707
 
683
restore .slot
708
 
684
 
709
;build_scheduler:
685
;build_scheduler:
710
;        mov     esi, boot_sched_1
686
;        mov     esi, boot_sched_1