Subversion Repositories Kolibri OS

Rev

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

Rev 9897 Rev 9910
Line 75... Line 75...
75
format binary as "mnt"
75
format binary as "mnt"
Line 76... Line 76...
76
 
76
 
77
include 'macros.inc'
77
include 'macros.inc'
Line 78... Line 78...
78
include 'struct.inc'
78
include 'struct.inc'
Line 79... Line 79...
79
 
79
 
80
$Revision: 9897 $
80
$Revision: 9910 $
Line 1361... Line 1361...
1361
align 4
1361
align 4
1362
display_number:
1362
display_number:
1363
; add check pointers
1363
; add check pointers
1364
        test    bl, bl
1364
        test    bl, bl
1365
        jz      @f
1365
        jz      @f
-
 
1366
        bt      ebx, 30  ; check 30 bit
-
 
1367
        jb      @f
1366
        stdcall is_region_userspace, ecx, 1
1368
        stdcall is_region_userspace, ecx, 4
-
 
1369
        jz      @f
-
 
1370
        ret
-
 
1371
@@:
-
 
1372
        jz      @f
-
 
1373
        stdcall is_region_userspace, ecx, 8
1367
        jz      @f
1374
        jz      @f
1368
        ret
1375
        ret
1369
@@:
1376
@@:
1370
        test    esi, 0x08000000
1377
        test    esi, 0x08000000
1371
        jz      @f
1378
        jz      @f
Line 1880... Line 1887...
1880
        mov     al, bl
1887
        mov     al, bl
1881
        call    put_mpu_out
1888
        call    put_mpu_out
1882
        smn2:
1889
        smn2:
1883
        ret
1890
        ret
Line 1884... Line -...
1884
 
-
 
1885
detect_devices:
-
 
1886
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
1887
;include 'detect/commouse.inc'
-
 
1888
;include 'detect/ps2mouse.inc'
-
 
1889
;include 'detect/dev_fd.inc'
-
 
1890
;include 'detect/dev_hdcd.inc'
-
 
1891
;include 'detect/sear_par.inc'
-
 
1892
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
1893
        ret
-
 
1894
 
1891
 
1895
sys_end:
1892
sys_end:
1896
;--------------------------------------
1893
;--------------------------------------
1897
        cmp     [_display.select_cursor], 0
1894
        cmp     [_display.select_cursor], 0
1898
        je      @f
1895
        je      @f
Line 2022... Line 2019...
2022
        ret
2019
        ret
2023
;------------------------------------------------------------------------------
2020
;------------------------------------------------------------------------------
2024
sysfn_terminate:        ; 18.2 = TERMINATE
2021
sysfn_terminate:        ; 18.2 = TERMINATE
2025
        push    ecx
2022
        push    ecx
2026
        cmp     ecx, 2
2023
        cmp     ecx, 2
2027
        jb      noprocessterminate
2024
        jb      .noprocessterminate
2028
        mov     edx, [thread_count]
2025
        mov     edx, [thread_count]
2029
        cmp     ecx, edx
2026
        cmp     ecx, edx
2030
        ja      noprocessterminate
2027
        ja      .noprocessterminate
2031
        mov     eax, [thread_count]
2028
        mov     eax, [thread_count]
2032
        shl     ecx, BSF sizeof.APPDATA
2029
        shl     ecx, BSF sizeof.APPDATA
2033
        add     ecx, SLOT_BASE
2030
        add     ecx, SLOT_BASE
2034
        mov     edx, [ecx + APPDATA.tid]
2031
        mov     edx, [ecx + APPDATA.tid]
2035
        cmp     byte [ecx + APPDATA.state], TSTATE_FREE
2032
        cmp     byte [ecx + APPDATA.state], TSTATE_FREE
2036
        jz      noprocessterminate
2033
        jz      .noprocessterminate
2037
        push    eax
2034
        push    eax
2038
        mov     eax, ecx
2035
        mov     eax, ecx
