Subversion Repositories Kolibri OS

Rev

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

Rev 9828 Rev 9831
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: 9828 $
80
$Revision: 9831 $
Line 1582... Line 1582...
1582
;  9 = not used
1582
;  9 = not used
1583
; 10 = not used
1583
; 10 = not used
1584
; 11 = enable lba read
1584
; 11 = enable lba read
1585
; 12 = enable pci access
1585
; 12 = enable pci access
1586
;-----------------------------------------------------------------------------
1586
;-----------------------------------------------------------------------------
1587
        and     [esp + SYSCALL_STACK._eax], dword 0
1587
        and     [esp + SYSCALL_STACK.eax], dword 0
1588
; F.21.1 - set MPU MIDI base port
1588
; F.21.1 - set MPU MIDI base port
1589
        dec     ebx
1589
        dec     ebx
1590
        jnz     @f
1590
        jnz     @f
Line 1591... Line 1591...
1591
 
1591
 
Line 1669... Line 1669...
1669
 
1669
 
1670
        mov     [pci_access_enabled], ecx
1670
        mov     [pci_access_enabled], ecx
1671
        ret
1671
        ret
1672
;--------------------------------------
1672
;--------------------------------------
1673
.error:
1673
.error:
1674
        or      [esp + SYSCALL_STACK._eax], dword -1
1674
        or      [esp + SYSCALL_STACK.eax], dword -1
1675
        ret
1675
        ret
1676
;-----------------------------------------------------------------------------
1676
;-----------------------------------------------------------------------------
1677
align 4
1677
align 4
1678
sys_getsetup:
1678
sys_getsetup:
Line 1692... Line 1692...
1692
; F.26.1 - get MPU MIDI base port
1692
; F.26.1 - get MPU MIDI base port
1693
        dec     ebx
1693
        dec     ebx
1694
        jnz     @f
1694
        jnz     @f
Line 1695... Line 1695...
1695
 
1695
 
1696
        movzx   eax, [midi_base]
1696
        movzx   eax, [midi_base]
1697
        mov     [esp + SYSCALL_STACK._eax], eax
1697
        mov     [esp + SYSCALL_STACK.eax], eax
1698
        ret
1698
        ret
1699
;--------------------------------------
1699
;--------------------------------------
1700
@@:
1700
@@:
1701
; F.26.2 - get keyboard layout
1701
; F.26.2 - get keyboard layout
Line 1739... Line 1739...
1739
; 9 = country identifier
1739
; 9 = country identifier
1740
        sub     ecx, 6
1740
        sub     ecx, 6
1741
        jnz     .error
1741
        jnz     .error
Line 1742... Line 1742...
1742
 
1742
 
1743
        movzx   eax, word [keyboard]
1743
        movzx   eax, word [keyboard]
1744
        mov     [esp + SYSCALL_STACK._eax], eax
1744
        mov     [esp + SYSCALL_STACK.eax], eax
Line 1745... Line 1745...
1745
        ret
1745
        ret
1746
 
1746
 
1747
.addr_error:    ; if given memory address is illegal
1747
.addr_error:    ; if given memory address is illegal
1748
        or      dword [esp + SYSCALL_STACK._eax], -1
1748
        or      dword [esp + SYSCALL_STACK.eax], -1
1749
        ret        
1749
        ret        
1750
;--------------------------------------
1750
;--------------------------------------
1751
@@:
1751
@@:
1752
; F.26.5 - get system language
1752
; F.26.5 - get system language
Line 1753... Line 1753...
1753
        sub     ebx, 3
1753
        sub     ebx, 3
1754
        jnz     @f
1754
        jnz     @f
1755
 
1755
 
1756
        mov     eax, [syslang]
1756
        mov     eax, [syslang]
1757
        mov     [esp + SYSCALL_STACK._eax], eax
1757
        mov     [esp + SYSCALL_STACK.eax], eax
1758
        ret
1758
        ret
1759
;--------------------------------------
1759
;--------------------------------------
1760
@@:
1760
@@:
Line 1761... Line 1761...
1761
; F.26.9 - get the value of the time counter
1761
; F.26.9 - get the value of the time counter
1762
        sub     ebx, 4
1762
        sub     ebx, 4
1763
        jnz     @f
1763
        jnz     @f
1764
 
1764
 
1765
        mov     eax, [timer_ticks]
1765
        mov     eax, [timer_ticks]
1766
        mov     [esp + SYSCALL_STACK._eax], eax
1766
        mov     [esp + SYSCALL_STACK.eax], eax
1767
        ret
1767
        ret
1768
;--------------------------------------
1768
;--------------------------------------
Line 1769... Line 1769...
1769
@@:
1769
@@:
1770
; F.26.10 - get the time from kernel launch in nanoseconds
1770
; F.26.10 - get the time from kernel launch in nanoseconds
1771
        dec     ebx
1771
        dec     ebx
1772
        jnz     @f
1772
        jnz     @f
1773
 
1773
 
1774
        call    get_clock_ns
1774
        call    get_clock_ns
1775
        mov     [esp + SYSCALL_STACK._edx], edx
1775
        mov     [esp + SYSCALL_STACK.edx], edx
1776
        mov     [esp + SYSCALL_STACK._eax], eax
1776
        mov     [esp + SYSCALL_STACK.eax], eax
1777
        ret
1777
        ret
Line 1778... Line 1778...
1778
;--------------------------------------
1778
;--------------------------------------
1779
@@:
1779
@@:
1780
; F.26.11 - Find out whether low-level HD access is enabled
1780
; F.26.11 - Find out whether low-level HD access is enabled
1781
        dec     ebx
