Subversion Repositories Kolibri OS

Rev

Rev 6319 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6319 Rev 6339
Line 69... Line 69...
69
format binary as "mnt"
69
format binary as "mnt"
Line 70... Line 70...
70
 
70
 
71
include 'macros.inc'
71
include 'macros.inc'
Line 72... Line 72...
72
include 'struct.inc'
72
include 'struct.inc'
Line 73... Line 73...
73
 
73
 
74
$Revision: 6319 $
74
$Revision: 6339 $
Line 290... Line 290...
290
        call    init_mem
290
        call    init_mem
291
        call    init_page_map
291
        call    init_page_map
Line 292... Line 292...
292
 
292
 
Line 293... Line 293...
293
; ENABLE PAGING
293
; ENABLE PAGING
294
 
294
 
Line 295... Line 295...
295
        mov     eax, sys_proc-OS_BASE+PROC.pdt_0
295
        mov     eax, sys_pml3-OS_BASE
296
        mov     cr3, eax
296
        mov     cr3, eax
297
 
297
 
Line 356... Line 356...
356
 
356
 
357
        mov     eax, PG_GLOBAL
357
        mov     eax, PG_GLOBAL
358
        bt      [cpu_caps], CAPS_PGE
358
        bt      [cpu_caps], CAPS_PGE
Line -... Line 359...
-
 
359
        jnc     @F
359
        jnc     @F
360
 
360
 
361
        or      [sys_pml2], eax
Line 361... Line 362...
361
        or      [sys_proc+PROC.pdt_0+(OS_BASE shr 20)], eax
362
        or      [sys_pml2+8], eax
362
        or      ebx, eax
363
        or      ebx, eax
363
 
364
 
364
        mov     eax, cr4
365
        mov     eax, cr4
365
        or      eax, CR4_PGE
366
        or      eax, CR4_PGE
Line 366... Line 367...
366
        mov     cr4, eax
367
        mov     cr4, eax
367
@@:
368
@@:
368
        mov     [pte_valid_mask], ebx
369
        mov     [pte_valid_mask], ebx
Line 369... Line 370...
369
 
370
 
370
        xor     eax, eax
371
        xor     eax, eax
Line 371... Line 372...
371
        mov     dword [sys_proc+PROC.pdt_0], eax
372
        mov     dword [sys_proc+PROC.pdt_0], eax
Line 647... Line 648...
647
        inc     eax
648
        inc     eax
648
        cmp     eax, ecx
649
        cmp     eax, ecx
649
        jbe     @B
650
        jbe     @B
Line 650... Line 651...
650
 
651
 
-
 
652
        mov     [sys_proc+PROC.pdt_0_phys], sys_proc-OS_BASE+PROC.pdt_0
Line 651... Line 653...
651
        mov     [sys_proc+PROC.pdt_0_phys], sys_proc-OS_BASE+PROC.pdt_0
653
        mov     [sys_proc+PROC.pdt_1_phys], sys_proc-OS_BASE+PROC.pdt_0+4096
652
 
654
 
653
        mov     eax, -1
655
        mov     eax, -1
654
        mov     edi, thr_slot_map+4
656
        mov     edi, thr_slot_map+4
Line 759... Line 761...
759
        call    PIC_init
761
        call    PIC_init
Line 760... Line 762...
760
 
762
 
761
        mov     esi, boot_v86machine
763
        mov     esi, boot_v86machine
762
        call    boot_log
764
        call    boot_log
763
; Initialize system V86 machine
765
; Initialize system V86 machine
Line 764... Line 766...
764
        call    init_sys_v86
766
;        call    init_sys_v86
765
 
767
 
766
        mov     esi, boot_inittimer
768
        mov     esi, boot_inittimer
767
        call    boot_log
769
        call    boot_log
Line 857... Line 859...
857
;-----------------------------------------------------------------------------
859
;-----------------------------------------------------------------------------
858
; initialisation IDE ATA code
860
; initialisation IDE ATA code
859
;-----------------------------------------------------------------------------
861
;-----------------------------------------------------------------------------
860
include 'detect/init_ata.inc'
862
include 'detect/init_ata.inc'
861
;-----------------------------------------------------------------------------
863
;-----------------------------------------------------------------------------
862
if 0
-
 
863
        mov     ax, [OS_BASE+0x10000+bx_from_load]
-
 
864
        cmp     ax, 'r1'; if using not ram disk, then load librares and parameters {SPraid.simba}
-
 
865
        je      no_lib_load
-
 
866
 
-
 
867
        mov     esi, boot_loadlibs
-
 
