forked from KolibriOS/kolibrios
Use process_information structure in the kernel
Copied from the userspace macros.inc git-svn-id: svn://kolibrios.org@9967 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e9719d21a3
commit
7b51a89852
@ -485,6 +485,22 @@ struct BOX
|
|||||||
height dd ?
|
height dd ?
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
struct process_information
|
||||||
|
cpu_usage dd ? ; +0
|
||||||
|
window_stack_position dw ? ; +4
|
||||||
|
window_stack_value dw ? ; +6
|
||||||
|
dw ? ; +8
|
||||||
|
process_name rb 12 ; +10
|
||||||
|
memory_start dd ? ; +22
|
||||||
|
used_memory dd ? ; +26
|
||||||
|
PID dd ? ; +30
|
||||||
|
box BOX ; +34
|
||||||
|
slot_state dw ? ; +50
|
||||||
|
dw ? ; +52
|
||||||
|
client_box BOX ; +54
|
||||||
|
wnd_state db ? ; +70
|
||||||
|
ends
|
||||||
|
|
||||||
struct APPDATA
|
struct APPDATA
|
||||||
app_name rb 11
|
app_name rb 11
|
||||||
rb 5
|
rb 5
|
||||||
|
@ -2412,18 +2412,10 @@ sys_cachetodiskette:
|
|||||||
align 4
|
align 4
|
||||||
sys_cpuusage:
|
sys_cpuusage:
|
||||||
|
|
||||||
; RETURN:
|
; RETURN: process_information structure
|
||||||
;
|
|
||||||
; +00 dword process cpu usage
|
|
||||||
; +04 word position in windowing stack
|
|
||||||
; +06 word windowing stack value at current position (cpu nro)
|
|
||||||
; +10 12 bytes name
|
|
||||||
; +22 dword start in mem
|
|
||||||
; +26 dword used mem
|
|
||||||
; +30 dword PID , process idenfification number
|
|
||||||
;
|
;
|
||||||
; if given memory address belongs to kernel then error
|
; if given memory address belongs to kernel then error
|
||||||
stdcall is_region_userspace, ebx, 0x4C
|
stdcall is_region_userspace, ebx, sizeof.process_information
|
||||||
jnz .addr_error
|
jnz .addr_error
|
||||||
|
|
||||||
cmp ecx, -1 ; who am I ?
|
cmp ecx, -1 ; who am I ?
|
||||||
@ -2437,21 +2429,21 @@ sys_cpuusage:
|
|||||||
|
|
||||||
; +4: word: position of the window of thread in the window stack
|
; +4: word: position of the window of thread in the window stack
|
||||||
mov ax, [WIN_STACK + ecx * 2]
|
mov ax, [WIN_STACK + ecx * 2]
|
||||||
mov [ebx+4], ax
|
mov [ebx+process_information.window_stack_position], ax
|
||||||
; +6: word: number of the thread slot, which window has in the window stack
|
; +6: word: number of the thread slot, which window has in the window stack
|
||||||
; position ecx (has no relation to the specific thread)
|
; position ecx (has no relation to the specific thread)
|
||||||
mov ax, [WIN_POS + ecx * 2]
|
mov ax, [WIN_POS + ecx * 2]
|
||||||
mov [ebx+6], ax
|
mov [ebx+process_information.window_stack_value], ax
|
||||||
|
|
||||||
shl ecx, BSF sizeof.APPDATA
|
shl ecx, BSF sizeof.APPDATA
|
||||||
|
|
||||||
; +0: dword: memory usage
|
; +0: dword: memory usage
|
||||||
mov eax, [SLOT_BASE + ecx + APPDATA.cpu_usage]
|
mov eax, [SLOT_BASE + ecx + APPDATA.cpu_usage]
|
||||||
mov [ebx], eax
|
mov [ebx+process_information.cpu_usage], eax
|
||||||
; +10: 11 bytes: name of the process
|
; +10: 11 bytes: name of the process
|
||||||
push ecx
|
push ecx
|
||||||
lea eax, [SLOT_BASE + ecx + APPDATA.app_name]
|
lea eax, [SLOT_BASE + ecx + APPDATA.app_name]
|
||||||
add ebx, 10
|
add ebx, process_information.process_name
|
||||||
mov ecx, 11
|
mov ecx, 11
|
||||||
call memmove
|
call memmove
|
||||||
pop ecx
|
pop ecx
|
||||||
|
Loading…
Reference in New Issue
Block a user