1781
        dec     ebx
1782
        jnz     @f
1782
        jnz     @f
1783
 
1783
 
1784
        mov     eax, [lba_read_enabled]
1784
        mov     eax, [lba_read_enabled]
1785
        mov     [esp + SYSCALL_STACK._eax], eax
1785
        mov     [esp + SYSCALL_STACK.eax], eax
Line 1786... Line 1786...
1786
        ret
1786
        ret
1787
;--------------------------------------
1787
;--------------------------------------
1788
@@:
1788
@@:
1789
; F.26.12 - Find out whether low-level PCI access is enabled
1789
; F.26.12 - Find out whether low-level PCI access is enabled
1790
        dec     ebx
1790
        dec     ebx
1791
        jnz     .error
1791
        jnz     .error
1792
 
1792
 
1793
        mov     eax, [pci_access_enabled]
1793
        mov     eax, [pci_access_enabled]
1794
        mov     [esp + SYSCALL_STACK._eax], eax
1794
        mov     [esp + SYSCALL_STACK.eax], eax
1795
        ret
1795
        ret
1796
;--------------------------------------
1796
;--------------------------------------
Line 2004... Line 2004...
2004
 
2004
 
2005
        mov     eax, [thread_count]
2005
        mov     eax, [thread_count]
2006
        mov     [SYS_SHUTDOWN], al
2006
        mov     [SYS_SHUTDOWN], al
2007
        mov     [shutdown_processes], eax
2007
        mov     [shutdown_processes], eax
2008
        call    wakeup_osloop
2008
        call    wakeup_osloop
2009
        and     dword [esp + SYSCALL_STACK._eax], 0
2009
        and     dword [esp + SYSCALL_STACK.eax], 0
2010
 exit_for_anyone:
2010
 exit_for_anyone:
2011
        ret
2011
        ret
2012
  uglobal
2012
  uglobal
2013
   shutdown_processes:
2013
   shutdown_processes:
Line 2091... Line 2091...
2091
        mov     ecx, eax
2091
        mov     ecx, eax
2092
        cli
2092
        cli
2093
        call    sysfn_terminate
2093
        call    sysfn_terminate
2094
        call    unlock_application_table
2094
        call    unlock_application_table
2095
        sti
2095
        sti
2096
        and     dword [esp + SYSCALL_STACK._eax], 0
2096
        and     dword [esp + SYSCALL_STACK.eax], 0
2097
        ret
2097
        ret
2098
.not_found:
2098
.not_found:
2099
        call    unlock_application_table
2099
        call    unlock_application_table
2100
        or      dword [esp + SYSCALL_STACK._eax], -1
2100
        or      dword [esp + SYSCALL_STACK.eax], -1
2101
        ret
2101
        ret
2102
;------------------------------------------------------------------------------
2102
;------------------------------------------------------------------------------
2103
sysfn_deactivate:         ; 18.1 = DEACTIVATE WINDOW
2103
sysfn_deactivate:         ; 18.1 = DEACTIVATE WINDOW
2104
        cmp     ecx, 2
2104
        cmp     ecx, 2
2105
        jb      .nowindowdeactivate
2105
        jb      .nowindowdeactivate
Line 2214... Line 2214...
2214
        mov     eax, 1
2214
        mov     eax, 1
2215
        jmp     .exit
2215
        jmp     .exit
2216
.fail:
2216
.fail:
2217
        xor     eax, eax
2217
        xor     eax, eax
2218
.exit:
2218
.exit:
2219
        mov     [esp + SYSCALL_STACK._eax], eax
2219
        mov     [esp + SYSCALL_STACK.eax], eax
2220
        ret
2220
        ret
Line 2221... Line 2221...
2221
 
2221
 
2222
;------------------------------------------------------------------------------
2222
;------------------------------------------------------------------------------
2223
sysfn_getidletime:              ; 18.4 = GET IDLETIME
2223
sysfn_getidletime:              ; 18.4 = GET IDLETIME
2224
        ;mov     eax, [TASK_TABLE+32+TASKDATA.cpu_usage]
2224
        ;mov     eax, [TASK_TABLE+32+TASKDATA.cpu_usage]
2225
        mov     eax, [SLOT_BASE + APPDATA.cpu_usage]
2225
        mov     eax, [SLOT_BASE + APPDATA.cpu_usage]
2226
        mov     [esp + SYSCALL_STACK._eax], eax
2226
        mov     [esp + SYSCALL_STACK.eax], eax
2227
        ret
2227
        ret
2228
;------------------------------------------------------------------------------
2228
;------------------------------------------------------------------------------
2229
sysfn_getcpuclock:              ; 18.5 = GET TSC/SEC
2229
sysfn_getcpuclock:              ; 18.5 = GET TSC/SEC
2230
        mov     eax, dword [cpu_freq]
2230
        mov     eax, dword [cpu_freq]
2231
        mov     [esp + SYSCALL_STACK._eax], eax
2231
        mov     [esp + SYSCALL_STACK.eax], eax
2232
        ret
2232
        ret
2233
;------------------------------------------------------------------------------
2233
;------------------------------------------------------------------------------
2234
get_cpu_freq:
2234
get_cpu_freq:
2235
        mov     eax, dword [cpu_freq]
2235
        mov     eax, dword [cpu_freq]
Line 2242... Line 2242...
2242
;------------------------------------------------------------------------------
2242
;------------------------------------------------------------------------------
2243
align 4
2243
align 4
2244
sysfn_getactive:        ; 18.7 = get active window
2244
sysfn_getactive:        ; 18.7 = get active window
2245
        mov     eax, [thread_count]
