Subversion Repositories Kolibri OS

Rev

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

Rev 3232 Rev 3500
Line 64... Line 64...
64
;; Among other things, the copyright notice and this notice must be preserved
64
;; Among other things, the copyright notice and this notice must be preserved
65
;; on all copies.
65
;; on all copies.
66
;;
66
;;
67
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
67
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line -... Line 68...
-
 
68
 
-
 
69
format binary as "mnt"
68
 
70
 
69
include 'macros.inc'
71
include 'macros.inc'
Line 70... Line 72...
70
include 'struct.inc'
72
include 'struct.inc'
Line 71... Line 73...
71
 
73
 
Line 72... Line 74...
72
$Revision: 3232 $
74
$Revision: 3500 $
Line 129... Line 131...
129
 
131
 
130
use16
132
use16
131
                  org   0x0
133
                  org   0x0
Line -... Line 134...
-
 
134
        jmp     start_of_code
-
 
135
 
-
 
136
if lang eq sp
132
        jmp     start_of_code
137
include "kernelsp.inc"  ; spanish kernel messages
-
 
138
else
Line 133... Line 139...
133
 
139
version db    'Kolibri OS  version 0.7.7.0+     ',13,10,13,10,0
134
version db    'Kolibri OS  version 0.7.7.0+     ',13,10,13,10,0
140
end if
Line 135... Line 141...
135
 
141
 
-
 
142
include "boot/bootstr.inc"     ; language-independent boot messages
-
 
143
include "boot/preboot.inc"
136
include "boot/bootstr.inc"     ; language-independent boot messages
144
 
137
include "boot/preboot.inc"
145
if lang eq ge
138
 
146
include "boot/bootge.inc"     ; german system boot messages
139
if lang eq en
147
else if lang eq sp
140
include "boot/booteng.inc"     ; english system boot messages
148
include "boot/bootsp.inc"     ; spanish system boot messages
141
else if lang eq ru
149
else if lang eq ru
142
include "boot/bootru.inc"      ; russian system boot messages
150
include "boot/bootru.inc"      ; russian system boot messages
143
include "boot/ru.inc"          ; Russian font
151
include "boot/ru.inc"          ; Russian font
144
else if lang eq et
152
else if lang eq et
145
include "boot/bootet.inc"      ; estonian system boot messages
153
include "boot/bootet.inc"      ; estonian system boot messages
Line 146... Line 154...
146
include "boot/et.inc"          ; Estonian font
154
include "boot/et.inc"          ; Estonian font
147
else
155
else
148
include "boot/bootge.inc"      ; german system boot messages
156
include "boot/booten.inc"      ; english system boot messages
Line 159... Line 167...
159
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
167
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 160... Line 168...
160
 
168
 
Line 161... Line -...
161
 
-
 
162
; CR0 Flags - Protected mode and Paging
-
 
163
 
169
 
Line 164... Line 170...
164
align 16
170
; CR0 Flags - Protected mode and Paging
Line 165... Line 171...
165
 
171
 
Line 198... Line 204...
198
        or      eax, ecx
204
        or      eax, ecx
199
        and     eax, 10011111b *65536*256 + 0xffffff ; caching enabled
205
        and     eax, 10011111b *65536*256 + 0xffffff ; caching enabled
200
        mov     cr0, eax
206
        mov     cr0, eax
201
        jmp     pword os_code:B32       ; jmp to enable 32 bit mode
207
        jmp     pword os_code:B32       ; jmp to enable 32 bit mode
Line 202... Line -...
202
 
-
 
203
include "boot/shutdown.inc" ; shutdown or restart
-
 
204
 
-
 
205
include "data16.inc"
-
 
206
 
-
 
207
align 4096
-
 
208
__ap_start_16:
-
 
209
        cli
-
 
210
        lgdt    [cs:(tmp_gdt-__ap_start_16)]            ; Load GDT
-
 
211
        mov     eax, cr0                                ; protected mode
-
 
212
        or      eax, CR0_PE
-
 
213
        and     eax, 10011111b *65536*256 + 0xffffff    ; caching enabled
-
 
214
        mov     cr0, eax
-
 
215
        jmp     pword os_code:__ap_start_32             ; jmp to enable 32 bit mode
-
 
216
 
208
 
217
align 8
209
align 8
Line 218... Line 210...
218
tmp_gdt:
210
tmp_gdt:
219
 
211
 
Line 231... Line 223...
231
        dw     0x0000
223
        dw     0x0000
232
        db     0x00
224
        db     0x00
233
        dw     11011111b *256 +10010010b
225
        dw     11011111b *256 +10010010b
234
        db     0x00
226
        db     0x00
Line -... Line 227...
-
 
227
 