868
        call    boot_log
-
 
869
; LOADING LIBRARES
-
 
870
        stdcall dll.Load, @IMPORT           ; loading librares for kernel (.obj files)
-
 
871
        call    load_file_parse_table       ; prepare file parse table
-
 
872
        call    set_kernel_conf             ; configure devices and gui
-
 
873
no_lib_load:
-
 
874
end if
-
 
Line -... Line 864...
-
 
864
 
875
 
865
        cli
876
; Display APIC status
866
; Display APIC status
877
        mov     esi, boot_APIC_found
867
        mov     esi, boot_APIC_found
878
        cmp     [irq_mode], IRQ_APIC
868
        cmp     [irq_mode], IRQ_APIC
879
        je      @f
869
        je      @f
Line 900... Line 890...
900
        xor     edi, edi
890
        xor     edi, edi
901
        mov     eax, 0x00040000
891
        mov     eax, 0x00040000
902
        inc     edi
892
        inc     edi
903
        call    display_number_force
893
        call    display_number_force
Line 904... Line -...
904
 
-
 
905
; BUILD SCHEDULER
-
 
906
 
-
 
907
;        call    build_scheduler; sys32.inc
-
 
908
 
-
 
909
;        mov     esi, boot_devices
-
 
910
;        call    boot_log
-
 
911
 
894
 
Line 912... Line 895...
912
include "detect/vortex86.inc"                     ; Vortex86 SoC detection code
895
include "detect/vortex86.inc"                     ; Vortex86 SoC detection code
Line 913... Line 896...
913
 
896
 
Line 914... Line 897...
914
        stdcall load_pe_driver, szVidintel, 0
897
;        stdcall load_pe_driver, szVidintel, 0
Line 1113... Line 1096...
1113
 
1096
 
Line 1114... Line 1097...
1114
        mov     [timer_ticks_enable], 1         ; for cd driver
1097
        mov     [timer_ticks_enable], 1         ; for cd driver
Line 1115... Line 1098...
1115
 
1098
 
Line 1116... Line 1099...
1116
        sti
1099
        sti
Line 1117... Line 1100...
1117
 
1100
 
Line 2252... Line 2235...
2252
        jz      .not_found
2235
        jz      .not_found
2253
        mov     ecx, eax
2236
        mov     ecx, eax
2254
        cli
2237
        cli
2255
        call    sysfn_terminate
2238
        call    sysfn_terminate
2256
        call    unlock_application_table
2239
        call    unlock_application_table
2257
        sti
2240
;        sti
2258
        and     dword [esp+32], 0
2241
        and     dword [esp+32], 0
2259
        ret
2242
        ret
2260
.not_found:
2243
.not_found:
2261
        call    unlock_application_table
2244
        call    unlock_application_table
2262
        or      dword [esp+32], -1
2245
        or      dword [esp+32], -1
Line 2845... Line 2828...
2845
        mov     [esp+32], eax
2828
        mov     [esp+32], eax
2846
        test    eax, eax
2829
        test    eax, eax
2847
        jz      .nomem
2830
        jz      .nomem
2848
        mov     ebx, eax
2831
        mov     ebx, eax
2849
        shr     ebx, 12
2832
        shr     ebx, 12
2850
        or      dword [page_tabs+(ebx-1)*4], DONT_FREE_BLOCK
2833
        or      dword [page_tabs+(ebx-1)*8], DONT_FREE_BLOCK
2851
        mov     esi, [img_background]
2834
        mov     esi, [img_background]
2852
        shr     esi, 12
2835
        shr     esi, 12
2853
        mov     ecx, [mem_BACKGROUND]
2836
        mov     ecx, [mem_BACKGROUND]
2854
        add     ecx, 0xFFF
2837
        add     ecx, 0xFFF
2855
        shr     ecx, 12
2838
        shr     ecx, 12
2856
;--------------------------------------
2839
;--------------------------------------
2857
align 4
2840
align 4
2858
.z:
2841
.z:
2859
        mov     eax, [page_tabs+ebx*4]
2842
        mov     eax, [page_tabs+ebx*8]
2860
        test    al, 1
2843
        test    al, 1
2861
        jz      @f
2844
        jz      @f
2862
        call    free_page
2845
        call    free_page
2863
;--------------------------------------
2846
;--------------------------------------
2864
align 4
2847
align 4
2865
@@:
2848
@@:
2866
        mov     eax, [page_tabs+esi*4]
2849
        mov     eax, [page_tabs+esi*8]
2867
        or      al, PG_UWR
2850
        or      al, PG_UWR