2245
        mov     eax, [thread_count]
2246
        movzx   eax, word [WIN_POS + eax*2]
2246
        movzx   eax, word [WIN_POS + eax*2]
2247
        mov     [esp + SYSCALL_STACK._eax], eax
2247
        mov     [esp + SYSCALL_STACK.eax], eax
2248
        ret
2248
        ret
2249
;------------------------------------------------------------------------------
2249
;------------------------------------------------------------------------------
2250
sysfn_sound_flag:       ; 18.8 = get/set sound_flag
2250
sysfn_sound_flag:       ; 18.8 = get/set sound_flag
2251
;     cmp  ecx,1
2251
;     cmp  ecx,1
2252
        dec     ecx
2252
        dec     ecx
2253
        jnz     nogetsoundflag
2253
        jnz     nogetsoundflag
2254
        movzx   eax, byte [sound_flag]; get sound_flag
2254
        movzx   eax, byte [sound_flag]; get sound_flag
2255
        mov     [esp + SYSCALL_STACK._eax], eax
2255
        mov     [esp + SYSCALL_STACK.eax], eax
2256
        ret
2256
        ret
2257
 nogetsoundflag:
2257
 nogetsoundflag:
2258
;     cmp  ecx,2
2258
;     cmp  ecx,2
2259
        dec     ecx
2259
        dec     ecx
2260
        jnz     nosoundflag
2260
        jnz     nosoundflag
Line 2291... Line 2291...
2291
        mov     esi, version_inf
2291
        mov     esi, version_inf
2292
        mov     ecx, version_end-version_inf
2292
        mov     ecx, version_end-version_inf
2293
        rep movsb
2293
        rep movsb
2294
        ret
2294
        ret
2295
.addr_error:    ; if given memory address is illegal
2295
.addr_error:    ; if given memory address is illegal
2296
        mov     dword [esp + SYSCALL_STACK._eax], -1
2296
        mov     dword [esp + SYSCALL_STACK.eax], -1
2297
        ret   
2297
        ret   
2298
;------------------------------------------------------------------------------
2298
;------------------------------------------------------------------------------
2299
sysfn_waitretrace:     ; 18.14 = sys wait retrace
2299
sysfn_waitretrace:     ; 18.14 = sys wait retrace
2300
     ;wait retrace functions
2300
     ;wait retrace functions
2301
 sys_wait_retrace:
2301
 sys_wait_retrace:
2302
        mov     edx, 0x3da
2302
        mov     edx, 0x3da
2303
 WaitRetrace_loop:
2303
 WaitRetrace_loop:
2304
        in      al, dx
2304
        in      al, dx
2305
        test    al, 1000b
2305
        test    al, 1000b
2306
        jz      WaitRetrace_loop
2306
        jz      WaitRetrace_loop
2307
        and     [esp + SYSCALL_STACK._eax], dword 0
2307
        and     [esp + SYSCALL_STACK.eax], dword 0
2308
        ret
2308
        ret
2309
;------------------------------------------------------------------------------
2309
;------------------------------------------------------------------------------
2310
align 4
2310
align 4
2311
sysfn_centermouse:      ; 18.15 = mouse centered
2311
sysfn_centermouse:      ; 18.15 = mouse centered
2312
        mov     eax, [_display.width]
2312
        mov     eax, [_display.width]
Line 2315... Line 2315...
2315
        mov     eax, [_display.height]
2315
        mov     eax, [_display.height]
2316
        shr     eax, 1
2316
        shr     eax, 1
2317
        mov     [MOUSE_Y], ax
2317
        mov     [MOUSE_Y], ax
2318
        call    wakeup_osloop
2318
        call    wakeup_osloop
2319
        xor     eax, eax
2319
        xor     eax, eax
2320
        and     [esp + SYSCALL_STACK._eax], eax
2320
        and     [esp + SYSCALL_STACK.eax], eax
2321
        ret
2321
        ret
2322
;------------------------------------------------------------------------------
2322
;------------------------------------------------------------------------------
2323
sysfn_mouse_acceleration:       ; 18.19 = set/get mouse features
2323
sysfn_mouse_acceleration:       ; 18.19 = set/get mouse features
2324
        cmp     ecx, 8
2324
        cmp     ecx, 8
2325
        jnc     @f
2325
        jnc     @f
2326
        jmp     dword [.table + ecx*4]
2326
        jmp     dword [.table + ecx*4]
2327
.get_mouse_acceleration:
2327
.get_mouse_acceleration:
2328
        xor     eax, eax
2328
        xor     eax, eax
2329
        mov     ax, [mouse_speed_factor]
2329
        mov     ax, [mouse_speed_factor]
2330
        mov     [esp + SYSCALL_STACK._eax], eax
2330
        mov     [esp + SYSCALL_STACK.eax], eax
2331
        ret
2331
        ret
2332
.set_mouse_acceleration:
2332
.set_mouse_acceleration:
2333
        mov     [mouse_speed_factor], dx
2333
        mov     [mouse_speed_factor], dx
2334
        ret
2334
        ret
2335
.get_mouse_delay:
2335
.get_mouse_delay:
2336
        xor     eax, eax
2336
        xor     eax, eax
2337
        mov     al, [mouse_delay]
2337
        mov     al, [mouse_delay]
2338
        mov     [esp + SYSCALL_STACK._eax], eax
2338
        mov     [esp + SYSCALL_STACK.eax], eax