2039
        call    is_kernel_thread
2036
        call    is_kernel_thread
2040
        pop     eax
2037
        pop     eax
2041
        jz      noprocessterminate
2038
        jz      .noprocessterminate
2042
        push    ecx edx
2039
        push    ecx edx
2043
        mov     edx, ecx
2040
        mov     edx, ecx
2044
        call    request_terminate
2041
        call    request_terminate
2045
        pop     edx ecx
2042
        pop     edx ecx
2046
        test    eax, eax
2043
        test    eax, eax
2047
        jz      noprocessterminate
2044
        jz      .noprocessterminate
2048
;--------------------------------------
2045
;--------------------------------------
2049
; terminate all network sockets it used
2046
; terminate all network sockets it used
2050
        pusha
2047
        pusha
2051
        mov     eax, edx     ;TODO: check function
2048
        mov     eax, edx     ;TODO: check function
2052
        call    socket_process_end
2049
        call    socket_process_end
Line 2071... Line 2068...
2071
        mov     [ecx + APPDATA.state], TSTATE_ZOMBIE; clear possible i40's
2068
        mov     [ecx + APPDATA.state], TSTATE_ZOMBIE; clear possible i40's
2072
        call    wakeup_osloop
2069
        call    wakeup_osloop
2073
     ;call MEM_Heap_UnLock
2070
     ;call MEM_Heap_UnLock
Line 2074... Line 2071...
2074
 
2071
 
2075
        cmp     edx, [application_table_owner]; clear app table stat
2072
        cmp     edx, [application_table_owner]; clear app table stat
2076
        jne     noatsc
2073
        jne     .noatsc
2077
        call    unlock_application_table
2074
        call    unlock_application_table
2078
noatsc:
2075
.noatsc:
2079
noprocessterminate:
2076
.noprocessterminate:
2080
        add     esp, 4
2077
        add     esp, 4
2081
        ret
2078
        ret
2082
;------------------------------------------------------------------------------
2079
;------------------------------------------------------------------------------
2083
sysfn_terminate2:
2080
sysfn_terminate2:
Line 2494... Line 2491...
2494
        ret
2491
        ret
2495
;------------------------------------------------------------------------------
2492
;------------------------------------------------------------------------------
Line 2496... Line 2493...
2496
 
2493
 
2497
align 4
2494
align 4
2498
sys_getkey:
2495
sys_getkey:
2499
        mov     [esp + 32], dword 1
2496
        mov     [esp + SYSCALL_STACK.eax], dword 1
2500
        ; test main buffer
2497
        ; test main buffer
2501
        mov     ebx, [current_slot_idx]                          ; TOP OF WINDOW STACK
2498
        mov     ebx, [current_slot_idx]                          ; TOP OF WINDOW STACK
2502
        movzx   ecx, word [WIN_STACK + ebx * 2]
2499
        movzx   ecx, word [WIN_STACK + ebx * 2]
2503
        mov     edx, [thread_count]
2500
        mov     edx, [thread_count]
Line 2686... Line 2683...
2686
 
2683
 
2687
; redraw status
2684
; redraw status
2688
align 4
2685
align 4
2689
sys_redrawstat:
2686
sys_redrawstat:
2690
        cmp     ebx, 1
2687
        cmp     ebx, 1
2691
        jne     no_widgets_away
2688
        jne     .no_widgets_away
2692
        ; buttons away
2689
        ; buttons away
2693
        mov     ecx, [current_slot_idx]
2690
        mov     ecx, [current_slot_idx]
2694
  sys_newba2:
2691
.sys_newba2:
2695
        mov     edi, [BTN_ADDR]
2692
        mov     edi, [BTN_ADDR]
2696
        cmp     [edi], dword 0  ; empty button list ?
2693
        cmp     [edi], dword 0  ; empty button list ?
2697
        je      end_of_buttons_away
2694
        je      .end_of_buttons_away
2698
        movzx   ebx, word [edi]
