diff --git a/kernel/trunk/docs/sysfuncr.txt b/kernel/trunk/docs/sysfuncr.txt index ac46101ed2..7008695542 100644 --- a/kernel/trunk/docs/sysfuncr.txt +++ b/kernel/trunk/docs/sysfuncr.txt @@ -356,7 +356,7 @@ picture rb Xsize*Ysize*4 ; 32 бита для которого: * окно находится внизу оконного стэка, поля +4 и +6 содержат значение 1 - * имя процесса - "OS/IDLE" (дополненное пробелами) + * имя процесса - "IDLE" (дополненное пробелами) * адрес процесса в памяти равен 0, размер используемой памяти 16 Mb (0x1000000) * PID=1 @@ -366,7 +366,9 @@ picture rb Xsize*Ysize*4 ; 32 бита * время выполнения складывается из времени, уходящего на собственно работу, и времени простоя в ожидании прерывания (которое можно получить вызовом подфункции 4 функции 18). - * Начиная со слота 2, размещаются обычные приложения. + * Слот 2 (и некоторые другие) соответствуют специальным потокам + операционной системы, для которых: + * имя процесса - "OS" (дополненное пробелами) * Обычные приложения размещаются в памяти по адресу 0 (константа ядра std_application_base_address). Наложения не происходит, поскольку у каждого процесса своя diff --git a/kernel/trunk/docs/sysfuncs.txt b/kernel/trunk/docs/sysfuncs.txt index 189567f1ad..118e8573b0 100644 --- a/kernel/trunk/docs/sysfuncs.txt +++ b/kernel/trunk/docs/sysfuncs.txt @@ -344,7 +344,7 @@ Remarks: * Slot 1 corresponds to special system thread, for which: * the window is in the bottom of the window stack, the fields +4 and +6 contain value 1 - * name of the process - "OS/IDLE" (supplemented by spaces) + * name of the process - "IDLE" (supplemented by spaces) * address of the process in memory is 0, size of used memory is 16 Mb (0x1000000) * PID=1 @@ -354,7 +354,8 @@ Remarks: * the execution time adds of time leaving on operations itself and idle time in waiting for interrupt (which can be got by call to subfunction 4 of function 18). - * Beginning from slot 2, the normal applications are placed. + * Slot 2 (and some others) correspond to system threads, for which: + * name of the thread - "OS" (supplemented by spaces) * The normal applications are placed in memory at the address 0 (kernel constant 'std_application_base_address'). There is no intersection, as each process has its own page table. diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 2e092ae666..811717a149 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -2432,6 +2432,8 @@ sys_cpuusage: .no_who_am_i: cmp ecx, max_processes ja .nofillbuf + test ecx, ecx ; slot 0 is empty, kernel threads start from 1 + jz .nofillbuf ; +4: word: position of the window of thread in the window stack mov ax, [WIN_STACK + ecx * 2]