2339
        ret
2339
        ret
2340
.set_mouse_delay:
2340
.set_mouse_delay:
2341
        mov     [mouse_delay], dl
2341
        mov     [mouse_delay], dl
2342
@@:
2342
@@:
2343
        ret
2343
        ret
Line 2355... Line 2355...
2355
        mov     [mouse_active], 1
2355
        mov     [mouse_active], 1
2356
        jmp     wakeup_osloop
2356
        jmp     wakeup_osloop
2357
.get_doubleclick_delay:
2357
.get_doubleclick_delay:
2358
        xor     eax, eax
2358
        xor     eax, eax
2359
        mov     al, [mouse_doubleclick_delay]
2359
        mov     al, [mouse_doubleclick_delay]
2360
        mov     [esp + SYSCALL_STACK._eax], eax
2360
        mov     [esp + SYSCALL_STACK.eax], eax
2361
        ret
2361
        ret
2362
.set_doubleclick_delay:
2362
.set_doubleclick_delay:
2363
        mov     [mouse_doubleclick_delay], dl
2363
        mov     [mouse_doubleclick_delay], dl
2364
        ret
2364
        ret
2365
align 4
2365
align 4
Line 2374... Line 2374...
2374
dd      .set_doubleclick_delay
2374
dd      .set_doubleclick_delay
2375
;------------------------------------------------------------------------------
2375
;------------------------------------------------------------------------------
2376
sysfn_getfreemem:
2376
sysfn_getfreemem:
2377
        mov     eax, [pg_data.pages_free]
2377
        mov     eax, [pg_data.pages_free]
2378
        shl     eax, 2
2378
        shl     eax, 2
2379
        mov     [esp + SYSCALL_STACK._eax], eax
2379
        mov     [esp + SYSCALL_STACK.eax], eax
2380
        ret
2380
        ret
2381
;------------------------------------------------------------------------------
2381
;------------------------------------------------------------------------------
2382
sysfn_getallmem:
2382
sysfn_getallmem:
2383
        mov     eax, [MEM_AMOUNT]
2383
        mov     eax, [MEM_AMOUNT]
2384
        shr     eax, 10
2384
        shr     eax, 10
2385
        mov     [esp + SYSCALL_STACK._eax], eax
2385
        mov     [esp + SYSCALL_STACK.eax], eax
2386
        ret
2386
        ret
2387
;------------------------------------------------------------------------------
2387
;------------------------------------------------------------------------------
2388
sysfn_pid_to_slot:
2388
sysfn_pid_to_slot:
2389
        mov     eax, ecx
2389
        mov     eax, ecx
2390
        call    pid_to_slot
2390
        call    pid_to_slot
2391
        mov     [esp + SYSCALL_STACK._eax], eax
2391
        mov     [esp + SYSCALL_STACK.eax], eax
2392
        ret
2392
        ret
2393
;------------------------------------------------------------------------------
2393
;------------------------------------------------------------------------------
2394
sysfn_min_rest_window:
2394
sysfn_min_rest_window:
2395
        pushad
2395
        pushad
2396
        mov     eax, edx ; ebx - operating
2396
        mov     eax, edx ; ebx - operating
Line 2411... Line 2411...
2411
.restore:
2411
.restore:
2412
        call    restore_minimized_window
2412
        call    restore_minimized_window
2413
.exit:
2413
.exit:
2414
        popad
2414
        popad
2415
        xor     eax, eax
2415
        xor     eax, eax
2416
        mov     [esp + SYSCALL_STACK._eax], eax
2416
        mov     [esp + SYSCALL_STACK.eax], eax
2417
        ret
2417
        ret
2418
.error:
2418
.error:
2419
        popad
2419
        popad
2420
        xor     eax, eax
2420
        xor     eax, eax
2421
        dec     eax
2421
        dec     eax
2422
        mov     [esp + SYSCALL_STACK._eax], eax
2422
        mov     [esp + SYSCALL_STACK.eax], eax
2423
        ret
2423
        ret
2424
;------------------------------------------------------------------------------
2424
;------------------------------------------------------------------------------
2425
sysfn_min_windows:
2425
sysfn_min_windows:
2426
        call    minimize_all_window
2426
        call    minimize_all_window
2427
        mov     [esp + SYSCALL_STACK._eax], eax
2427
        mov     [esp + SYSCALL_STACK.eax], eax
2428
        call    change_task
2428
        call    change_task
2429
        ret
2429
        ret
2430
;------------------------------------------------------------------------------
2430
;------------------------------------------------------------------------------
2431
sysfn_set_screen_sizes:
2431
sysfn_set_screen_sizes:
2432
        cmp     [SCR_MODE], word 0x13
2432
        cmp     [SCR_MODE], word 0x13
Line 2485... Line 2485...
2485
        cmp     ebx, 1
2485
        cmp     ebx, 1
2486
        jb      .no_floppy_save
2486
        jb      .no_floppy_save
2487
        cmp     ebx, 2
2487
        cmp     ebx, 2
2488
        ja      .no_floppy_save
2488
        ja      .no_floppy_save
2489
        call    save_image
2489
        call    save_image
2490
        mov     [esp + SYSCALL_STACK._eax], eax
2490
        mov     [esp + SYSCALL_STACK.eax], eax
2491
        ret
2491
        ret
2492
.no_floppy_save:
2492
.no_floppy_save:
2493
        mov     [esp + SYSCALL_STACK._eax], dword 1
2493
        mov     [esp + SYSCALL_STACK.eax], dword 1
2494
        ret
2494
        ret