2695
        movzx   ebx, word [edi]
2699
        inc     ebx
2696
        inc     ebx
2700
        mov     eax, edi
2697
        mov     eax, edi
2701
  sys_newba:
2698
.sys_newba:
2702
        dec     ebx
2699
        dec     ebx
Line 2703... Line 2700...
2703
        jz      end_of_buttons_away
2700
        jz      .end_of_buttons_away
2704
 
2701
 
2705
        add     eax, 0x10
2702
        add     eax, 0x10
Line 2706... Line 2703...
2706
        cmp     cx, [eax]
2703
        cmp     cx, [eax]
2707
        jnz     sys_newba
2704
        jnz     .sys_newba
2708
 
2705
 
2709
        push    eax ebx ecx
2706
        push    eax ebx ecx
Line 2714... Line 2711...
2714
        add     eax, 0x10
2711
        add     eax, 0x10
2715
        call    memmove
2712
        call    memmove
2716
        dec     dword [edi]
2713
        dec     dword [edi]
2717
        pop     ecx ebx eax
2714
        pop     ecx ebx eax
Line 2718... Line 2715...
2718
 
2715
 
2719
        jmp     sys_newba2
-
 
2720
 
-
 
Line -... Line 2716...
-
 
2716
        jmp     .sys_newba2
2721
  end_of_buttons_away:
2717
 
Line 2722... Line 2718...
2722
 
2718
.end_of_buttons_away:
Line 2723... Line 2719...
2723
        ret
2719
        ret
2724
 
2720
 
Line 2725... Line 2721...
2725
  no_widgets_away:
2721
.no_widgets_away:
2726
 
2722
 
2727
        cmp     ebx, 2
2723
        cmp     ebx, 2
2728
        jnz     srl1
2724
        jnz     .srl1
Line 2737... Line 2733...
2737
        mov     [edx + RECT.right], eax
2733
        mov     [edx + RECT.right], eax
2738
        mov     eax, [_display.height]
2734
        mov     eax, [_display.height]
2739
        dec     eax
2735
        dec     eax
2740
        mov     [edx + RECT.bottom], eax
2736
        mov     [edx + RECT.bottom], eax
Line 2741... Line 2737...
2741
 
2737
 
2742
  srl1:
2738
.srl1:
Line 2743... Line 2739...
2743
        ret
2739
        ret
2744
 
2740
 
2745
;ok - 100% work
2741
;ok - 100% work
Line 2876... Line 2872...
2876
endg
2872
endg
2877
;-----------------------------------------------------------------------------
2873
;-----------------------------------------------------------------------------
2878
align 4
2874
align 4
2879
checkmisc:
2875
checkmisc:
2880
        cmp     [ctrl_alt_del], 1
2876
        cmp     [ctrl_alt_del], 1
2881
        jne     nocpustart
2877
        jne     .nocpustart
Line 2882... Line 2878...
2882
 
2878
 
2883
        mov     ebp, cpustring
2879
        mov     ebp, cpustring
Line 2884... Line 2880...
2884
        call    fs_execute_from_sysdir
2880
        call    fs_execute_from_sysdir
2885
 
2881
 
2886
        mov     [ctrl_alt_del], 0
2882
        mov     [ctrl_alt_del], 0
2887
;--------------------------------------
2883
;--------------------------------------
2888
align 4
2884
align 4
2889
nocpustart:
2885
.nocpustart:
2890
        cmp     [mouse_active], 1
2886
        cmp     [mouse_active], 1
Line 2891... Line 2887...
2891
        jne     mouse_not_active
2887
        jne     .mouse_not_active
2892
        mov     [mouse_active], 0
2888
        mov     [mouse_active], 0
Line 2940... Line 2936...
2940
        loop    .set_mouse_event
2936
        loop    .set_mouse_event
Line 2941... Line 2937...
2941
 
2937
 
2942
        pop     eax
2938
        pop     eax
