From 0f675e453418c70ddfb62c839973e1423f464b0c Mon Sep 17 00:00:00 2001 From: "Rustem Gimadutdinov (rgimad)" Date: Sat, 19 Jun 2021 08:41:09 +0000 Subject: [PATCH] [KERNEL] use constants instead of hardcoded values, other small fixes git-svn-id: svn://kolibrios.org@8876 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/debug.inc | 4 ++-- kernel/trunk/core/memory.inc | 4 ++-- kernel/trunk/core/sys32.inc | 4 ++-- kernel/trunk/gui/event.inc | 2 +- kernel/trunk/kernel.asm | 6 +++--- kernel/trunk/posix/futex.inc | 6 +++--- kernel/trunk/posix/pipe.inc | 12 ++++++------ 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/kernel/trunk/core/debug.inc b/kernel/trunk/core/debug.inc index c4e3d586a1..35a1345fca 100644 --- a/kernel/trunk/core/debug.inc +++ b/kernel/trunk/core/debug.inc @@ -449,7 +449,7 @@ debugger_notify: call write_process_memory ; new debug event mov eax, ebp - shl eax, 8 - or byte [SLOT_BASE+eax+APPDATA.occurred_events+1], 1 ; set flag 100h + shl eax, BSF sizeof.APPDATA + or [SLOT_BASE+eax+APPDATA.occurred_events], EVENT_DEBUG .ret: ret diff --git a/kernel/trunk/core/memory.inc b/kernel/trunk/core/memory.inc index 405bb69ac9..fa42757764 100644 --- a/kernel/trunk/core/memory.inc +++ b/kernel/trunk/core/memory.inc @@ -1042,8 +1042,8 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword invlpg [edx] mov eax, [dst_slot] - shl eax, 8 - or [eax+SLOT_BASE+0xA8], dword 0x40 + shl eax, BSF sizeof.APPDATA + or [eax+SLOT_BASE+APPDATA.occurred_events], EVENT_IPC push 0 jmp .ret .no_pid: diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index 10249fa0d2..1309e9eca8 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -152,7 +152,7 @@ exc_c: ; exceptions (all but 7th - #NM) ; not debuggee => say error and terminate call show_error_parameters sti - mov [edx + TASKDATA.state], TSTATE_TERMINATING ; terminate + mov [edx + TASKDATA.state], TSTATE_TERMINATING call wakeup_osloop call change_task ; If we're here, then the main OS thread has crashed before initializing IDLE thread. @@ -187,7 +187,7 @@ exc_c: ; exceptions (all but 7th - #NM) call debugger_notify ;; only ONE using, inline ??? SEE: core/debug.inc add esp, 12 mov edx, [TASK_BASE] - mov [edx+TASKDATA.state], TSTATE_RUN_SUSPENDED ; suspended + mov [edx+TASKDATA.state], TSTATE_RUN_SUSPENDED call change_task ; SEE: core/shed.inc restore_ring3_context iretd diff --git a/kernel/trunk/gui/event.inc b/kernel/trunk/gui/event.inc index 995c89a10e..75e032732c 100644 --- a/kernel/trunk/gui/event.inc +++ b/kernel/trunk/gui/event.inc @@ -281,7 +281,7 @@ Wait_events_ex: mov eax, [timer_ticks] mov [esi+APPDATA.wait_begin], eax mov eax, [TASK_BASE] - mov [eax+TASKDATA.state], 5 + mov [eax+TASKDATA.state], TSTATE_WAITING call change_task mov eax, [esi+APPDATA.wait_param] ;-------------------------------------- diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 2778eab3c4..2caeb5f569 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -2363,7 +2363,7 @@ sysfn_zmodif: mov eax, edx shl edx, 5 - cmp [edx + TASK_TABLE + TASKDATA.state], 9 + cmp [edx + TASK_TABLE + TASKDATA.state], TSTATE_FREE je .fail cmp ecx, 1 @@ -3606,7 +3606,7 @@ align 4 ;-------------------------------------- align 4 .set: - or [edi+SLOT_BASE+APPDATA.occurred_events], 100000b ; set event 6; TODO use constant + or [edi+SLOT_BASE+APPDATA.occurred_events], EVENT_MOUSE ;-------------------------------------- align 4 .skip: @@ -3674,7 +3674,7 @@ set_bgr_event: mov [edi+SLOT_BASE+APPDATA.draw_bgr_x], eax mov [edi+SLOT_BASE+APPDATA.draw_bgr_y], edx .common: - or [edi+SLOT_BASE+APPDATA.occurred_events], 10000b ; set event 5; TODO use constant + or [edi+SLOT_BASE+APPDATA.occurred_events], EVENT_BACKGROUND loop set_bgr_event pop edi ecx ;--------- set event 5 stop ----------- diff --git a/kernel/trunk/posix/futex.inc b/kernel/trunk/posix/futex.inc index c6d4c550a7..27e5afa4c4 100644 --- a/kernel/trunk/posix/futex.inc +++ b/kernel/trunk/posix/futex.inc @@ -133,7 +133,7 @@ align 4 list_add_tail esp, esi ;esp= new waiter, esi= list head mov eax, edx .again: - mov [ebx+TASKDATA.state], 1 + mov [ebx+TASKDATA.state], TSTATE_RUN_SUSPENDED call change_task lock cmpxchg [ecx], edx @@ -180,7 +180,7 @@ align 4 mov eax, [timer_ticks] mov [ebx+APPDATA.wait_begin], eax mov eax, [TASK_BASE] - mov [eax+TASKDATA.state], 5 + mov [eax+TASKDATA.state], TSTATE_WAITING mov [esp+MUTEX_WAITER.task], eax lea esi, [ebp+FUTEX.wait_list] @@ -232,7 +232,7 @@ align 4 je .done mov eax, [esi+MUTEX_WAITER.task] - mov [eax+TASKDATA.state], 0 + mov [eax+TASKDATA.state], TSTATE_RUNNING mov esi, [esi+MUTEX_WAITER.list.next] inc ecx diff --git a/kernel/trunk/posix/pipe.inc b/kernel/trunk/posix/pipe.inc index 4b4dd43a87..45b0dcad42 100644 --- a/kernel/trunk/posix/pipe.inc +++ b/kernel/trunk/posix/pipe.inc @@ -181,7 +181,7 @@ pipe_read: je @F mov ecx, [ecx+MUTEX_WAITER.task] - mov [ecx+TASKDATA.state], 0 ;activate writer task + mov [ecx+TASKDATA.state], TSTATE_RUNNING ;activate writer task @@: cmp [ebp+PIPE.count], 0 je @F @@ -191,7 +191,7 @@ pipe_read: je @F mov eax, [eax+MUTEX_WAITER.task] - mov [eax+TASKDATA.state], 0 ;activate reader task + mov [eax+TASKDATA.state], TSTATE_RUNNING ;activate reader task @@: lea ecx, [ebp+PIPE.pipe_lock] call mutex_unlock @@ -211,7 +211,7 @@ pipe_read: lea ecx, [ebp+PIPE.pipe_lock] call mutex_unlock - mov [ebx+TASKDATA.state], 1 + mov [ebx+TASKDATA.state], TSTATE_RUN_SUSPENDED call change_task lea ecx, [ebp+PIPE.pipe_lock] @@ -276,7 +276,7 @@ pipe_write: je @F mov eax, [eax+MUTEX_WAITER.task] - mov [eax+TASKDATA.state], 0 ;activate reader task + mov [eax+TASKDATA.state], TSTATE_RUNNING ;activate reader task @@: cmp [ebp+PIPE.count], 4096 je @F @@ -286,7 +286,7 @@ pipe_write: je @F mov ecx, [eax+MUTEX_WAITER.task] - mov [ecx+TASKDATA.state], 0 ;activate writer task + mov [ecx+TASKDATA.state], TSTATE_RUNNING ;activate writer task @@: popfd @@ -314,7 +314,7 @@ pipe_write: lea ecx, [ebp+PIPE.pipe_lock] call mutex_unlock - mov [ecx+TASKDATA.state], 1 + mov [ecx+TASKDATA.state], TSTATE_RUN_SUSPENDED call change_task lea ecx, [ebp+PIPE.pipe_lock]