2495
;------------------------------------------------------------------------------
2495
;------------------------------------------------------------------------------
Line 2496... Line 2496...
2496
 
2496
 
2497
align 4
2497
align 4
Line 2522... Line 2522...
2522
        call    memmove
2522
        call    memmove
2523
        pop     eax
2523
        pop     eax
2524
;--------------------------------------
2524
;--------------------------------------
2525
align 4
2525
align 4
2526
.ret_eax:
2526
.ret_eax:
2527
        mov     [esp + SYSCALL_STACK._eax], eax
2527
        mov     [esp + SYSCALL_STACK.eax], eax
2528
        ret
2528
        ret
2529
;--------------------------------------
2529
;--------------------------------------
2530
align 4
2530
align 4
2531
.finish:
2531
.finish:
2532
; test hotkeys buffer
2532
; test hotkeys buffer
Line 2552... Line 2552...
2552
        jmp     .ret_eax
2552
        jmp     .ret_eax
2553
;------------------------------------------------------------------------------
2553
;------------------------------------------------------------------------------
2554
align 4
2554
align 4
2555
sys_getbutton:
2555
sys_getbutton:
2556
        mov     ebx, [current_slot_idx]                         ; TOP OF WINDOW STACK
2556
        mov     ebx, [current_slot_idx]                         ; TOP OF WINDOW STACK
2557
        mov     [esp + SYSCALL_STACK._eax], dword 1
2557
        mov     [esp + SYSCALL_STACK.eax], dword 1
2558
        movzx   ecx, word [WIN_STACK + ebx * 2]
2558
        movzx   ecx, word [WIN_STACK + ebx * 2]
2559
        mov     edx, [thread_count] ; less than 256 processes
2559
        mov     edx, [thread_count] ; less than 256 processes
2560
        cmp     ecx, edx
2560
        cmp     ecx, edx
2561
        jne     .exit
2561
        jne     .exit
2562
        movzx   eax, byte [BTN_COUNT]
2562
        movzx   eax, byte [BTN_COUNT]
2563
        test    eax, eax
2563
        test    eax, eax
2564
        jz      .exit
2564
        jz      .exit
2565
        mov     eax, [BTN_BUFF]
2565
        mov     eax, [BTN_BUFF]
2566
        and     al, 0xFE                                    ; delete left button bit
2566
        and     al, 0xFE                                    ; delete left button bit
2567
        mov     [BTN_COUNT], byte 0
2567
        mov     [BTN_COUNT], byte 0
2568
        mov     [esp + SYSCALL_STACK._eax], eax
2568
        mov     [esp + SYSCALL_STACK.eax], eax
2569
;--------------------------------------
2569
;--------------------------------------
2570
align 4
2570
align 4
2571
.exit:
2571
.exit:
2572
        ret
2572
        ret
2573
;------------------------------------------------------------------------------
2573
;------------------------------------------------------------------------------
Line 2674... Line 2674...
2674
 
2674
 
2675
.nofillbuf:
2675
.nofillbuf:
Line 2676... Line 2676...
2676
    ; return number of processes
2676
    ; return number of processes
2677
 
2677
 
2678
        mov     eax, [thread_count]
2678
        mov     eax, [thread_count]
Line 2679... Line 2679...
2679
        mov     [esp + SYSCALL_STACK._eax], eax
2679
        mov     [esp + SYSCALL_STACK.eax], eax
2680
        ret
2680
        ret
2681
 
2681
 
Line 2682... Line 2682...
2682
.addr_error:    ; if given memory address is illegal
2682
.addr_error:    ; if given memory address is illegal
2683
        mov     dword [esp + SYSCALL_STACK._eax], -1
2683
        mov     dword [esp + SYSCALL_STACK.eax], -1
Line 2772... Line 2772...
2772
;rewritten by   29.12.2009
2772
;rewritten by   29.12.2009
2773
        jmp     dword [sheduler + ebx*4]
2773
        jmp     dword [sheduler + ebx*4]
2774
;.shed_counter:
2774
;.shed_counter:
2775
.00:
2775
.00:
2776
        mov     eax, [context_counter]
2776
        mov     eax, [context_counter]
2777
        mov     [esp + SYSCALL_STACK._eax], eax
2777
        mov     [esp + SYSCALL_STACK.eax], eax
2778
        ret
2778
        ret
Line 2779... Line 2779...
2779
 
2779
 
2780
.02:
2780
.02:
2781
;.perf_control:
2781
;.perf_control:
Line 2802... Line 2802...
2802
;now counter in ecx
2802
;now counter in ecx
2803
;(edx:eax) esi:edi => edx:esi
2803
;(edx:eax) esi:edi => edx:esi
2804
        mov     eax, esi
2804
        mov     eax, esi
2805
        mov     ecx, edx
2805
        mov     ecx, edx
2806
        rdmsr
2806
        rdmsr
2807
        mov     [esp + SYSCALL_STACK._eax], eax
2807
        mov     [esp + SYSCALL_STACK.eax], eax
2808
        mov     [esp + SYSCALL_STACK._ebx], edx           ;ret in ebx?
2808
        mov     [esp + SYSCALL_STACK.ebx], edx           ;ret in ebx?
2809
        ret
2809
        ret
Line 2810... Line 2810...
2810
 
2810
 
2811
.04:
2811
.04:
2812
;.wrmsr_instr:
2812
;.wrmsr_instr:
Line 2832... Line 2832...
2832
@@:
2832
@@:
2833
        ret
2833
        ret
Line 2834... Line 2834...
2834
 
2834
 