Line 235... Line 228...
235
 
228
include "data16.inc"
236
 
229
 
Line 237... Line -...
237
use32
-
 
238
org $+0x10000
-
 
239
 
-
 
240
align 16
-
 
241
__ap_start_32:
-
 
242
        mov     ax, os_stack       ; Selector for os
-
 
243
        mov     ds, ax
-
 
244
        mov     es, ax
-
 
245
        mov     fs, ax
-
 
246
        mov     gs, ax
-
 
247
        mov     ss, ax
-
 
248
 
-
 
249
        bt      [cpu_caps-OS_BASE], CAPS_PSE
-
 
250
        jnc     .no_PSE
-
 
251
 
-
 
252
        mov     ebx, cr4
-
 
253
        or      ebx, CR4_PSE
-
 
254
        mov     eax, PG_LARGE+PG_SW
-
 
255
        mov     cr4, ebx
-
 
256
.no_PSE:
-
 
257
        mov     eax, sys_pgdir-OS_BASE
-
 
258
        mov     cr3, eax
-
 
259
 
-
 
260
        mov     eax, cr0
-
 
261
        or      eax, CR0_PG+CR0_WP
-
 
262
        mov     cr0, eax
-
 
263
 
-
 
264
        lgdt    [gdts]
230
use32
265
        jmp     pword os_code:ap_entry
231
org $+0x10000
266
 
232
 
267
align 4
233
align 4
268
B32:
234
B32:
Line 323... Line 289...
323
 
289
 
324
align 4
290
align 4
325
bios32_entry    dd ?
291
bios32_entry    dd ?
Line -... Line 292...
-
 
292
tmp_page_tabs   dd ?
-
 
293
 
-
 
294
use16
-
 
295
org $-0x10000
-
 
296
include "boot/shutdown.inc" ; shutdown or restart
Line 326... Line 297...
326
tmp_page_tabs   dd ?
297
org $+0x10000
327
 
298
use32
328
 
299
 
Line 329... Line 300...
329
__DEBUG__       fix 1
300
__DEBUG__       fix 1
Line 330... Line 301...
330
__DEBUG_LEVEL__ fix 1
301
__DEBUG_LEVEL__ fix 1
Line 331... Line -...
331
include 'init.inc'
-
 
332
 
-
 
333
org OS_BASE+$
-
 
334
 
-
 
335
include 'fdo.inc'
-
 
336
 
-
 
337
ap_entry:
-
 
338
        bt      [cpu_caps], CAPS_PGE
-
 
339
        jnc     @F
-
 
340
 
-
 
341
        mov     ebx, cr4
-
 
342
        or      ebx, CR4_PGE
-
 
343
        mov     cr4, ebx
-
 
344
@@:
-
 
345
        mov     esi, [LAPIC_BASE]
-
 
346
        xor     ebp, ebp
-
 
347
.1:
-
 
348
        mov ebx, [esi+0x20]               ;apic_id
-
 
349
        shr ebx, 24
-
 
350
        shl ebx, 6+2
-
 
351
        add ebx, LFB_BASE
-
 
352
        mov edx, 32
-
 
353
.2:
-
 
354
        mov ecx, 32
-
 
355
        mov edi, ebx
-
 
356
        mov eax, [_display.width]
-
 
357
        lea ebx, [ebx+eax*4]
-
 
358
        mov eax, ebp
-
 
359
        rep stosd
-
 
360
        dec edx
-
 
361
        jnz .2
-
 
362
        dec ebp
302
include 'init.inc'
363
        jmp .1
303
 
364
 
304
org OS_BASE+$
365
        hlt
305
 
366
        jmp ap_entry
306
include 'fdo.inc'
Line 385... Line 325...
385
 
325
 
386
        mov     ebx, cr4
326
        mov     ebx, cr4
387
        or      ebx, CR4_PGE
327
        or      ebx, CR4_PGE
388
        mov     cr4, ebx
328
        mov     cr4, ebx
389
@@:
329
@@:
390
;        xor     eax, eax
330
        xor     eax, eax
391
;        mov     dword [sys_pgdir], eax
331
        mov     dword [sys_pgdir], eax
Line 392... Line 332...
392
;        mov     dword [sys_pgdir+4], eax
332
        mov     dword [sys_pgdir+4], eax
393
 
333
 
Line 394... Line 334...
394
;        mov     eax, cr3
334
        mov     eax, cr3
395
;        mov     cr3, eax          ; flush TLB
335
        mov     cr3, eax          ; flush TLB
Line 396... Line 336...
396
 
336
 
Line 672... Line 612...
672
        mov     [BgrDataWidth], eax
612
        mov     [BgrDataWidth], eax
673
        mov     [BgrDataHeight], eax
