From 3d6209fb3761e69444382aa9b5f8c300253a159d Mon Sep 17 00:00:00 2001 From: Doczom Date: Fri, 7 Jan 2022 23:03:51 +0000 Subject: [PATCH] fix cpu_usage git-svn-id: svn://kolibrios.org@9591 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/sched.inc | 11 ++++++----- kernel/trunk/kernel.asm | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/kernel/trunk/core/sched.inc b/kernel/trunk/core/sched.inc index 6f119e9c4c..6d78b7ebe9 100644 --- a/kernel/trunk/core/sched.inc +++ b/kernel/trunk/core/sched.inc @@ -76,15 +76,16 @@ update_counters: align 4 updatecputimes: mov ecx, [thread_count] - ;mov edi, TASK_DATA - mov edi, SLOT_BASE + mov edi, TASK_DATA + ;mov dword[edi+TASKDATA.cpu_usage], 0 + mov esi, SLOT_BASE .newupdate: xor eax, eax xchg eax, [edi+TASKDATA.counter_sum] ;mov [edi+TASKDATA.cpu_usage], eax - ;add edi, 0x20 - mov [edi+APPDATA.cpu_usage], eax - add edi, 0x100 ;sizeof.APPDATA + add edi, 0x20 + mov [esi+APPDATA.cpu_usage], eax + add esi, 0x100 ;sizeof.APPDATA loop .newupdate ret diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index b4d16b3c0e..6788db4488 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -2629,12 +2629,13 @@ sys_cpuusage: mov [ebx], eax ; +10: 11 bytes: name of the process push ecx - lea eax, [ecx*8+SLOT_BASE+APPDATA.app_name] + lea eax, [ecx+SLOT_BASE+APPDATA.app_name] add ebx, 10 mov ecx, 11 call memmove pop ecx + shr ecx, 3 ; +22: address of the process in memory ; +26: size of used memory - 1 push edi