2835
cache_disable:
2835
cache_disable:
2836
        mov     eax, cr0
2836
        mov     eax, cr0
2837
        or      eax, 01100000000000000000000000000000b
2837
        or      eax, 01100000_00000000_00000000_00000000b
2838
        mov     cr0, eax
2838
        mov     cr0, eax
2839
        wbinvd  ;set MESI
2839
        wbinvd  ;set MESI
Line 2840... Line 2840...
2840
        ret
2840
        ret
2841
 
2841
 
2842
cache_enable:
2842
cache_enable:
2843
        mov     eax, cr0
2843
        mov     eax, cr0
2844
        and     eax, 10011111111111111111111111111111b
2844
        and     eax, 10011111_11111111_11111111_11111111b
Line 2845... Line 2845...
2845
        mov     cr0, eax
2845
        mov     cr0, eax
2846
        ret
2846
        ret
2847
 
2847
 
2848
is_cache_enabled:
2848
is_cache_enabled:
2849
        mov     eax, cr0
2849
        mov     eax, cr0
2850
        mov     ebx, eax
2850
        mov     ebx, eax
2851
        and     eax, 01100000000000000000000000000000b
2851
        and     eax, 01100000_00000000_00000000_00000000b
2852
        jz      cache_disabled
2852
        jz      cache_disabled
2853
        mov     [esp + SYSCALL_STACK._eax], ebx
2853
        mov     [esp + SYSCALL_STACK.eax], ebx
Line 2854... Line 2854...
2854
cache_disabled:
2854
cache_disabled:
2855
        mov     dword [esp + SYSCALL_STACK._eax], eax;0
2855
        mov     dword [esp + SYSCALL_STACK.eax], eax;0
2856
        ret
2856
        ret
2857
 
2857
 
2858
modify_pce:
2858
modify_pce:
2859
        mov     eax, cr4
2859
        mov     eax, cr4
2860
;       mov ebx,0
2860
;       mov ebx,0
2861
;       or  bx,100000000b ;pce
2861
;       or  bx,100000000b ;pce
2862
;       xor eax,ebx ;invert pce
2862
;       xor eax,ebx ;invert pce
2863
        bts     eax, 8;pce=cr4[8]
2863
        bts     eax, 8;pce=cr4[8]
Line 2864... Line 2864...
2864
        mov     cr4, eax
2864
        mov     cr4, eax
Line 3375... Line 3375...
3375
;-----------------------------------------------------------------------------
3375
;-----------------------------------------------------------------------------
3376
align 4
3376
align 4
3377
set_app_param:
3377
set_app_param:
3378
        mov     edi, [current_slot]
3378
        mov     edi, [current_slot]
3379
        xchg    ebx, [edi + APPDATA.event_mask] ; set new event mask
3379
        xchg    ebx, [edi + APPDATA.event_mask] ; set new event mask
3380
        mov     [esp + SYSCALL_STACK._eax], ebx                    ; return old mask value
3380
        mov     [esp + SYSCALL_STACK.eax], ebx                    ; return old mask value
3381
        ret
3381
        ret
3382
;-----------------------------------------------------------------------------
3382
;-----------------------------------------------------------------------------
Line 3383... Line 3383...
3383
 
3383
 
3384
; this is for syscall
3384
; this is for syscall
Line 3509... Line 3509...
3509
; @param eax 46 - number function
3509
; @param eax 46 - number function
3510
; @returns  eax = 0 - succesful eax = 1 - error
3510
; @returns  eax = 0 - succesful eax = 1 - error
3511
syscall_reserveportarea:        ; ReservePortArea and FreePortArea
3511
syscall_reserveportarea:        ; ReservePortArea and FreePortArea
Line 3512... Line 3512...
3512
 
3512
 
3513
        call    r_f_port_area
3513
        call    r_f_port_area
3514
        mov     [esp + SYSCALL_STACK._eax], eax
3514
        mov     [esp + SYSCALL_STACK.eax], eax
Line 3515... Line 3515...
3515
        ret
3515
        ret
3516
 
3516
 
3517
;reserve/free group of ports
3517
;reserve/free group of ports
Line 4225... Line 4225...
4225
.ret:
4225
.ret:
4226
        pop     ebx eax
4226
        pop     ebx eax
4227
        ret
4227
        ret
Line 4228... Line 4228...
4228
 
4228
 
4229
@@:
4229
@@:
4230
        mov     [esp + SYSCALL_STACK._eax], ecx
4230
        mov     [esp + SYSCALL_STACK.eax], ecx
4231
        mov     [esp+20], ecx
4231
        mov     [esp+20], ecx
Line 4232... Line 4232...
4232
        jmp     .ret
4232
        jmp     .ret
4233
 
4233
 
Line 4240... Line 4240...
4240
        mov     eax, msg_board_data+1
4240
        mov     eax, msg_board_data+1
4241
        mov     ebx, msg_board_data
4241
        mov     ebx, msg_board_data
4242
        movzx   edx, byte [ebx]
4242
        movzx   edx, byte [ebx]
4243
        call    memmove
4243
        call    memmove
4244
        dec     [msg_board_count]
4244
        dec     [msg_board_count]
4245
        mov     [esp + SYSCALL_STACK._eax], edx ;eax
4245
        mov     [esp + SYSCALL_STACK.eax], edx ;eax
4246
        mov     [esp + 20], dword 1
4246
        mov     [esp + 20], dword 1
4247
        ret
4247
        ret
Line 4248... Line 4248...
4248
 
4248
 
4249
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4249
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 4271... Line 4271...
4271
 