613
        mov     [BgrDataHeight], eax
674
        mov     [mem_BACKGROUND], 4
614
        mov     [mem_BACKGROUND], 4
675
        mov     [img_background], static_background_data
615
        mov     [img_background], static_background_data
Line -... Line 616...
-
 
616
 
-
 
617
; SET UP OS TASK
-
 
618
 
-
 
619
        mov     esi, boot_setostask
-
 
620
        call    boot_log
-
 
621
 
-
 
622
        xor     eax, eax
-
 
623
        mov     dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
-
 
624
        mov     dword [SLOT_BASE+APPDATA.exc_handler], eax
-
 
625
        mov     dword [SLOT_BASE+APPDATA.except_mask], eax
-
 
626
 
-
 
627
        ; name for OS/IDLE process
-
 
628
 
-
 
629
        mov     dword [SLOT_BASE+256+APPDATA.app_name], dword 'OS/I'
-
 
630
        mov     dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
-
 
631
        mov     edi, [os_stack_seg]
-
 
632
        mov     dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
-
 
633
        add     edi, 0x2000-512
-
 
634
        mov     dword [SLOT_BASE+256+APPDATA.fpu_state], edi
-
 
635
        mov     dword [SLOT_BASE+256+APPDATA.saved_esp0], edi; just for case
-
 
636
        mov     dword [SLOT_BASE+256+APPDATA.terminate_protection], 80000001h
-
 
637
 
-
 
638
        mov     esi, fpu_data
-
 
639
        mov     ecx, 512/4
-
 
640
        cld
-
 
641
        rep movsd
-
 
642
 
-
 
643
        mov     dword [SLOT_BASE+256+APPDATA.exc_handler], eax
-
 
644
        mov     dword [SLOT_BASE+256+APPDATA.except_mask], eax
-
 
645
 
-
 
646
        mov     ebx, SLOT_BASE+256+APP_OBJ_OFFSET
-
 
647
        mov     dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
-
 
648
        mov     dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
-
 
649
 
-
 
650
        mov     dword [SLOT_BASE+256+APPDATA.cur_dir], sysdir_path
-
 
651
        mov     dword [SLOT_BASE+256+APPDATA.tls_base], eax
-
 
652
 
-
 
653
        ; task list
-
 
654
        mov     dword [TASK_DATA+TASKDATA.mem_start], eax; process base address
-
 
655
        inc     eax
-
 
656
        mov     dword [CURRENT_TASK], eax
-
 
657
        mov     dword [TASK_COUNT], eax
-
 
658
        mov     [current_slot], SLOT_BASE+256
-
 
659
        mov     [TASK_BASE], dword TASK_DATA
-
 
660
        mov     byte[TASK_DATA+TASKDATA.wnd_number], al ; on screen number
-
 
661
        mov     dword [TASK_DATA+TASKDATA.pid], eax     ; process id number
676
 
662
 
