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:
Ivan Baravy 2024-01-15 05:16:31 +00:00
parent e9719d21a3
commit 7b51a89852
2 changed files with 22 additions and 14 deletions

View File

@ -485,6 +485,22 @@ struct BOX
height dd ?
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
app_name rb 11
rb 5

View File

@ -2412,18 +2412,10 @@ sys_cachetodiskette:
align 4
sys_cpuusage:
; RETURN:
;
; +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
; RETURN: process_information structure
;
; 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
cmp ecx, -1 ; who am I ?
@ -2437,21 +2429,21 @@ sys_cpuusage:
; +4: word: position of the window of thread in the window stack
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
; position ecx (has no relation to the specific thread)
mov ax, [WIN_POS + ecx * 2]
mov [ebx+6], ax
mov [ebx+process_information.window_stack_value], ax
shl ecx, BSF sizeof.APPDATA
; +0: dword: memory 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
push ecx
lea eax, [SLOT_BASE + ecx + APPDATA.app_name]
add ebx, 10
add ebx, process_information.process_name
mov ecx, 11
call memmove
pop ecx