4271
 
4272
        mov     edi, [current_slot]
4272
        mov     edi, [current_slot]
Line 4273... Line 4273...
4273
        jmp     dword [f66call + ebx*4]
4273
        jmp     dword [f66call + ebx*4]
4274
 
4274
 
4275
.not_support:
4275
.not_support:
4276
        or      [esp + SYSCALL_STACK._eax], -1
4276
        or      [esp + SYSCALL_STACK.eax], -1
4277
        ret
4277
        ret
4278
;-----------------------------------------------------------------------------
4278
;-----------------------------------------------------------------------------
4279
align 4
4279
align 4
4280
.1:
4280
.1:
4281
        mov     [edi + APPDATA.keyboard_mode], cl
4281
        mov     [edi + APPDATA.keyboard_mode], cl
4282
        ret
4282
        ret
4283
;-----------------------------------------------------------------------------
4283
;-----------------------------------------------------------------------------
4284
align 4
4284
align 4
4285
.2:                             ; 2 = get keyboard mode
4285
.2:                             ; 2 = get keyboard mode
4286
        movzx   eax, byte [edi + APPDATA.keyboard_mode]
4286
        movzx   eax, byte [edi + APPDATA.keyboard_mode]
4287
        mov     [esp + SYSCALL_STACK._eax], eax
4287
        mov     [esp + SYSCALL_STACK.eax], eax
4288
        ret
4288
        ret
4289
;-----------------------------------------------------------------------------
4289
;-----------------------------------------------------------------------------
4290
align 4
4290
align 4
4291
.3:                             ;3 = get keyboard ctrl, alt, shift
4291
.3:                             ;3 = get keyboard ctrl, alt, shift
4292
        mov     eax, [kb_state]
4292
        mov     eax, [kb_state]
4293
        mov     [esp + SYSCALL_STACK._eax], eax
4293
        mov     [esp + SYSCALL_STACK.eax], eax
4294
        ret
4294
        ret
4295
;-----------------------------------------------------------------------------
4295
;-----------------------------------------------------------------------------
4296
align 4
4296
align 4
Line 4301... Line 4301...
4301
        cmp     dword [eax + 8], 0
4301
        cmp     dword [eax + 8], 0
4302
        jz      .found_free
4302
        jz      .found_free
4303
        add     eax, 16
4303
        add     eax, 16
4304
        cmp     eax, hotkey_list+16*256
4304
        cmp     eax, hotkey_list+16*256
4305
        jb      @b
4305
        jb      @b
4306
        mov     dword [esp + SYSCALL_STACK._eax], 1
4306
        mov     dword [esp + SYSCALL_STACK.eax], 1
4307
        ret
4307
        ret
4308
.found_free:
4308
.found_free:
4309
        mov     [eax + 8], edi
4309
        mov     [eax + 8], edi
4310
        mov     [eax + 4], edx
4310
        mov     [eax + 4], edx
4311
        movzx   ecx, cl
4311
        movzx   ecx, cl
Line 4316... Line 4316...
4316
        mov     [eax + 12], ecx
4316
        mov     [eax + 12], ecx
4317
        test    edx, edx
4317
        test    edx, edx
4318
        jz      @f
4318
        jz      @f
4319
        mov     [edx + 12], eax
4319
        mov     [edx + 12], eax
4320
@@:
4320
@@:
4321
        and     dword [esp + SYSCALL_STACK._eax], 0
4321
        and     dword [esp + SYSCALL_STACK.eax], 0
4322
        ret
4322
        ret
4323
;-----------------------------------------------------------------------------
4323
;-----------------------------------------------------------------------------
4324
align 4
4324
align 4
4325
.5:
4325
.5:
4326
        mov     edi, [current_slot_idx]
4326
        mov     edi, [current_slot_idx]
Line 4336... Line 4336...
4336
        jz      .found
4336
        jz      .found
4337
.next:
4337
.next:
4338
        mov     eax, [eax]
4338
        mov     eax, [eax]
4339
        jmp     .scan
4339
        jmp     .scan
4340
.notfound:
4340
.notfound:
4341
        mov     dword [esp + SYSCALL_STACK._eax], 1
4341
        mov     dword [esp + SYSCALL_STACK.eax], 1
4342
        ret
4342
        ret
4343
.found:
4343
.found:
4344
        mov     ecx, [eax]
4344
        mov     ecx, [eax]
4345
        jecxz   @f
4345
        jecxz   @f
4346
        mov     edx, [eax + 12]
4346
        mov     edx, [eax + 12]
Line 4352... Line 4352...
4352
        xor     edx, edx
4352
        xor     edx, edx
4353
        mov     [eax + 4], edx
4353
        mov     [eax + 4], edx
4354
        mov     [eax + 8], edx
4354
        mov     [eax + 8], edx
4355
        mov     [eax + 12], edx
4355
        mov     [eax + 12], edx
4356
        mov     [eax], edx
4356
        mov     [eax], edx
4357
        mov     [esp + SYSCALL_STACK._eax], edx
4357
        mov     [esp + SYSCALL_STACK.eax], edx
4358
        ret
4358
        ret
4359
;-----------------------------------------------------------------------------
4359
;-----------------------------------------------------------------------------
4360
align 4
4360
align 4
4361
.6:
4361
.6:
4362
        pushfd
4362
        pushfd
Line 4413... Line 4413...
4413
        dec     ebx
4413
        dec     ebx
4414
        cmp     ebx, 2
4414
        cmp     ebx, 2
4415
        ja      .not_support
4415
        ja      .not_support