Line 677... Line 663...
677
        mov     [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
663
        mov     [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
678
 
664
 
679
        stdcall kernel_alloc, 0x10000/8
665
        stdcall kernel_alloc, 0x10000/8
Line 705... Line 691...
705
        mov     esi, boot_initapic
691
        mov     esi, boot_initapic
706
        call    boot_log
692
        call    boot_log
707
; Try to Initialize APIC
693
; Try to Initialize APIC
708
        call    APIC_init
694
        call    APIC_init
Line 709... Line -...
709
 
-
 
710
        call    LAPIC_init
-
 
711
 
695
 
712
;        mov     eax, 1
696
        mov     esi, boot_enableirq
713
;        call    start_ap
-
 
714
 
697
        call    boot_log
715
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
698
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
716
; they are used: when partitions are scanned, hd_read relies on timer
699
; they are used: when partitions are scanned, hd_read relies on timer
717
        call    unmask_timer
700
        call    unmask_timer
718
        stdcall enable_irq, 2               ; @#$%! PIC
701
        stdcall enable_irq, 2               ; @#$%! PIC
Line 792... Line 775...
792
        call    boot_log
775
        call    boot_log
Line 793... Line 776...
793
 
776
 
794
        movzx   ecx, word [boot_y]
777
        movzx   ecx, word [boot_y]
795
        if lang eq ru
778
        if lang eq ru
-
 
779
        or      ecx, (10+30*6) shl 16
-
 
780
        else if lang eq sp
796
        or      ecx, (10+30*6) shl 16
781
        or      ecx, (10+33*6) shl 16
797
                else
782
                else
798
        or      ecx, (10+29*6) shl 16
783
        or      ecx, (10+29*6) shl 16
799
                end if
784
                end if
800
        sub     ecx, 10
785
        sub     ecx, 10
Line 812... Line 797...
812
 
797
 
813
;        mov     esi, boot_devices
798
;        mov     esi, boot_devices
Line 814... Line 799...
814
;        call    boot_log
799
;        call    boot_log
815
 
-
 
-
 
800
 
Line 816... Line 801...
816
        mov     [pci_access_enabled], 1
801
        mov     [pci_access_enabled], 1
Line 817... Line 802...
817
 
802
        call    pci_enum
818
 
803
 
Line 833... Line 818...
833
 
818
 
834
        mov     esi, boot_resirqports
819
        mov     esi, boot_resirqports
835
        call    boot_log
820
        call    boot_log
Line 836... Line -...
836
        call    reserve_irqs_ports
-
 
837
 
-
 
838
; SET UP OS TASK
-
 
839
 
-
 
840
        mov     esi, boot_setostask
-
 
841
        call    boot_log
-
 
842
 
-
 
843
        xor     eax, eax
-
 
844
        mov     dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
-
 
845
        mov     dword [SLOT_BASE+APPDATA.exc_handler], eax
-
 
846
        mov     dword [SLOT_BASE+APPDATA.except_mask], eax
-
 
847
 
-
 
848
        ; name for OS/IDLE process
-
 
849
 
-
 
850
        mov     dword [SLOT_BASE+256+APPDATA.app_name], dword 'OS/I'
-
 
851
        mov     dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
-
 
852
        mov     edi, [os_stack_seg]
-
 
853
        mov     dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
-
 
854
        add     edi, 0x2000-512
-
 
855
        mov     dword [SLOT_BASE+256+APPDATA.fpu_state], edi
-
 
856
        mov     dword [SLOT_BASE+256+APPDATA.saved_esp0], edi; just for case
-
 
857
        ; [SLOT_BASE+256+APPDATA.io_map] was set earlier
-
 
858
 
-
 
859
        mov     esi, fpu_data
-
 
860
        mov     ecx, 512/4
-
 
861
        cld
-
 
862
        rep movsd
-
 
863
 
-
 
864
        mov     dword [SLOT_BASE+256+APPDATA.exc_handler], eax
-
 
865
        mov     dword [SLOT_BASE+256+APPDATA.except_mask], eax
-
 
866
 
-
 
867
        mov     ebx, SLOT_BASE+256+APP_OBJ_OFFSET
-
 
868
        mov     dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
-
 
869
        mov     dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
-
 
870
 
-
 
871
        mov     dword [SLOT_BASE+256+APPDATA.cur_dir], sysdir_path
-
 
872
        mov     dword [SLOT_BASE+256+APPDATA.tls_base], eax
-
 
873
 
-
 
874
        ; task list
-
 
875
        mov     dword [TASK_DATA+TASKDATA.mem_start], eax; process base address
-
 
876
        inc     eax
-
 
877
        mov     dword [CURRENT_TASK], eax
-
 
878
        mov     dword [TASK_COUNT], eax
-
 
879
        mov     [current_slot], SLOT_BASE+256
-
 
880
        mov     [TASK_BASE], dword TASK_DATA
-
 
881
        mov     byte[TASK_DATA+TASKDATA.wnd_number], al ; on screen number
-
 
882
        mov     dword [TASK_DATA+TASKDATA.pid], eax     ; process id number
821
        call    reserve_irqs_ports
883
 
822
 
884
        call    init_display
823
        call    init_display
885
        mov     eax, [def_cursor]
824
        mov     eax, [def_cursor]
Line 896... Line 835...
896
        mov     esi, 250            ; wait 1/4 a second
835
        mov     esi, 250            ; wait 1/4 a second
897
        call    delay_ms
836
        call    delay_ms
898
        rdtsc   ;call  _rdtsc
837
        rdtsc   ;call  _rdtsc
899
        sti
838
        sti
900
        sub     eax, ecx
839
        sub     eax, ecx
-
 
840
        xor     edx, edx
-
 
841
        shld    edx, eax, 2
901
        shl     eax, 2
842
        shl     eax, 2
902
        mov     [CPU_FREQ], eax       ; save tsc / sec
-
 
903
;       mov ebx, 1000000
-
 
904
;       div ebx
-
 
905
; ¢®®¡é¥-â® ¯à®¨§¢®¤¨â¥«ì­®áâì ¢ ¤ ­­®¬ ª®­ªà¥â­®¬ ¬¥áâ¥
-
 
906
; ᮢ¥à襭­® ­¥ªà¨â¨ç­ , ­® çâ®¡ë § âª­ãâì «î¡¨â¥«¥©
-
 
907
; ®¯â¨¬¨§¨àãîé¨å ª®¬¯¨«ïâ®à®¢ Ÿ‚“...
-
 
908
        mov     edx, 2251799814
843
        mov     dword [cpu_freq], eax
909
        mul     edx
-
 
910
        shr     edx, 19
-
 
911
        mov     [stall_mcs], edx
844
        mov     dword [cpu_freq+4], edx
912
; PRINT CPU FREQUENCY
845
; PRINT CPU FREQUENCY
913
        mov     esi, boot_cpufreq
846
        mov     esi, boot_cpufreq
914
        call    boot_log
847
        call    boot_log
Line 915... Line 848...
915
 
848
 
916
        mov     ebx, edx
849
        mov     ebx, edx
917
        movzx   ecx, word [boot_y]
850
        movzx   ecx, word [boot_y]
918
        if lang eq ru
851
        if lang eq ru
-
 
852
        add     ecx, (10+19*6) shl 16 - 10         ; 'Determining amount of memory'
-
 
853
        else if lang eq sp
919
        add     ecx, (10+19*6) shl 16 - 10         ; 'Determining amount of memory'
854
        add     ecx, (10+25*6) shl 16 - 10         ; 'Determining amount of memory'
920
                else
855
                else
921
        add     ecx, (10+17*6) shl 16 - 10         ; 'Determining amount of memory'
856
        add     ecx, (10+17*6) shl 16 - 10         ; 'Determining amount of memory'
922
                end if
857
                end if
923
        mov     edx, 0xFFFFFF
858
        mov     edx, 0xFFFFFF
Line 990... Line 925...
990
 
925
 
991
        mov     ebp, firstapp
926
        mov     ebp, firstapp
Line 992... Line 927...
992
        call    fs_execute_from_sysdir
927
        call    fs_execute_from_sysdir
993
 
928
 
994
;        cmp   eax,2                  ; continue if a process has been loaded
929
;        cmp   eax,2                  ; continue if a process has been loaded
Line 995... Line 930...
995
        sub     eax, 2
930
        test    eax, eax
996
        jz      first_app_found
931
        jns     first_app_found
Line 997... Line 932...
997
 
932
 
Line 1097... Line 1032...
1097
        mov     al, 0x7 + 1 shl 5
1032
        mov     al, 0x7 + 1 shl 5
1098
        out     dx, al
1033
        out     dx, al
Line 1099... Line 1034...
1099
 
1034
 
-
 
1035
 
-
 
1036
end if
Line 1100... Line 1037...
1100
 
1037
        mov     eax, [version_inf.rev]
1101
end if
1038
        DEBUGF  1, "K : kernel SVN r%d\n", eax
1102
 
1039
 
1103
        mov     eax, [cpu_count]
1040
        mov     eax, [cpu_count]
1104
        test    eax, eax
1041
        test    eax, eax
1105
        jnz     @F
1042
        jnz     @F
Line 1106... Line 1043...
1106
        mov     al, 1                             ; at least one CPU
1043
        mov     al, 1                             ; at least one CPU
Line 1107... Line 1044...
1107
@@:
1044
@@:
Line 1108... Line 1045...
1108
        DEBUGF  1, "K : %d CPU detected\n", eax
1045
        DEBUGF  1, "K : %d CPU detected\n", eax
1109
 
1046
 
Line 1238... Line 1175...
1238
 
1175
 
Line 1239... Line 1176...
1239
        mov     [eax], dword 4
1176
        mov     [eax], dword 4
1240
 
1177
 
1241
        mov     [eax+16], ecx
1178
        mov     [eax+16], ecx
Line 1242... Line 1179...
1242
        mov     [eax+16+4], dword 0
1179
        mov     [eax+16+4], dword 0
1243
        mov     [eax+16+4], dword 0x2D
1180
        mov     [eax+16+8], dword 0x2D
1244
 
1181
 
Line 1245... Line 1182...
1245
        mov     [eax+32], ecx
1182
        mov     [eax+32], ecx
1246
        mov     [eax+32+4], dword 0x30
1183
        mov     [eax+32+4], dword 0x30
1247
        mov     [eax+32+8], dword 0x4D
1184
        mov     [eax+32+8], dword 0x4D
Line 1248... Line 1185...
1248
 
1185
 
1249
        mov     [eax+48], ecx
1186
        mov     [eax+48], ecx
1250
        mov     [eax+48+4], dword 0x50
1187
        mov     [eax+48+4], dword 0x50
Line 2097... Line 2034...
2097
        call    [_display.select_cursor]
2034
        call    [_display.select_cursor]
2098
        mov     [current_cursor], esi
2035
        mov     [current_cursor], esi
2099
@@:
2036
@@:
2100
        mov     [redrawmouse_unconditional], 1
2037
        mov     [redrawmouse_unconditional], 1
2101
        popfd
2038
        popfd
2102
;        call    [draw_pointer]
-
 
2103
        call    __sys_draw_pointer
-
 
2104
        ret
2039
        ret
2105
;------------------------------------------------------------------------------
2040
;------------------------------------------------------------------------------
2106
iglobal
2041
iglobal
2107
align 4
2042
align 4
2108
sys_system_table:
2043
sys_system_table:
Line 2171... Line 2106...
2171
        shl     ecx, 5
2106
        shl     ecx, 5
2172
        mov     edx, [ecx+CURRENT_TASK+TASKDATA.pid]
2107
        mov     edx, [ecx+CURRENT_TASK+TASKDATA.pid]
2173
        add     ecx, CURRENT_TASK+TASKDATA.state
2108
        add     ecx, CURRENT_TASK+TASKDATA.state
2174
        cmp     byte [ecx], 9
2109
        cmp     byte [ecx], 9
2175
        jz      noprocessterminate
2110
        jz      noprocessterminate
-
 
2111
        push    ecx edx
-
 
2112
        lea     edx, [(ecx-(CURRENT_TASK and 1FFFFFFFh)-TASKDATA.state)*8+SLOT_BASE]
-
 
2113
        call    request_terminate
-
 
2114
        pop     edx ecx
-
 
2115
        test    eax, eax
-
 
2116
        jz      noprocessterminate
2176
;--------------------------------------
2117
;--------------------------------------
2177
        cmp     [_display.select_cursor], 0
2118
        cmp     [_display.select_cursor], 0
2178
        je      .restore_end
2119
        je      .restore_end
2179
; restore default cursor before killing
2120
; restore default cursor before killing
2180
        pusha
2121
        pusha
Line 2258... Line 2199...
2258
sysfn_activate:         ; 18.3 = ACTIVATE WINDOW
2199
sysfn_activate:         ; 18.3 = ACTIVATE WINDOW
2259
        cmp     ecx, 2
2200
        cmp     ecx, 2
2260
        jb      .nowindowactivate
2201
        jb      .nowindowactivate
2261
        cmp     ecx, [TASK_COUNT]
2202
        cmp     ecx, [TASK_COUNT]
2262
        ja      .nowindowactivate
2203
        ja      .nowindowactivate
-
 
2204
;-------------------------------------
2263
 
2205
@@:
-
 
2206
; If the window is captured and moved by the user,
-
 
2207
; then you can't change the position in window stack!!!
-
 
2208
        mov     al, [mouse.active_sys_window.action]
-
 
2209
        and     al, WINDOW_MOVE_AND_RESIZE_FLAGS
-
 
2210
        test    al, al
-
 
2211
        jz      @f
-
 
2212
        call    change_task
-
 
2213
        jmp     @b
-
 
2214
@@:
-
 
2215
;-------------------------------------
2264
        mov     [window_minimize], 2; restore window if minimized
2216
        mov     [window_minimize], 2; restore window if minimized
Line 2265... Line 2217...
2265
 
2217
 
2266
        movzx   esi, word [WIN_STACK + ecx*2]
2218
        movzx   esi, word [WIN_STACK + ecx*2]
2267
        cmp     esi, [TASK_COUNT]
2219
        cmp     esi, [TASK_COUNT]
Line 2280... Line 2232...
2280
        mov     eax, [idleusesec]
2232
        mov     eax, [idleusesec]
2281
        mov     [esp+32], eax
2233
        mov     [esp+32], eax
2282
        ret
2234
        ret
2283
;------------------------------------------------------------------------------
2235
;------------------------------------------------------------------------------
2284
sysfn_getcpuclock:              ; 18.5 = GET TSC/SEC
2236
sysfn_getcpuclock:              ; 18.5 = GET TSC/SEC
2285
        mov     eax, [CPU_FREQ]
2237
        mov     eax, dword [cpu_freq]
2286
        mov     [esp+32], eax
2238
        mov     [esp+32], eax
2287
        ret
2239
        ret
2288
;------------------------------------------------------------------------------
2240
;------------------------------------------------------------------------------
-
 
2241
get_cpu_freq:
-
 
2242
        mov     eax, dword [cpu_freq]
-
 
2243
        mov     edx, dword [cpu_freq+4]
-
 
2244
        ret
2289
;  SAVE ramdisk to /hd/1/menuet.img
2245
;  SAVE ramdisk to /hd/1/menuet.img
2290
;!!!!!!!!!!!!!!!!!!!!!!!!
2246
;!!!!!!!!!!!!!!!!!!!!!!!!
2291
   include 'blkdev/rdsave.inc'
2247
   include 'blkdev/rdsave.inc'
2292
;!!!!!!!!!!!!!!!!!!!!!!!!
2248
;!!!!!!!!!!!!!!!!!!!!!!!!
2293
;------------------------------------------------------------------------------
2249
;------------------------------------------------------------------------------
Line 2533... Line 2489...
2533
 
2489
 
2534
iglobal
2490
iglobal
2535
version_inf:
2491
version_inf:
2536
  db 0,7,7,0  ; version 0.7.7.0
2492
  db 0,7,7,0  ; version 0.7.7.0
2537
  db 0
2493
  db 0
2538
  dd __REV__
2494
.rev    dd __REV__
2539
version_end:
2495
version_end:
2540
endg
2496
endg
2541
;------------------------------------------------------------------------------
2497
;------------------------------------------------------------------------------
2542
align 4
2498
align 4
Line 3542... Line 3498...
3542
        je      noshutdown
3498
        je      noshutdown
Line 3543... Line 3499...
3543
 
3499
 
Line 3544... Line 3500...
3544
        mov     edx, [shutdown_processes]
3500
        mov     edx, [shutdown_processes]
3545
 
3501
 
Line 3546... Line 3502...
3546
        cmp     [SYS_SHUTDOWN], dl
3502
        cmp     [SYS_SHUTDOWN], dl
3547
        jne     no_mark_system_shutdown
3503
        jne     noshutdown
3548
 
3504
 
3549
        lea     ecx, [edx-1]
3505
        lea     ecx, [edx-1]
3550
        mov     edx, OS_BASE+0x3040
3506
        mov     edx, OS_BASE+0x3040
3551
        jecxz   @f
3507
        jecxz   no_mark_system_shutdown
-
 
3508
;--------------------------------------
-
 
3509
align 4
-
 
3510
markz:
-
 
3511
        push    ecx edx
-
 
3512
        cmp     [edx+TASKDATA.state], 9
-
 
3513
        jz      .nokill
-
 
3514
        lea     edx, [(edx-(CURRENT_TASK and 1FFFFFFFh))*8+SLOT_BASE]
-
 
3515
        cmp     [edx+APPDATA.dir_table], sys_pgdir - OS_BASE
-
 
3516
        jz      .nokill
-
 
3517
        call    request_terminate
-
 
3518
        jmp     .common
-
 
3519
.nokill:
-
 
3520
        dec     byte [SYS_SHUTDOWN]
-
 
3521
        xor     eax, eax
-
 
3522
.common:
3552
;--------------------------------------
3523
        pop     edx ecx
-
 
3524
        test    eax, eax
3553
align 4
3525
        jz      @f
3554
markz:
3526
        mov     [edx+TASKDATA.state], byte 3
3555
        mov     [edx+TASKDATA.state], byte 3
3527
@@:
3556
        add     edx, 0x20
3528
        add     edx, 0x20
3557
        loop    markz
3529
        loop    markz
Line 3570... Line 3542...
3570
;--------------------------------------
3542
;--------------------------------------
3571
align 4
3543
align 4
3572
newct:
3544
newct:
3573
        mov     cl, [ebx]
3545
        mov     cl, [ebx]
3574
        cmp     cl, byte 3
3546
        cmp     cl, byte 3
3575
        jz      terminate
3547
        jz      .terminate
Line 3576... Line 3548...
3576
 
3548
 
3577
        cmp     cl, byte 4
3549
        cmp     cl, byte 4
-
 
3550
        jnz     .noterminate
-
 
3551
.terminate:
-
 
3552
        pushad
-
 
3553
        mov     ecx, eax
-
 
3554
        shl     ecx, 8
-
 
3555
        add     ecx, SLOT_BASE
-
 
3556
        call    restore_default_cursor_before_killing
Line -... Line 3557...
-
 
3557
        popad
-
 
3558
 
-
 
3559
        pushad
-
 
3560
        call    terminate
-
 
3561
        popad
-
 
3562
        cmp     byte [SYS_SHUTDOWN], 0
-
 
3563
        jz      .noterminate
-
 
3564
        dec     byte [SYS_SHUTDOWN]
-
 
3565
        je      system_shutdown
3578
        jz      terminate
3566
 
3579
 
3567
.noterminate:
3580
        add     ebx, 0x20
3568
        add     ebx, 0x20
3581
        inc     esi
3569
        inc     esi
3582
        dec     eax
3570
        dec     eax
Line 3784... Line 3772...
3784
        setc    byte [ebx+APPDATA.event_filter]
3772
        setc    byte [ebx+APPDATA.event_filter]
3785
        xchg    eax, [edi + TASKDATA.event_mask] ; set new event mask
3773
        xchg    eax, [edi + TASKDATA.event_mask] ; set new event mask
3786
        mov     [esp+32], eax                    ; return old mask value
3774
        mov     [esp+32], eax                    ; return old mask value
3787
        ret
3775
        ret
3788
;-----------------------------------------------------------------------------
3776
;-----------------------------------------------------------------------------
-
 
3777
 
-
 
3778
; this is for syscall
-
 
3779
proc delay_hs_unprotected
-
 
3780
        call    unprotect_from_terminate
-
 
3781
        call    delay_hs
-
 
3782
        call    protect_from_terminate
-
 
3783
        ret
-
 
3784
endp
-
 
3785
 
3789
align 4
3786
align 4
3790
delay_hs:     ; delay in 1/100 secs
3787
delay_hs:     ; delay in 1/100 secs
3791
; ebx = delay time
3788
; ebx = delay time
3792
        push    ecx
3789
        push    ecx
3793
        push    edx
3790
        push    edx
Line 4636... Line 4633...
4636
        pop     ecx
4633
        pop     ecx
4637
        loop    @b
4634
        loop    @b
4638
        popad
4635
        popad
4639
        ret
4636
        ret
Line -... Line 4637...
-
 
4637
 
-
 
4638
msg_board_data_size = 65536 ; Must be power of two
4640
 
4639
 
4641
uglobal
4640
uglobal
4642
  msg_board_data:
-
 
4643
                  times 4096 db 0
4641
  msg_board_data  rb msg_board_data_size
4644
  msg_board_count dd 0x0
4642
  msg_board_count dd 0x0
Line 4645... Line 4643...
4645
endg
4643
endg
Line 4671... Line 4669...
4671
 
4669
 
Line 4672... Line 4670...
4672
end if
4670
end if
4673
 
4671
 
4674
        mov     [msg_board_data+ecx], bl
4672
        mov     [msg_board_data+ecx], bl
4675
        inc     ecx
4673
        inc     ecx
4676
        and     ecx, 4095
4674
        and     ecx, msg_board_data_size - 1
4677
        mov     [msg_board_count], ecx
4675
        mov     [msg_board_count], ecx
4678
        mov     [check_idle_semaphore], 5
4676
        mov     [check_idle_semaphore], 5
4679
        ret
4677
        ret
Line 4764... Line 4762...
4764
        lea     ecx, [hotkey_scancodes+ecx*4]
4762
        lea     ecx, [hotkey_scancodes+ecx*4]
4765
        mov     edx, [ecx]
4763
        mov     edx, [ecx]
4766
        mov     [eax], edx
4764
        mov     [eax], edx
4767
        mov     [ecx], eax
4765
        mov     [ecx], eax
4768
        mov     [eax+12], ecx
4766
        mov     [eax+12], ecx
-
 
4767
        test    edx, edx
4769
        jecxz   @f
4768
        jz      @f
4770
        mov     [edx+12], eax
4769
        mov     [edx+12], eax
4771
@@:
4770
@@:
4772
        and     dword [esp+32], 0
4771
        and     dword [esp+32], 0
4773
        ret
4772
        ret
4774
;-----------------------------------------------------------------------------
4773
;-----------------------------------------------------------------------------
Line 4916... Line 4915...
4916
        add     ebp, [esi+APPDATA.wnd_clientbox.left]
4915
        add     ebp, [esi+APPDATA.wnd_clientbox.left]
4917
        shl     ebp, 16
4916
        shl     ebp, 16
4918
        add     ebp, [eax-twdw+WDATA.box.top]
4917
        add     ebp, [eax-twdw+WDATA.box.top]
4919
        add     bp, word[esi+APPDATA.wnd_clientbox.top]
4918
        add     bp, word[esi+APPDATA.wnd_clientbox.top]
4920
        pop     esi
4919
        pop     esi
-
 
4920
        test    ecx, 0x08000000  ; redirect the output to the user area
-
 
4921
        jnz     @f
4921
        add     ebx, ebp
4922
        add     ebx, ebp
-
 
4923
align 4
-
 
4924
@@:
4922
        mov     eax, edi
4925
        mov     eax, edi
4923
        test    ecx, 0x08000000  ; redirect the output to the user area
4926
        test    ecx, 0x08000000  ; redirect the output to the user area
4924
        jnz     dtext
4927
        jnz     dtext
4925
        xor     edi, edi
4928
        xor     edi, edi
4926
        jmp     dtext
4929
        jmp     dtext
Line 5696... Line 5699...
5696
include "data32.inc"
5699
include "data32.inc"
Line 5697... Line 5700...
5697
 
5700
 
Line 5698... Line 5701...
5698
__REV__ = __REV
5701
__REV__ = __REV
-
 
5702
 
5699
 
5703
uglobals_size = $ - endofcode
-
 
5704
if ~ lang eq sp