diff --git a/kernel/trunk/blkdev/flp_drv.inc b/kernel/trunk/blkdev/flp_drv.inc index 4b9d534b31..2c5c2bd3fe 100644 --- a/kernel/trunk/blkdev/flp_drv.inc +++ b/kernel/trunk/blkdev/flp_drv.inc @@ -14,10 +14,6 @@ $Revision$ ; Source code author - Kulakov Vladimir Gennadievich. ; Adaptation and improvement - Mario79. -;give_back_application_data: ; give back to application -; mov edi,[TASK_BASE] -; mov edi,[edi+TASKDATA.mem_start] -; add edi,ecx give_back_application_data_1: mov esi, FDD_BUFF;FDD_DataBuffer ;0x40000 mov ecx, 128 @@ -25,10 +21,6 @@ give_back_application_data_1: rep movsd ret -;take_data_from_application: ; take from application -; mov esi,[TASK_BASE] -; mov esi,[esi+TASKDATA.mem_start] -; add esi,ecx take_data_from_application_1: mov edi, FDD_BUFF;FDD_DataBuffer ;0x40000 mov ecx, 128 diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index 0ecf8ac7d4..abadd6be23 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -225,17 +225,8 @@ OS_BASE = 0x80000000 window_data = OS_BASE + 0x0001000 background_window = window_data + sizeof.WDATA -;TASK_TABLE = OS_BASE + 0x0003000 -;CURRENT_TASK = OS_BASE + 0x0003000 -;TASK_COUNT = OS_BASE + 0x0003004 -;TASK_BASE = OS_BASE + 0x0003010 -;TASK_DATA = OS_BASE + 0x0003020 -;TASK_EVENT = OS_BASE + 0x0003020 - ;CDDataBuf = OS_BASE + 0x0005000 -;unused 0x6000 - 0x8fff - BOOT_VARS = 0x9000 idts = OS_BASE + 0x000B100 @@ -483,8 +474,6 @@ struct BOX height dd ? ends -; Fields, marked as R now not used, but will be used soon, -; when legacy TASKDATA structure will be deleted struct APPDATA app_name rb 11 rb 5 @@ -520,7 +509,7 @@ struct APPDATA window dd ? ;+128 ptr WDATA dd ? ;+132 dd ? ;+136 - counter_sum dd ? ;+140 ; R + counter_sum dd ? ;+140 rd 4 ;+144 ipc_start dd ? ;+160 ipc_size dd ? ;+164 @@ -536,8 +525,8 @@ struct APPDATA rd 4 ;+216 priority dd ? ;+232 in_schedule LHEAD ;+236 - counter_add dd ? ;+244 ; R - cpu_usage dd ? ;+248 ; R + counter_add dd ? ;+244 + cpu_usage dd ? ;+248 dd ? ;+252 ; temporary place to save cursor ends @@ -546,22 +535,6 @@ assert sizeof.APPDATA = 256 APP_OBJ_OFFSET = 48 APP_EV_OFFSET = 40 -; Note: in future TASKDATA will be merged into APPDATA -;struct TASKDATA -; event_mask dd ? ;+0 mask which stores event types allowed for task -; pid dd ? ;+4 -; dw ? ;+8 -; state db ? ;+10 -; db ? ;+11 -; dw ? ;+12 -; wnd_number db ? ;+14 -; db ? ;+15 -; mem_start dd ? ;+16 -; counter_sum dd ? ;+20 -; counter_add dd ? ;+24 -; cpu_usage dd ? ;+28 -;ends - ; Thread states: TSTATE_RUNNING = 0 TSTATE_RUN_SUSPENDED = 1 @@ -613,7 +586,7 @@ struct WDATA draw_bgr_y dd ? draw_data RECT thread dd ? ; prt APPDATA - rb 64 - 16 - 4*2 - 4*2 - 4 - 16 + rb 12 ends label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3 diff --git a/kernel/trunk/core/sched.inc b/kernel/trunk/core/sched.inc index 75244bfa29..284c8aa4c3 100644 --- a/kernel/trunk/core/sched.inc +++ b/kernel/trunk/core/sched.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2023. All rights reserved. ;; ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; ;; Distributed under terms of the GNU General Public License ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -68,33 +68,26 @@ endg align 4 update_counters: - ;mov edi, [TASK_BASE] mov esi, [current_slot] rdtsc - ;sub eax, [edi+TASKDATA.counter_add] ; time stamp counter add - ;add [edi+TASKDATA.counter_sum], eax ; counter sum - sub eax, [esi - sizeof.APPDATA + APPDATA.counter_add] ; time stamp counter add - add [esi - sizeof.APPDATA + APPDATA.counter_sum], eax ; counter sum + sub eax, [esi + APPDATA.counter_add] ; time stamp counter add + add [esi + APPDATA.counter_sum], eax ; counter sum ret align 4 updatecputimes: mov ecx, [thread_count] - ;mov edi, TASK_DATA mov esi, SLOT_BASE .newupdate: xor eax, eax - ;xchg eax, [edi+TASKDATA.counter_sum] - ;mov [edi+TASKDATA.cpu_usage], eax - xchg eax, [esi + APPDATA.counter_sum] - ;add edi, 0x20 - mov [esi + APPDATA.cpu_usage], eax add esi, sizeof.APPDATA + xchg eax, [esi + APPDATA.counter_sum] + mov [esi + APPDATA.cpu_usage], eax loop .newupdate ret ;TODO: Надо бы убрать использование do_change_task из V86... -; и после этого перенести обработку TASKDATA.counter_add/sum в do_change_task +; и после этого перенести обработку APPDATA.counter_add/sum в do_change_task align 4 do_change_task: @@ -266,10 +259,9 @@ SCHEDULE_HIGHER_PRIORITY = 1 ; keep running the current thread if other ready threads have the same or lower priority ;retval: ; ebx = address of the APPDATA for the selected task (slot-base) -; edi = address of the TASKDATA for the selected task ; ZF = 1 if the task is the same ;warning: -; [current_slot_idx] = bh , [TASK_BASE] = edi -- as result +; [current_slot_idx] = bh -- as result ; [current_slot] is not set to new value (ebx)!!! ;scratched: eax,ecx proc find_next_task @@ -296,7 +288,7 @@ proc find_next_task mov al, [ebx + APPDATA.state] test al, al jz .task_found ; state == 0 - cmp al, 5 + cmp al, TSTATE_WAITING jne .task_next ; state == 1,2,3,4,9 ; state == 5 pushad ; more freedom for [APPDATA.wait_test] @@ -335,8 +327,7 @@ proc find_next_task mov byte [current_slot_idx], bh rdtsc ;call _rdtsc - mov [ebx - sizeof.APPDATA + APPDATA.counter_add], eax; for next using update_counters - ;mov [edi+TASKDATA.counter_add], eax; for next using update_counters + mov [ebx + APPDATA.counter_add], eax; for next using update_counters cmp ebx, [current_slot] ret .task_next: diff --git a/kernel/trunk/core/syscall.inc b/kernel/trunk/core/syscall.inc index 95e9c44989..aec83dd0fe 100644 --- a/kernel/trunk/core/syscall.inc +++ b/kernel/trunk/core/syscall.inc @@ -141,7 +141,7 @@ iglobal dd set_app_param ; 40-WantEvents dd undefined_syscall ; 41- deprecated GetIrqOwner dd undefined_syscall ; 42- deprecated ReadIrqData - dd undefined_syscall ; 43-SendDeviceData + dd undefined_syscall ; 43- deprecated SendDeviceData dd undefined_syscall ; 44- deprecated ProgramIrqs dd undefined_syscall ; 45- deprecated ReserveIrq and FreeIrq dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea diff --git a/kernel/trunk/core/taskman.inc b/kernel/trunk/core/taskman.inc index a6ffbdb825..9438fcd285 100644 --- a/kernel/trunk/core/taskman.inc +++ b/kernel/trunk/core/taskman.inc @@ -398,7 +398,7 @@ proc create_process stdcall, app_size:dword mov edi, [tmp_task_ptab] stdcall map_page, edi, eax, PG_SWR - mov ecx, 1024 + mov ecx, PAGE_SIZE/4 xor eax, eax rep stosd @@ -1086,14 +1086,14 @@ pid_to_appdata: mov ebx, [thread_count] shl ebx, BSF sizeof.APPDATA ; multiply by size ; skip first process in the task table + mov ecx, SLOT_BASE + add ebx, ecx .loop: add ecx, sizeof.APPDATA - cmp [SLOT_BASE + ecx + APPDATA.state], TSTATE_FREE + cmp [ecx + APPDATA.state], TSTATE_FREE jz @f ;skip empty slots - cmp [SLOT_BASE + ecx + APPDATA.tid], eax + cmp [ecx + APPDATA.tid], eax jz .pid_found - ;ecx = offset of current process info entry - ;ebx = maximum permitted offset @@: cmp ecx, ebx jb .loop diff --git a/kernel/trunk/docs/events_subsystem.ru.txt b/kernel/trunk/docs/events_subsystem.ru.txt index fb1878fc1c..847f072152 100644 --- a/kernel/trunk/docs/events_subsystem.ru.txt +++ b/kernel/trunk/docs/events_subsystem.ru.txt @@ -199,7 +199,7 @@ WaitEventTimeout: --------------------------------------------------------------------------------------------- GetEvent: Бесконечно ожидает любое событие в очереди событий текущего потока. Поток замораживается - путем перевода TASKDATA.state<=TSTATE_WAITING=5. Данные события (EVENT.code+5*dword) + путем перевода APPDATA.state<=TSTATE_WAITING=5. Данные события (EVENT.code+5*dword) по получении копируются в указанный буфер. Сбрасывает байт приоритета (см. выше) в буфере. Если в полученном событии НЕ установлен MANUAL_RESET, то: {EVENT_SIGNALED и EVENT_WATCHED по получении события сбрасываются. diff --git a/kernel/trunk/gui/window.inc b/kernel/trunk/gui/window.inc index 90608497d4..caeec1abdd 100644 --- a/kernel/trunk/gui/window.inc +++ b/kernel/trunk/gui/window.inc @@ -2173,8 +2173,8 @@ align 4 movzx edx, word[esi] shl edx, BSF sizeof.WDATA - cmp byte [SLOT_BASE + edx*(sizeof.APPDATA/sizeof.WDATA) - sizeof.APPDATA + APPDATA.state], TSTATE_FREE - je .next_window + test byte [window_data + edx + WDATA.fl_wstate], WSTATE_USED + jz .next_window mov eax, [edi + WDATA.box.top] mov ebx, [edi + WDATA.box.height] diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 4cb5cb71f8..cc2ce66b49 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -2229,8 +2229,7 @@ sysfn_zmodif: ;------------------------------------------------------------------------------ sysfn_getidletime: ; 18.4 = GET IDLETIME - ;mov eax, [TASK_TABLE+32+TASKDATA.cpu_usage] - mov eax, [SLOT_BASE + APPDATA.cpu_usage] + mov eax, [SLOT_BASE + sizeof.APPDATA + APPDATA.cpu_usage] mov [esp + SYSCALL_STACK.eax], eax ret ;------------------------------------------------------------------------------ @@ -2532,8 +2531,7 @@ sys_cpuusage: shl ecx, BSF sizeof.APPDATA ; +0: dword: memory usage - ;mov eax, [ecx+TASK_TABLE+TASKDATA.cpu_usage] - mov eax, [SLOT_BASE + ecx - sizeof.APPDATA + APPDATA.cpu_usage] + mov eax, [SLOT_BASE + ecx + APPDATA.cpu_usage] mov [ebx], eax ; +10: 11 bytes: name of the process push ecx @@ -2543,16 +2541,15 @@ sys_cpuusage: call memmove pop ecx - shr ecx, (BSF sizeof.APPDATA - BSF sizeof.WDATA) ; +22: address of the process in memory ; +26: size of used memory - 1 push edi lea edi, [ebx+12] xor eax, eax mov edx, 0x100000*16 - cmp ecx, 1 shl BSF sizeof.WDATA + cmp ecx, 1 shl BSF sizeof.APPDATA je .os_mem - mov edx, [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.process] + mov edx, [SLOT_BASE + ecx + APPDATA.process] mov edx, [edx + PROC.mem_used] mov eax, std_application_base_address .os_mem: @@ -2560,39 +2557,42 @@ sys_cpuusage: lea eax, [edx-1] stosd + mov edx, ecx + shr edx, (BSF sizeof.APPDATA - BSF sizeof.WDATA) + ; +30: PID/TID - mov eax, [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.tid] + mov eax, [SLOT_BASE + ecx + APPDATA.tid] stosd ; window position and size push esi - lea esi, [window_data + ecx + WDATA.box] + lea esi, [window_data + edx + WDATA.box] movsd movsd movsd movsd ; Process state (+50) - movzx eax, byte [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state] + movzx eax, byte [SLOT_BASE + ecx + APPDATA.state] stosd ; Window client area box - lea esi, [window_data + ecx + WDATA.clientbox] + lea esi, [window_data + edx + WDATA.clientbox] movsd movsd movsd movsd ; Window state - mov al, [window_data + ecx + WDATA.fl_wstate] + mov al, [window_data + edx + WDATA.fl_wstate] stosb ; Event mask (+71) - mov EAX, dword [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.event_mask] + mov eax, dword [SLOT_BASE + ecx + APPDATA.event_mask] stosd ; Keyboard mode (+75) - mov al, byte [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.keyboard_mode] + mov al, byte [SLOT_BASE + ecx + APPDATA.keyboard_mode] stosb pop esi