2943
;--------------------------------------
2939
;--------------------------------------
2944
align 4
2940
align 4
2945
mouse_not_active:
2941
.mouse_not_active:
2946
        cmp     [REDRAW_BACKGROUND], 0  ; background update ?
2942
        cmp     [REDRAW_BACKGROUND], 0  ; background update ?
Line 2947... Line 2943...
2947
        jz      nobackgr
2943
        jz      nobackgr
2948
 
2944
 
Line 3423... Line 3419...
3423
        push    edx
3419
        push    edx
Line 3424... Line 3420...
3424
 
3420
 
3425
        mov     edx, [timer_ticks]
3421
        mov     edx, [timer_ticks]
3426
;--------------------------------------
3422
;--------------------------------------
3427
align 4
3423
align 4
3428
newtic:
3424
.newtic:
3429
        mov     ecx, [timer_ticks]
3425
        mov     ecx, [timer_ticks]
3430
        sub     ecx, edx
3426
        sub     ecx, edx
3431
        cmp     ecx, ebx
3427
        cmp     ecx, ebx
Line 3432... Line 3428...
3432
        jae     zerodelay
3428
        jae     .zerodelay
Line 3433... Line 3429...
3433
 
3429
 
3434
        call    change_task
3430
        call    change_task
3435
 
3431
 
3436
        jmp     newtic
3432
        jmp     .newtic
3437
;--------------------------------------
3433
;--------------------------------------
3438
align 4
3434
align 4
3439
zerodelay:
3435
.zerodelay:
3440
        pop     edx
3436
        pop     edx
Line 3525... Line 3521...
3525
;    0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (include last number of port).
3521
;    0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (include last number of port).
3526
;destroys eax,ebx, ebp
3522
;destroys eax,ebx, ebp
3527
r_f_port_area:
3523
r_f_port_area:
Line 3528... Line 3524...
3528
 
3524
 
3529
        test    ebx, ebx
3525
        test    ebx, ebx
Line 3530... Line 3526...
3530
        jnz     free_port_area
3526
        jnz     .free_port_area
3531
 
3527
 
3532
        cmp     ecx, edx      ; beginning > end ?
3528
        cmp     ecx, edx      ; beginning > end ?
3533
        ja      rpal1
3529
        ja      .rpal1
3534
        cmp     edx, 65536    ;test ebx, not 0xffff
3530
        cmp     edx, 65536    ;test ebx, not 0xffff
3535
        jae     rpal1
3531
        jae     .rpal1
3536
        mov     eax, [RESERVED_PORTS]
3532
        mov     eax, [RESERVED_PORTS]
3537
        test    eax, eax      ; no reserved areas ?
3533
        test    eax, eax      ; no reserved areas ?
3538
        je      rpal2
3534
        je      .rpal2
3539
        cmp     eax, 255      ; max reserved
3535
        cmp     eax, 255      ; max reserved
3540
        jae     rpal1
3536
        jae     .rpal1
3541
 rpal3:
3537
 .rpal3:
3542
        mov     ebx, eax
3538
        mov     ebx, eax
3543
        shl     ebx, 4   ;16 byte is sizeof item in RESERVED_PORTS table
3539
        shl     ebx, 4   ;16 byte is sizeof item in RESERVED_PORTS table
3544
        add     ebx, RESERVED_PORTS
3540
        add     ebx, RESERVED_PORTS
3545
        cmp     ecx, [ebx+8]
3541
        cmp     ecx, [ebx+8]
3546
        ja      rpal4
3542
        ja      .rpal4
3547
        cmp     edx, [ebx+4]
3543
        cmp     edx, [ebx+4]
3548
        jae     rpal1
3544
        jae     .rpal1
3549
 rpal4:
3545
 .rpal4:
3550
        dec     eax
3546
        dec     eax
3551
        jnz     rpal3
3547
        jnz     .rpal3
3552
        jmp     rpal2
3548
        jmp     .rpal2
3553
   rpal1:
3549
   .rpal1:
