From 62da2ad490b55b75c74b9d72cbadff1f9d9abe91 Mon Sep 17 00:00:00 2001 From: "Andrey Halyavin (halyavin)" Date: Wed, 14 Jun 2006 07:42:59 +0000 Subject: [PATCH] Function 18/18 added. It terminate process by PID (instead of slot as in function 18/2). git-svn-id: svn://kolibrios.org@85 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/docs/sysfuncr.txt | 14 ++++++++++++++ kernel/trunk/kernel.asm | 28 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/kernel/trunk/docs/sysfuncr.txt b/kernel/trunk/docs/sysfuncr.txt index 643e709f29..30688f75f7 100644 --- a/kernel/trunk/docs/sysfuncr.txt +++ b/kernel/trunk/docs/sysfuncr.txt @@ -928,6 +928,20 @@ db 'Kolibri',0 Возвращаемое значение: * eax = общий размер имеющейся памяти в килобайтах +====================================================================== +====================== Функция 18б подфункция 18 ===================== +===================== Завершение процесса по PID'у =================== +====================================================================== +Параметры: + * eax = 18 - номер функции + * ebx = 18 - номер подфункции + * ecx = PID +Возращаемое значение: + * eax = 0 - процесс завершен. + * eax = -1 - ошибка. (процесс с таким PID не существует или является + системным) + + ====================================================================== ============ Функция 19 - запустить программу с рамдиска. ============ ====================================================================== diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 5787fb2555..0c8a4691d3 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -2103,6 +2103,7 @@ sys_system_table: dd sysfn_centermouse ; 15 = center mouse cursor dd sysfn_getfreemem ; 16 = get free memory size dd sysfn_getallmem ; 17 = get total memory size + dd sysfn_terminate2 ; 18 = terminate thread using PID instead of slot sysfn_num = ($ - sys_system_table)/4 endg @@ -2151,6 +2152,33 @@ sysfn_terminate: ; 18.2 = TERMINATE noprocessterminate: ret +sysfn_terminate2: +;lock application_table_status mutex +.table_status: + cli + cmp [application_table_status],0 + je .stf + sti + call change_task + jmp .table_status +.stf: + call set_application_table_status + mov eax,ebx + call pid_to_slot + test eax,eax + jz .not_found + mov ebx,eax + cli + call sysfn_terminate + mov [application_table_status],0 + sti + and dword [esp+36],0 + ret +.not_found: + mov [application_table_status],0 + or dword [esp+36],-1 + ret + sysfn_activate: ; 18.3 = ACTIVATE WINDOW cmp ebx,2 jb nowindowactivate