Subversion Repositories Kolibri OS

Rev

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

Rev 9964 Rev 9967
Line 27... Line 27...
27
format binary as "mnt"
27
format binary as "mnt"
Line 28... Line 28...
28
 
28
 
29
include 'macros.inc'
29
include 'macros.inc'
Line 30... Line 30...
30
include 'struct.inc'
30
include 'struct.inc'
Line 31... Line 31...
31
 
31
 
32
$Revision: 9964 $
32
$Revision: 9967 $
Line 2410... Line 2410...
2410
        ret
2410
        ret
2411
;------------------------------------------------------------------------------
2411
;------------------------------------------------------------------------------
2412
align 4
2412
align 4
2413
sys_cpuusage:
2413
sys_cpuusage:
Line 2414... Line -...
2414
 
-
 
2415
;  RETURN:
-
 
2416
;
-
 
2417
;  +00 dword     process cpu usage
-
 
2418
;  +04  word     position in windowing stack
-
 
2419
;  +06  word     windowing stack value at current position (cpu nro)
-
 
2420
;  +10 12 bytes  name
-
 
2421
;  +22 dword     start in mem
-
 
2422
;  +26 dword     used mem
2414
 
2423
;  +30 dword     PID , process idenfification number
2415
;  RETURN: process_information structure
2424
;
2416
;
2425
        ; if given memory address belongs to kernel then error
2417
        ; if given memory address belongs to kernel then error
2426
        stdcall is_region_userspace, ebx, 0x4C
2418
        stdcall is_region_userspace, ebx, sizeof.process_information
Line 2427... Line 2419...
2427
        jnz     .addr_error
2419
        jnz     .addr_error
2428
 
2420
 
2429
        cmp     ecx, -1 ; who am I ?
2421
        cmp     ecx, -1 ; who am I ?
Line 2435... Line 2427...
2435
        test    ecx, ecx        ; slot 0 is empty, kernel threads start from 1
2427
        test    ecx, ecx        ; slot 0 is empty, kernel threads start from 1
2436
        jz      .nofillbuf
2428
        jz      .nofillbuf
Line 2437... Line 2429...
2437
 
2429
 
2438
; +4: word: position of the window of thread in the window stack
2430
; +4: word: position of the window of thread in the window stack
2439
        mov     ax, [WIN_STACK + ecx * 2]
2431
        mov     ax, [WIN_STACK + ecx * 2]
2440
        mov     [ebx+4], ax
2432
        mov     [ebx+process_information.window_stack_position], ax
2441
; +6: word: number of the thread slot, which window has in the window stack
2433
; +6: word: number of the thread slot, which window has in the window stack
2442
;           position ecx (has no relation to the specific thread)
2434
;           position ecx (has no relation to the specific thread)
2443
        mov     ax, [WIN_POS + ecx * 2]
2435
        mov     ax, [WIN_POS + ecx * 2]
Line 2444... Line 2436...
2444
        mov     [ebx+6], ax
2436
        mov     [ebx+process_information.window_stack_value], ax
Line 2445... Line 2437...
2445
 
2437
 
2446
        shl     ecx, BSF sizeof.APPDATA
2438
        shl     ecx, BSF sizeof.APPDATA
2447
 
2439
 
2448
; +0: dword: memory usage
2440
; +0: dword: memory usage
2449
        mov     eax, [SLOT_BASE + ecx + APPDATA.cpu_usage]
2441
        mov     eax, [SLOT_BASE + ecx + APPDATA.cpu_usage]
2450
        mov     [ebx], eax
2442
        mov     [ebx+process_information.cpu_usage], eax
2451
; +10: 11 bytes: name of the process
2443
; +10: 11 bytes: name of the process
2452
        push    ecx
2444
        push    ecx
2453
        lea     eax, [SLOT_BASE + ecx + APPDATA.app_name]
2445
        lea     eax, [SLOT_BASE + ecx + APPDATA.app_name]
2454
        add     ebx, 10
2446
        add     ebx, process_information.process_name
Line 2455... Line 2447...
2455
        mov     ecx, 11
2447
        mov     ecx, 11