3554
        xor     eax, eax
3550
        xor     eax, eax
3555
        inc     eax
3551
        inc     eax
3556
        ret
3552
        ret
3557
   rpal2:
3553
   .rpal2:
3558
     ; enable port access at port IO map
3554
     ; enable port access at port IO map
3559
        pushad                        ; start enable io map
3555
        pushad                        ; start enable io map
3560
        mov     eax, ecx
3556
        mov     eax, ecx
3561
        xor     ebp, ebp               ; enable - eax = port
3557
        xor     ebp, ebp               ; enable - eax = port
3562
        cli
3558
        cli
Line 3563... Line 3559...
3563
new_port_access:
3559
.new_port_access:
3564
        call    set_io_access_rights
3560
        call    set_io_access_rights
3565
 
3561
 
3566
        inc     eax
3562
        inc     eax
3567
        cmp     eax, edx
3563
        cmp     eax, edx
3568
        jbe     new_port_access
3564
        jbe     .new_port_access
Line 3569... Line 3565...
3569
no_unmask_io:
3565
;no_unmask_io:
3570
        sti
3566
        sti
Line 3582... Line 3578...
3582
        mov     [eax+8], edx ;finish port
3578
        mov     [eax+8], edx ;finish port
Line 3583... Line 3579...
3583
 
3579
 
3584
        xor     eax, eax
3580
        xor     eax, eax
Line 3585... Line 3581...
3585
        ret
3581
        ret
Line 3586... Line 3582...
3586
 
3582
 
3587
free_port_area:
3583
.free_port_area:
3588
 
3584
 
3589
        mov     eax, [RESERVED_PORTS]; no reserved areas ?
3585
        mov     eax, [RESERVED_PORTS]; no reserved areas ?
3590
        test    eax, eax
3586
        test    eax, eax
3591
        jz      frpal2
3587
        jz      .frpal2
3592
        mov     ebx, [current_slot]
3588
        mov     ebx, [current_slot]
3593
        mov     ebx, [ebx + APPDATA.tid]
3589
        mov     ebx, [ebx + APPDATA.tid]
3594
   frpal3:
3590
   .frpal3:
3595
        mov     edi, eax
3591
        mov     edi, eax
3596
        shl     edi, 4
3592
        shl     edi, 4
3597
        add     edi, RESERVED_PORTS
3593
        add     edi, RESERVED_PORTS
3598
        cmp     ebx, [edi]
3594
        cmp     ebx, [edi]
3599
        jne     frpal4
3595
        jne     .frpal4
3600
        cmp     ecx, [edi+4]
3596
        cmp     ecx, [edi+4]
3601
        jne     frpal4
3597
        jne     .frpal4
3602
        cmp     edx, [edi+8]
3598
        cmp     edx, [edi+8]
3603
        jne     frpal4
3599
        jne     .frpal4
3604
        jmp     frpal1
3600
        jmp     .frpal1
3605
   frpal4:
3601
   .frpal4:
3606
        dec     eax
3602
        dec     eax
3607
        jnz     frpal3
3603
        jnz     .frpal3
3608
   frpal2:
3604
   .frpal2:
3609
        inc     eax
3605
        inc     eax
3610
        ret
3606
        ret
3611
   frpal1:
3607
   .frpal1:
3612
        push    ecx
3608
        push    ecx
3613
        mov     ecx, 256
3609
        mov     ecx, 256
Line 3625... Line 3621...
3625
        ;cmp     edx, 65536
3621
        ;cmp     edx, 65536
3626
        ;jge     no_mask_io
3622
        ;jge     no_mask_io
Line 3627... Line 3623...
3627
 
3623
 
3628
        xor     ebp, ebp
3624
        xor     ebp, ebp
3629
        inc     ebp
3625
        inc     ebp
3630
new_port_access_disable:           ; disable - eax = port
3626
.new_port_access_disable:           ; disable - eax = port
Line 3631... Line 3627...
3631
        call    set_io_access_rights