4416
        jmp     dword [f61call + ebx*4]
4416
        jmp     dword [f61call + ebx*4]
4417
.not_support:
4417
.not_support:
4418
        or      [esp + SYSCALL_STACK._eax], dword -1
4418
        or      [esp + SYSCALL_STACK.eax], dword -1
4419
        ret
4419
        ret
Line 4420... Line 4420...
4420
 
4420
 
4421
 
4421
 
4422
.1:                             ; resolution
4422
.1:                             ; resolution
4423
        mov     eax, [_display.width]
4423
        mov     eax, [_display.width]
4424
        shl     eax, 16
4424
        shl     eax, 16
4425
        mov     ax, word [_display.height]
4425
        mov     ax, word [_display.height]
4426
        mov     [esp + SYSCALL_STACK._eax], eax
4426
        mov     [esp + SYSCALL_STACK.eax], eax
4427
        ret
4427
        ret
4428
.2:                             ; bits per pixel
4428
.2:                             ; bits per pixel
4429
        mov     eax, [_display.bits_per_pixel]
4429
        mov     eax, [_display.bits_per_pixel]
4430
        mov     [esp + SYSCALL_STACK._eax], eax
4430
        mov     [esp + SYSCALL_STACK.eax], eax
4431
        ret
4431
        ret
4432
.3:                             ; bytes per scanline
4432
.3:                             ; bytes per scanline
4433
        mov     eax, [_display.lfb_pitch]
4433
        mov     eax, [_display.lfb_pitch]
Line 4434... Line 4434...
4434
        mov     [esp + SYSCALL_STACK._eax], eax
4434
        mov     [esp + SYSCALL_STACK.eax], eax
4435
        ret
4435
        ret
4436
 
4436
 
4437
align 4
4437
align 4
4438
syscall_getscreensize:                  ; GetScreenSize
4438
syscall_getscreensize:                  ; GetScreenSize
4439
        mov     ax, word [_display.width]
4439
        mov     ax, word [_display.width]
4440
        dec     ax
4440
        dec     ax
4441
        shl     eax, 16
4441
        shl     eax, 16
4442
        mov     ax, word [_display.height]
4442
        mov     ax, word [_display.height]
4443
        dec     ax
4443
        dec     ax
4444
        mov     [esp + SYSCALL_STACK._eax], eax
4444
        mov     [esp + SYSCALL_STACK.eax], eax
4445
        ret
4445
        ret
4446
;-----------------------------------------------------------------------------
4446
;-----------------------------------------------------------------------------
Line 4529... Line 4529...
4529
        add     eax, [_display.win_map]
4529
        add     eax, [_display.win_map]
4530
        movzx   eax, byte[eax+ebx]        ; get value for current point
4530
        movzx   eax, byte[eax+ebx]        ; get value for current point
4531
;--------------------------------------
4531
;--------------------------------------
4532
align 4
4532
align 4
4533
.store:
4533
.store:
4534
        mov     [esp + SYSCALL_STACK._eax], eax
4534
        mov     [esp + SYSCALL_STACK.eax], eax
4535
        ret
4535
        ret
4536
;-----------------------------------------------------------------------------
4536
;-----------------------------------------------------------------------------
4537
align 4
4537
align 4
4538
syscall_getpixel:                       ; GetPixel
4538
syscall_getpixel:                       ; GetPixel
4539
        mov     ecx, [_display.width]
4539
        mov     ecx, [_display.width]
Line 4542... Line 4542...
4542
        div     ecx
4542
        div     ecx
4543
        mov     ebx, edx
4543
        mov     ebx, edx
4544
        xchg    eax, ebx
4544
        xchg    eax, ebx
4545
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 use mouseunder area
4545
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 use mouseunder area
4546
        call    dword [GETPIXEL]; eax - x, ebx - y
4546
        call    dword [GETPIXEL]; eax - x, ebx - y
4547
        mov     [esp + SYSCALL_STACK._eax], ecx
4547
        mov     [esp + SYSCALL_STACK.eax], ecx
4548
        ret
4548
        ret
4549
;-----------------------------------------------------------------------------
4549
;-----------------------------------------------------------------------------
4550
align 4
4550
align 4
4551
syscall_getarea:
4551
syscall_getarea:
4552
;eax = 36
4552
;eax = 36
Line 4628... Line 4628...
4628
;
4628
;
4629
; on return : eax = pid
4629
; on return : eax = pid
4630
        xor     ebx, ebx
4630
        xor     ebx, ebx
4631
        call    new_sys_threads
4631
        call    new_sys_threads
Line 4632... Line 4632...
4632
 
4632
 
4633
        mov     [esp + SYSCALL_STACK._eax], eax
4633
        mov     [esp + SYSCALL_STACK.eax], eax
Line 4634... Line 4634...
4634
        ret
4634
        ret
4635
 
4635
 
4636
;------------------------------------------------------------------------------
4636
;------------------------------------------------------------------------------
Line 4786... Line 4786...
4786
        ret
4786
        ret
4787
; -----------------------------------------
4787
; -----------------------------------------
Line 4788... Line 4788...
4788
 
4788
 
4789
align 4
4789
align 4
4790
undefined_syscall:                      ; Undefined system call
4790
undefined_syscall:                      ; Undefined system call
4791
        mov     [esp + SYSCALL_STACK._eax], dword -1
4791
        mov     [esp + SYSCALL_STACK.eax], dword -1
Line 4792... Line 4792...
4792
        ret
4792
        ret
4793
 
4793
 
4794
align 4
4794
align 4