2868
        mov     [page_tabs+ebx*4], eax
2851
        mov     [page_tabs+ebx*8], eax
2869
        mov     eax, ebx
2852
        mov     eax, ebx
2870
        shl     eax, 12
2853
        shl     eax, 12
2871
        invlpg  [eax]
2854
        invlpg  [eax]
2872
        inc     ebx
2855
        inc     ebx
2873
        inc     esi
2856
        inc     esi
Line 2889... Line 2872...
2889
        cmp     [bgrlockpid], eax
2872
        cmp     [bgrlockpid], eax
2890
        jnz     .err
2873
        jnz     .err
2891
        mov     eax, ecx
2874
        mov     eax, ecx
2892
        mov     ebx, ecx
2875
        mov     ebx, ecx
2893
        shr     eax, 12
2876
        shr     eax, 12
2894
        mov     ecx, [page_tabs+(eax-1)*4]
2877
        mov     ecx, [page_tabs+(eax-1)*8]
2895
        test    cl, USED_BLOCK+DONT_FREE_BLOCK
2878
        test    cl, USED_BLOCK+DONT_FREE_BLOCK
2896
        jz      .err
2879
        jz      .err
2897
        jnp     .err
2880
        jnp     .err
2898
        push    eax
2881
        push    eax
2899
        shr     ecx, 12
2882
        shr     ecx, 12
2900
        dec     ecx
2883
        dec     ecx
2901
;--------------------------------------
2884
;--------------------------------------
2902
align 4
2885
align 4
2903
@@:
2886
@@:
2904
        and     dword [page_tabs+eax*4], 0
2887
        and     dword [page_tabs+eax*8], 0
2905
        mov     edx, eax
2888
        mov     edx, eax
2906
        shl     edx, 12
2889
        shl     edx, 12
2907
        push    eax
2890
        push    eax
2908
        invlpg  [edx]
2891
        invlpg  [edx]
2909
        pop     eax
2892
        pop     eax
2910
        inc     eax
2893
        inc     eax
2911
        loop    @b
2894
        loop    @b
2912
        pop     eax
2895
        pop     eax
2913
        and     dword [page_tabs+(eax-1)*4], not DONT_FREE_BLOCK
2896
        and     dword [page_tabs+(eax-1)*8], not DONT_FREE_BLOCK
2914
        stdcall user_free, ebx
2897
        stdcall user_free, ebx
2915
        mov     [esp+32], eax
2898
        mov     [esp+32], eax
2916
        and     [bgrlockpid], 0
2899
        and     [bgrlockpid], 0
2917
        mov     [bgrlock], 0
2900
        mov     [bgrlock], 0
2918
        ret
2901
        ret
Line 3273... Line 3256...
3273
        out     0x70, al
3256
        out     0x70, al
3274
        in      al, 0x71
3257
        in      al, 0x71
3275
        add     ecx, edx
3258
        add     ecx, edx
3276
        movzx   edx, al
3259
        movzx   edx, al
3277
        add     ecx, edx
3260
        add     ecx, edx
3278
        sti
3261
;        sti
3279
        mov     [esp + 32], ecx
3262
        mov     [esp + 32], ecx
3280
        ret
3263
        ret
Line 3281... Line 3264...
3281
 
3264
 
Line 3308... Line 3291...
3308
        mov     ch, al
3291
        mov     ch, al
3309
        mov     al, 9           ; year
3292
        mov     al, 9           ; year
3310
        out     0x70, al
3293
        out     0x70, al
3311
        in      al, 0x71
3294
        in      al, 0x71
3312
        mov     cl, al
3295
        mov     cl, al
3313
        sti
3296
;        sti
3314
        mov     [esp+32], ecx
3297
        mov     [esp+32], ecx
3315
        ret
3298
        ret
Line 3316... Line 3299...
3316
 
3299
 
Line 4232... Line 4215...
4232
        cmp     eax, edx
4215
        cmp     eax, edx
4233
        jbe     new_port_access
4216
        jbe     new_port_access
4234
;       pop     ebp
4217
;       pop     ebp
4235
no_unmask_io:
4218
no_unmask_io:
4236
        popad                         ; end enable io map
4219
        popad                         ; end enable io map
4237
        sti
4220
;        sti
Line 4238... Line 4221...
4238
 
4221
 
4239
        mov     eax, [RESERVED_PORTS]
4222
        mov     eax, [RESERVED_PORTS]
4240
        add     eax, 1
4223
        add     eax, 1
4241
        mov     [RESERVED_PORTS], eax
4224
        mov     [RESERVED_PORTS], eax