3627
        call    set_io_access_rights
3632
 
3628
 
3633
        inc     eax
3629
        inc     eax
3634
        cmp     eax, edx
3630
        cmp     eax, edx
3635
        jbe     new_port_access_disable
3631
        jbe     .new_port_access_disable
3636
no_mask_io:                         ; end disable io map
3632
;no_mask_io:                         ; end disable io map
3637
        xor     eax, eax
3633
        xor     eax, eax
3638
        ret
3634
        ret
3639
;-----------------------------------------------------------------------------
3635
;-----------------------------------------------------------------------------
3640
align 4
-
 
3641
drawbackground:
3636
align 4
3642
dbrv20:
3637
drawbackground:
3643
        cmp     [BgrDrawMode], dword 1
3638
        cmp     [BgrDrawMode], dword 1
3644
        jne     bgrstr
3639
        jne     .bgrstr
3645
        call    vesa20_drawbackground_tiled
3640
        call    vesa20_drawbackground_tiled
3646
;        call    [draw_pointer]
3641
;        call    [draw_pointer]
3647
        call    __sys_draw_pointer
3642
        call    __sys_draw_pointer
3648
        ret
3643
        ret
3649
;--------------------------------------
3644
;--------------------------------------
3650
align 4
3645
align 4
3651
bgrstr:
3646
.bgrstr:
3652
        call    vesa20_drawbackground_stretch
3647
        call    vesa20_drawbackground_stretch
3653
;        call    [draw_pointer]
3648
;        call    [draw_pointer]
3654
        call    __sys_draw_pointer
3649
        call    __sys_draw_pointer
Line 3706... Line 3701...
3706
; edx = [xstart]*65536 + [ystart]
3701
; edx = [xstart]*65536 + [ystart]
3707
; esi = number of bits per pixel, must be 8, 24 or 32
3702
; esi = number of bits per pixel, must be 8, 24 or 32
3708
; edi = pointer to palette
3703
; edi = pointer to palette
3709
; ebp = row delta
3704
; ebp = row delta
3710
; check pointer
3705
; check pointer
3711
        push    ecx
3706
        push    ecx esi
3712
        mov     ax, cx
3707
        mov     ax, cx
3713
        shr     ecx, 16
3708
        shr     ecx, 16
3714
        imul    eax, ecx
3709
        imul    eax, ecx
-
 
3710
;        imul    eax, esi ; eax*count bit in 1 pixel
-
 
3711
;        shr     eax, 3
3715
        stdcall is_region_userspace, ebx, eax
3712
        stdcall is_region_userspace, ebx, eax
3716
        pop     ecx
3713
        pop     esi ecx
3717
        jnz     sys_putimage.exit
3714
        jnz     sys_putimage.exit
Line 3718... Line 3715...
3718
 
3715
 
3719
        mov     eax, [current_slot]
3716
        mov     eax, [current_slot]
3720
        add     dx, word [eax + APPDATA.wnd_clientbox.top]
3717
        add     dx, word [eax + APPDATA.wnd_clientbox.top]
Line 4076... Line 4073...
4076
;-----------------------------------------------------------------------------
4073
;-----------------------------------------------------------------------------
Line 4077... Line 4074...
4077
 
4074
 
4078
if used _rdtsc
4075
if used _rdtsc
4079
_rdtsc:
4076
_rdtsc:
4080
        bt      [cpu_caps], CAPS_TSC
4077
        bt      [cpu_caps], CAPS_TSC
4081
        jnc     ret_rdtsc
4078
        jnc     .ret_rdtsc
4082
        rdtsc
4079
        rdtsc
4083
        ret
4080
        ret
4084
   ret_rdtsc:
4081
   .ret_rdtsc:
4085
        mov     edx, 0xffffffff
4082
        mov     edx, 0xffffffff
4086
        mov     eax, 0xffffffff
4083
        mov     eax, 0xffffffff
4087
        ret
4084
        ret