From 9a2d26f2a7a30d9281edd45476b613db15677db0 Mon Sep 17 00:00:00 2001 From: Doczom Date: Sun, 25 Jun 2023 16:42:10 +0000 Subject: [PATCH] [KERNEL] the window subsystem was refactored, WDATA structures were expanded and magic numbers were replaced with constants git-svn-id: svn://kolibrios.org@9926 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/const.inc | 27 ++++--- kernel/trunk/core/sys32.inc | 2 +- kernel/trunk/gui/background.inc | 3 - kernel/trunk/gui/button.inc | 14 ++-- kernel/trunk/gui/event.inc | 9 +-- kernel/trunk/gui/mouse.inc | 17 ++--- kernel/trunk/gui/skincode.inc | 2 +- kernel/trunk/gui/skindata.inc | 2 +- kernel/trunk/gui/window.inc | 116 ++++++++++++++--------------- kernel/trunk/kernel.asm | 59 +++++++-------- kernel/trunk/video/blitter.inc | 5 +- kernel/trunk/video/cursors.inc | 4 +- kernel/trunk/video/framebuffer.inc | 18 ++--- 13 files changed, 135 insertions(+), 143 deletions(-) diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index 26137dda90..ece28b3634 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -494,7 +494,7 @@ struct APPDATA exc_handler dd ? ;+32 except_mask dd ? ;+36 pl0_stack dd ? ;+40 - cursor dd ? ;+44 + cursor dd ? ;+44 ; WDATA fd_ev dd ? ;+48 bk_ev dd ? ;+52 fd_obj dd ? ;+56 @@ -511,29 +511,28 @@ struct APPDATA tls_base dd ? ;+104 event_mask dd ? ;+108 stores event types allowed for task tid dd ? ;+112 thread id - draw_bgr_x dd ? ;+116 - draw_bgr_y dd ? ;+120 + draw_bgr_x dd ? ;+116 ; WDATA + draw_bgr_y dd ? ;+120 ; WDATA state db ? ;+124 thread state wnd_number db ? ;+125 dw ? ;+126 - wnd_shape dd ? ;+128 - wnd_shape_scale dd ? ;+132 + dd ? ;+128 + dd ? ;+132 dd ? ;+136 counter_sum dd ? ;+140 ; R - saved_box BOX ;+144 + saved_box BOX ;+144 ; WDATA ipc_start dd ? ;+160 ipc_size dd ? ;+164 occurred_events dd ? ;+168 ; mask which accumulates occurred events debugger_slot dd ? ;+172 terminate_protection dd ? ;+176 keyboard_mode db ? ;+180 - captionEncoding db ? - rb 2 + rb 3 exec_params dd ? ;+184 dbg_event_mem dd ? ;+188 dbg_regs DBG_REGS ;+192 - wnd_caption dd ? ;+212 - wnd_clientbox BOX ;+216 + dd ? ;+212 + rd 4 ;+216 priority dd ? ;+232 in_schedule LHEAD ;+236 counter_add dd ? ;+244 ; R @@ -598,11 +597,17 @@ struct WDATA fl_wstate db ? fl_wdrawn db ? fl_redraw db ? + clientbox BOX + shape dd ? + shape_scale dd ? + caption dd ? + captionEncoding db ? + rb 3 ends label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3 -assert sizeof.WDATA = 32 +assert sizeof.WDATA = 64 struct SYS_VARS bpp dd ? diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index 6556f3c950..0a20a9a40a 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -630,7 +630,7 @@ destroy_thread: shl edi, BSF sizeof.APPDATA cmp [SLOT_BASE + edi + APPDATA.state], TSTATE_FREE ; skip free slots je .check_next_window - shr edi, 3 + shr edi, (BSF sizeof.APPDATA - BSF sizeof.WDATA) add edi, window_data ; \begin{diamond}[19.09.2006] ; skip minimized windows diff --git a/kernel/trunk/gui/background.inc b/kernel/trunk/gui/background.inc index 085274eae5..1d88007df4 100644 --- a/kernel/trunk/gui/background.inc +++ b/kernel/trunk/gui/background.inc @@ -140,9 +140,6 @@ align 4 draw_background_temp: mov [background_defined], 1 call force_redraw_background -;-------------------------------------- -align 4 -nosb31: ret ;-------------------------------------- align 4 diff --git a/kernel/trunk/gui/button.inc b/kernel/trunk/gui/button.inc index 3195eeefcc..948e851cc2 100644 --- a/kernel/trunk/gui/button.inc +++ b/kernel/trunk/gui/button.inc @@ -95,12 +95,13 @@ syscall_button: ; make coordinates clientbox-relative push eax - mov eax, [current_slot] + mov eax, [current_slot_idx] + shl eax, BSF sizeof.WDATA rol ebx, 16 - add bx, word[eax + APPDATA.wnd_clientbox.left] + add bx, word[window_data + eax + WDATA.clientbox.left] rol ebx, 16 rol ecx, 16 - add cx, word[eax + APPDATA.wnd_clientbox.top] + add cx, word[window_data + eax + WDATA.clientbox.top] rol ecx, 16 pop eax @@ -339,12 +340,11 @@ sys_button_deactivate_handler: mov esi, eax mov edi, ebx movzx ecx, [esi + SYS_BUTTON.pslot] - shl ecx, 5 - add ecx, window_data + shl ecx, BSF sizeof.WDATA mov eax, dword[esi + SYS_BUTTON.left] mov ebx, dword[esi + SYS_BUTTON.top] - add eax, [ecx + WDATA.box.left] - add ebx, [ecx + WDATA.box.top] + add eax, [window_data + ecx + WDATA.box.left] + add ebx, [window_data + ecx + WDATA.box.top] mov ecx, eax mov edx, ebx bt edi, 30 diff --git a/kernel/trunk/gui/event.inc b/kernel/trunk/gui/event.inc index 8694828e20..8dd41f7308 100644 --- a/kernel/trunk/gui/event.inc +++ b/kernel/trunk/gui/event.inc @@ -67,9 +67,8 @@ create_event: ;; EXPORT use ; edx - uid ;scratched: ebx,ecx,esi,edi mov ebx, [current_slot] + mov edx, [ebx+APPDATA.tid] add ebx, APP_OBJ_OFFSET - mov edx, [current_slot] - mov edx, [edx+APPDATA.tid] pushfd cli ;-------------------------------------- @@ -463,7 +462,7 @@ align 4 ;-------------------------------------- align 4 .result: - setae byte[esp+32+4] ;we consider that initially was: dword[esp+32+4]==72 + setae byte[esp + SYSCALL_STACK.eax + 4] ;we consider that initially was: dword[esp+32+4]==72 ;-------------------------------------- align 4 .retf: @@ -510,7 +509,7 @@ get_event_for_app: ;; used from f10,f11,f23 ; eax - event number (=0 => no events) movzx edi, bh ; bh is assumed as [current_slot_idx] mov ecx, [ebx+APPDATA.event_mask] - shl edi, 5 + shl edi, BSF sizeof.WDATA add edi, window_data and ecx, 0x7FFFFFFF ;-------------------------------------- @@ -553,7 +552,7 @@ align 4 push eax mov eax, [current_slot] mov eax, [eax + APPDATA.event_mask] - test eax, 0x80000000 ; bit 31: active/inactive filter f.40 + test eax, EVM_MOUSE_FILTER ; bit 31: active/inactive filter f.40 jz @f pop eax jmp .FlagAutoReset diff --git a/kernel/trunk/gui/mouse.inc b/kernel/trunk/gui/mouse.inc index b4994c2b45..58c5806c6d 100644 --- a/kernel/trunk/gui/mouse.inc +++ b/kernel/trunk/gui/mouse.inc @@ -294,7 +294,7 @@ mouse._.left_button_release_handler: jz .exit mov eax, esi - shl eax, 5 + shl eax, BSF sizeof.WDATA add eax, window_data + WDATA.box mov ebx, mouse.active_sys_window.old_box mov ecx, sizeof.BOX @@ -515,7 +515,7 @@ mouse._.move_handler: push eax mov edi, esi - shl edi, 5 + shl edi, BSF sizeof.WDATA add edi, window_data call window._.get_rolledup_height mov ecx, eax @@ -582,7 +582,7 @@ mouse._.move_handler: mov [fl_moving], 1 push edi mov edi, esi - shl edi, 5 + shl edi, BSF sizeof.WDATA add edi, WDATA.box + window_data call window._.draw_negative_box pop edi @@ -609,7 +609,7 @@ mouse._.find_sys_window_under_cursor: add esi, [mouse.state.pos.x] movzx esi, byte[esi] mov edi, esi - shl edi, 5 + shl edi, BSF sizeof.WDATA add edi, window_data ret @@ -821,14 +821,13 @@ dd .loadCursorUni mov ax, [MOUSE_Y] mov esi, [current_slot_idx] shl esi, BSF sizeof.WDATA - mov bx, word [esi + window_data + WDATA.box.left] + mov bx, word[window_data + esi + WDATA.box.left] shl ebx, 16 - mov bx, word [esi + window_data + WDATA.box.top] + mov bx, word[window_data + esi + WDATA.box.top] sub eax, ebx - mov edi, [current_slot] - sub ax, word[edi + APPDATA.wnd_clientbox.top] + sub ax, word[window_data + esi + WDATA.clientbox.top] rol eax, 16 - sub ax, word[edi + APPDATA.wnd_clientbox.left] + sub ax, word[window_data + esi + WDATA.clientbox.left] rol eax, 16 mov [esp + SYSCALL_STACK.eax], eax ret diff --git a/kernel/trunk/gui/skincode.inc b/kernel/trunk/gui/skincode.inc index a3d281749b..dc8c3281f8 100644 --- a/kernel/trunk/gui/skincode.inc +++ b/kernel/trunk/gui/skincode.inc @@ -97,7 +97,7 @@ parse_skin_data: jne .exit mov edi, skin_udata - mov ecx, (skin_udata.end-skin_udata)/4 + mov ecx, (skin_udata.size)/4 xor eax, eax cld rep stosd diff --git a/kernel/trunk/gui/skindata.inc b/kernel/trunk/gui/skindata.inc index 29ccc51aeb..331be73439 100644 --- a/kernel/trunk/gui/skindata.inc +++ b/kernel/trunk/gui/skindata.inc @@ -59,6 +59,6 @@ skin_udata: align 4 -skin_udata.end: +skin_udata.size = $ - skin_udata endg diff --git a/kernel/trunk/gui/window.inc b/kernel/trunk/gui/window.inc index 444049ba92..af5dc6dc58 100644 --- a/kernel/trunk/gui/window.inc +++ b/kernel/trunk/gui/window.inc @@ -80,11 +80,10 @@ syscall_setpixel: mov ecx, edx mov edx, [current_slot_idx] shl edx, BSF sizeof.WDATA - add eax, [edx + window_data + WDATA.box.left] - add ebx, [edx + window_data + WDATA.box.top] - mov edi, [current_slot] - add eax, [edi+APPDATA.wnd_clientbox.left] - add ebx, [edi+APPDATA.wnd_clientbox.top] + add eax, [window_data + edx + WDATA.box.left] + add ebx, [window_data + edx + WDATA.box.top] + add eax, [window_data + edx + WDATA.clientbox.left] + add ebx, [window_data + edx + WDATA.clientbox.top] xor edi, edi ; no force and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area jmp __sys_putpixel @@ -106,14 +105,11 @@ syscall_writetext: mov eax, [current_slot_idx] shl eax, BSF sizeof.WDATA - mov ebp, [eax + window_data + WDATA.box.left] - push esi - mov esi, [current_slot] - add ebp, [esi+APPDATA.wnd_clientbox.left] + mov ebp, [window_data + eax + WDATA.box.left] + add ebp, [window_data + eax + WDATA.clientbox.left] shl ebp, 16 - add ebp, [eax + window_data + WDATA.box.top] - add bp, word[esi+APPDATA.wnd_clientbox.top] - pop esi + add ebp, [window_data + eax + WDATA.box.top] + add bp, word[window_data + eax + WDATA.clientbox.top] test ecx, 0x08000000 ; redirect the output to the user area jnz @f add ebx, ebp @@ -151,10 +147,10 @@ syscall_drawrect: shr eax, 16 ; eax - x.coord movzx edx, bx ; edx - y.size shr ebx, 16 ; ebx - y.coord - mov esi, [current_slot] - - add eax, [esi + APPDATA.wnd_clientbox.left] - add ebx, [esi + APPDATA.wnd_clientbox.top] + mov esi, [current_slot_idx] + shl esi, BSF sizeof.WDATA + add eax, [window_data + esi + WDATA.clientbox.left] + add ebx, [window_data + esi + WDATA.clientbox.top] add ecx, eax add edx, ebx jmp vesa20_drawbar @@ -167,18 +163,17 @@ align 4 syscall_drawline: mov edi, [current_slot_idx] shl edi, BSF sizeof.WDATA - movzx eax, word[edi + window_data + WDATA.box.left] + movzx eax, word[window_data + edi + WDATA.box.left] mov ebp, eax - mov esi, [current_slot] - add ebp, [esi+APPDATA.wnd_clientbox.left] - add ax, word[esi+APPDATA.wnd_clientbox.left] + add ebp, [window_data + edi + WDATA.clientbox.left] + add ax, word[window_data + edi + WDATA.clientbox.left] add ebp, ebx shl eax, 16 - movzx ebx, word[edi + window_data + WDATA.box.top] + movzx ebx, word[window_data + edi + WDATA.box.top] add eax, ebp mov ebp, ebx - add ebp, [esi+APPDATA.wnd_clientbox.top] - add bx, word[esi+APPDATA.wnd_clientbox.top] + add ebp, [window_data + edi + WDATA.clientbox.top] + add bx, word[window_data + edi + WDATA.clientbox.top] add ebp, ecx shl ebx, 16 xor edi, edi @@ -411,17 +406,18 @@ align 4 ;> ebx = 1 ;> ecx = scale power (resulting scale is 2^ebx) syscall_set_window_shape: - mov edi, [current_slot] + mov edi, [current_slot_idx] + shl edi, BSF sizeof.WDATA test ebx, ebx jne .shape_scale - mov [edi + APPDATA.wnd_shape], ecx + mov [window_data + edi + WDATA.shape], ecx ;-------------------------------------- align 4 .shape_scale: dec ebx jnz .exit - mov [edi + APPDATA.wnd_shape_scale], ecx + mov [window_data + edi + WDATA.shape_scale], ecx ;-------------------------------------- align 4 .exit: @@ -498,8 +494,8 @@ syscall_window_settings: jc @f xor edx, edx @@: - mov [edi*8 + SLOT_BASE + APPDATA.wnd_caption], ecx - mov [edi*8 + SLOT_BASE + APPDATA.captionEncoding], dl + mov [window_data + edi + WDATA.caption], ecx + mov [window_data + edi + WDATA.captionEncoding], dl jmp window._.draw_window_caption ;------------------------------------------------------------------------------ @@ -561,7 +557,7 @@ align 4 movzx edi, word[WIN_POS + esi * 2] shl edi, BSF sizeof.WDATA ;size of TASKDATA and WDATA = 32 bytes - cmp byte [SLOT_BASE + edi*8 + APPDATA.state], TSTATE_FREE + cmp byte [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state], TSTATE_FREE je .skip_window add edi, window_data @@ -1090,10 +1086,10 @@ align 4 movzx edi, word[WIN_POS + eax * 2] shl edi, BSF sizeof.WDATA ; it is a unused slot? - cmp byte [SLOT_BASE + edi*8 + APPDATA.state], TSTATE_FREE + cmp byte [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state], TSTATE_FREE je @f ; it is a hidden thread? - lea esi, [SLOT_BASE + edi*8 + APPDATA.app_name] + lea esi, [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.app_name] cmp [esi], byte '@' je @f ; is it already minimized? @@ -1549,7 +1545,7 @@ end if mov eax, edi sub eax, window_data - shl eax, 3 + shl eax, (BSF sizeof.APPDATA - BSF sizeof.WDATA) add eax, SLOT_BASE lea ebx, [edi + WDATA.box] @@ -1584,43 +1580,41 @@ window._.set_window_clientbox: mov [window_topleft + 8 * 4 + 4], eax mov ecx, edi - sub edi, window_data - shl edi, 3 test [ecx + WDATA.fl_wstyle], WSTYLE_CLIENTRELATIVE jz .whole_window movzx eax, [ecx + WDATA.fl_wstyle] and eax, 0x0F mov eax, [eax * 8 + window_topleft + 0] - mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax + mov [ecx + WDATA.clientbox.left], eax shl eax, 1 neg eax add eax, [ecx + WDATA.box.width] inc eax ;Leency: as window is created width+1 so client the same - mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax + mov [ecx + WDATA.clientbox.width], eax movzx eax, [ecx + WDATA.fl_wstyle] and eax, 0x0F push [eax * 8 + window_topleft + 0] mov eax, [eax * 8 + window_topleft + 4] - mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax + mov [ecx + WDATA.clientbox.top], eax neg eax sub eax, [esp] add eax, [ecx + WDATA.box.height] inc eax ;Leency: as window is created height+1 so client the same - mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax + mov [ecx + WDATA.clientbox.height], eax add esp, 4 jmp .exit ;-------------------------------------- align 4 .whole_window: xor eax, eax - mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax - mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax + mov [ecx + WDATA.clientbox.left], eax + mov [ecx + WDATA.clientbox.top], eax mov eax, [ecx + WDATA.box.width] - mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax + mov [ecx + WDATA.clientbox.width], eax mov eax, [ecx + WDATA.box.height] - mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax + mov [ecx + WDATA.clientbox.height], eax ;-------------------------------------- align 4 .exit: @@ -1666,9 +1660,9 @@ window._.sys_set_window: mov cl, [edi + WDATA.fl_wstyle] mov eax, [edi + WDATA.cl_frames] + mov esi, [esp] sub edi, window_data - shl edi, 3 - add edi, SLOT_BASE + shl edi, (BSF sizeof.APPDATA - BSF sizeof.WDATA) and cl, 0x0F cmp cl, 3 @@ -1680,10 +1674,9 @@ window._.sys_set_window: ;-------------------------------------- align 4 @@: - mov [edi + APPDATA.wnd_caption], eax + mov [esi + WDATA.caption], eax - mov esi, [esp] - add edi, APPDATA.saved_box + add edi, SLOT_BASE + APPDATA.saved_box movsd movsd movsd @@ -1866,10 +1859,12 @@ end virtual pushad - cmp esi, 1 - jz .check_for_shaped_window mov edi, esi shl edi, BSF sizeof.WDATA + + cmp esi, 1 + jz .check_for_shaped_window + cmp [window_data + edi + WDATA.box.width], 0 jnz .check_for_shaped_window cmp [window_data + edi + WDATA.box.height], 0 @@ -1877,10 +1872,7 @@ end virtual ;-------------------------------------- align 4 .check_for_shaped_window: - mov edi, esi - shl edi, BSF sizeof.APPDATA - add edi, SLOT_BASE - cmp [edi + APPDATA.wnd_shape], 0 + cmp [window_data + edi + WDATA.shape], 0 jne .shaped_window ; get x&y size @@ -1930,7 +1922,7 @@ align 4 inc ecx inc edx - push [edi + APPDATA.wnd_shape_scale] ; push scale first -> for loop + push [window_data + edi + WDATA.shape_scale] ; push scale first -> for loop ; get WinMap start -> ebp push eax @@ -1940,7 +1932,7 @@ align 4 add eax, [_display.win_map] mov ebp, eax - mov edi, [edi + APPDATA.wnd_shape] + mov edi, [window_data + edi + WDATA.shape] pop eax ; eax = x_start @@ -2178,7 +2170,7 @@ window._.check_window_draw: mov eax, edi sub eax, window_data - shr eax, 5 + shr eax, BSF sizeof.WDATA movzx eax, word[WIN_STACK + eax * 2] ; get value of the curr process lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 @@ -2195,7 +2187,7 @@ align 4 movzx edx, word[esi] shl edx, BSF sizeof.WDATA ; size of TASKDATA and WDATA is 32 bytes - cmp byte [SLOT_BASE + edx*8 - sizeof.APPDATA + APPDATA.state], TSTATE_FREE + cmp byte [SLOT_BASE + edx*(sizeof.APPDATA/sizeof.WDATA) - sizeof.APPDATA + APPDATA.state], TSTATE_FREE je .next_window mov eax, [edi + WDATA.box.top] @@ -2250,7 +2242,7 @@ window._.draw_window_caption: align 4 @@: mov edx, [current_slot_idx] - shl edx, 5 + shl edx, BSF sizeof.WDATA add edx, window_data movzx ebx, [edx + WDATA.fl_wstyle] and bl, 0x0F @@ -2287,9 +2279,9 @@ align 4 .2: mov edi, [current_slot_idx] shl edi, BSF sizeof.WDATA - test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION + test [window_data + edi + WDATA.fl_wstyle], WSTYLE_HASCAPTION jz .exit - mov edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption] + mov edx, [window_data + edi + WDATA.caption] or edx, edx jz .exit @@ -2332,7 +2324,7 @@ align 4 mov esi, eax add ebx, ebp mov ecx, [common_colours + 16] - mov al, [edi*8 + SLOT_BASE + APPDATA.captionEncoding] + mov al, [window_data + edi + WDATA.captionEncoding] test al, al jnz @f mov al, 1 @@ -2463,7 +2455,7 @@ align 4 movzx edi, word[WIN_POS + esi * 2] shl edi, BSF sizeof.WDATA ;size of TASKDATA and WDATA = 32 bytes - cmp byte [SLOT_BASE + edi*8 + APPDATA.state], TSTATE_FREE + cmp byte [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state], TSTATE_FREE je .skip_window add edi, window_data diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index d3602d971f..5b649c04fb 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -551,7 +551,7 @@ high_code: xor eax, eax mov [clipboard_slots], eax mov [clipboard_write_lock], eax - stdcall kernel_alloc, 4096 + stdcall kernel_alloc, PAGE_SIZE test eax, eax jnz @f @@ -1554,16 +1554,14 @@ draw_num_text: mov ebx, [esp+64+32-8+4] ; add window start x & y - mov edi, [current_slot_idx] - mov ecx, edi - shl edi, BSF sizeof.APPDATA + mov ecx, [current_slot_idx] shl ecx, BSF sizeof.WDATA mov eax, [window_data + ecx + WDATA.box.left] - add eax, [SLOT_BASE + edi + APPDATA.wnd_clientbox.left] + add eax, [window_data + ecx + WDATA.clientbox.left] shl eax, 16 add eax, [window_data + ecx + WDATA.box.top] - add eax, [SLOT_BASE + edi + APPDATA.wnd_clientbox.top] + add eax, [window_data + ecx + WDATA.clientbox.top] add ebx, eax mov ecx, [esp+64+32-12+4] mov eax, [esp+64+8] ; background color (if given) @@ -2109,7 +2107,7 @@ sysfn_deactivate: ; 18.1 = DEACTIVATE WINDOW je .nowindowdeactivate ; already deactive mov edi, ecx - shl edi, 5 + shl edi, BSF sizeof.WDATA add edi, window_data movzx esi, word [WIN_STACK + ecx * 2] lea esi, [WIN_POS + esi * 2] @@ -2174,7 +2172,7 @@ sysfn_zmodif: mov eax, edx shl edx, BSF sizeof.WDATA - cmp [edx*8 + SLOT_BASE + APPDATA.state], TSTATE_FREE + cmp [edx*(sizeof.APPDATA/sizeof.WDATA) + SLOT_BASE + APPDATA.state], TSTATE_FREE je .fail cmp ecx, 1 @@ -2533,16 +2531,16 @@ sys_cpuusage: call memmove pop ecx - shr ecx, 3 + 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 5 + cmp ecx, 1 shl BSF sizeof.WDATA je .os_mem - mov edx, [SLOT_BASE + ecx*8 + APPDATA.process] + mov edx, [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.process] mov edx, [edx + PROC.mem_used] mov eax, std_application_base_address .os_mem: @@ -2551,7 +2549,7 @@ sys_cpuusage: stosd ; +30: PID/TID - mov eax, [SLOT_BASE + ecx*8 + APPDATA.tid] + mov eax, [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.tid] stosd ; window position and size @@ -2563,11 +2561,11 @@ sys_cpuusage: movsd ; Process state (+50) - movzx eax, byte [SLOT_BASE + ecx*8 + APPDATA.state] + movzx eax, byte [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state] stosd ; Window client area box - lea esi, [SLOT_BASE + ecx*8 + APPDATA.wnd_clientbox] + lea esi, [window_data + ecx + WDATA.clientbox] movsd movsd movsd @@ -2578,11 +2576,11 @@ sys_cpuusage: stosb ; Event mask (+71) - mov EAX, dword [SLOT_BASE + ecx*8 + APPDATA.event_mask] + mov EAX, dword [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.event_mask] stosd ; Keyboard mode (+75) - mov al, byte [SLOT_BASE + ecx*8 + APPDATA.keyboard_mode] + mov al, byte [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.keyboard_mode] stosb pop esi @@ -3086,7 +3084,7 @@ bgli: cmp ebx, [eax + RECT.left] jae @f - mov [eax+RECT.left], ebx + mov [eax + RECT.left], ebx mov dl, 1 ;-------------------------------------- align 4 @@ -3104,7 +3102,7 @@ align 4 cmp ebx, [eax + RECT.right] jbe @f - mov [eax+RECT.right], ebx + mov [eax + RECT.right], ebx mov dl, 1 ;-------------------------------------- align 4 @@ -3594,10 +3592,11 @@ align 4 ;-------------------------------------- align 4 @@: - mov edi, [current_slot] - add dx, word[edi + APPDATA.wnd_clientbox.top] + mov edi, [current_slot_idx] + shl edi, BSF sizeof.WDATA + add dx, word[window_data + edi + WDATA.clientbox.top] rol edx, 16 - add dx, word[edi + APPDATA.wnd_clientbox.left] + add dx, word[window_data + edi + WDATA.clientbox.left] rol edx, 16 ;-------------------------------------- align 4 @@ -3632,10 +3631,11 @@ sys_putimage_palette: pop esi ecx jnz sys_putimage.exit - mov eax, [current_slot] - add dx, word [eax + APPDATA.wnd_clientbox.top] + mov eax, [current_slot_idx] + shl eax, BSF sizeof.WDATA + add dx, word [window_data + eax + WDATA.clientbox.top] rol edx, 16 - add dx, word [eax + APPDATA.wnd_clientbox.left] + add dx, word [window_data + eax + WDATA.clientbox.left] rol edx, 16 ;-------------------------------------- align 4 @@ -3944,11 +3944,12 @@ putimage_get16bpp: ; edx y end ; edi color ;__sys_drawbar: -; mov esi, [current_slot] -; add eax, [esi+APPDATA.wnd_clientbox.left] -; add ecx, [esi+APPDATA.wnd_clientbox.left] -; add ebx, [esi+APPDATA.wnd_clientbox.top] -; add edx, [esi+APPDATA.wnd_clientbox.top] +; mov esi, [current_slot_idx] +; shl esi, BSF sizeof.WDATA +; add eax, [window_data+esi+WDATA.clientbox.left] +; add ecx, [window_data+esi+WDATA.clientbox.left] +; add ebx, [window_data+esi+WDATA.clientbox.top] +; add edx, [window_data+esi+WDATA.clientbox.top] ;-------------------------------------- ;align 4 ;.forced: diff --git a/kernel/trunk/video/blitter.inc b/kernel/trunk/video/blitter.inc index 1c0782ba75..e89a94f31c 100644 --- a/kernel/trunk/video/blitter.inc +++ b/kernel/trunk/video/blitter.inc @@ -271,9 +271,8 @@ end virtual test [esp + .flags], BLIT_CLIENT_RELATIVE jz .no_client_relative - mov eax, [current_slot] - add ebx, [eax + APPDATA.wnd_clientbox.left] - add ebp, [eax + APPDATA.wnd_clientbox.top] + add ebx, [window_data + eax + WDATA.clientbox.left] + add ebp, [window_data + eax + WDATA.clientbox.top] .no_client_relative: mov ecx, ebx diff --git a/kernel/trunk/video/cursors.inc b/kernel/trunk/video/cursors.inc index 39e59771bf..33b6ad86e5 100644 --- a/kernel/trunk/video/cursors.inc +++ b/kernel/trunk/video/cursors.inc @@ -338,7 +338,7 @@ create_cursor: mov [eax + CURSOR.hot_x], ebx mov [eax + CURSOR.hot_y], ebx - stdcall kernel_alloc, 0x1000 + stdcall kernel_alloc, PAGE_SIZE test eax, eax jz .fail @@ -392,7 +392,7 @@ align 4 mov [edi + CURSOR.hot_y], edx xchg edi, eax - mov ecx, 1024 + mov ecx, PAGE_SIZE/4 cld rep movsd jmp .add_cursor diff --git a/kernel/trunk/video/framebuffer.inc b/kernel/trunk/video/framebuffer.inc index 5eddb59808..81d655f953 100644 --- a/kernel/trunk/video/framebuffer.inc +++ b/kernel/trunk/video/framebuffer.inc @@ -156,7 +156,7 @@ init_video: or esi, PG_GLOBAL + PAT_WC + PG_UWR and esi, [pte_valid_mask] - stdcall alloc_kernel_space, 0x1000 + stdcall alloc_kernel_space, PAGE_SIZE mov edi, eax mov ebx, 4 @@ -168,15 +168,15 @@ init_video: stdcall map_page, edi, eax, PG_SWR mov eax, esi - mov ecx, 1024 + mov ecx, PAGE_SIZE/4 @@: stosd - add eax, 0x1000 + add eax, PAGE_SIZE loop @B add esi, 0x400000 add ebp, 4 - sub edi, 4096 + sub edi, PAGE_SIZE dec ebx jnz .new_pd stdcall free_kernel_space, edi @@ -185,7 +185,7 @@ init_video: .fake: mov [BOOT.mtrr], byte 2 - stdcall alloc_kernel_space, 0x1000 + stdcall alloc_kernel_space, PAGE_SIZE push eax ;store in stack for subsequent mov edi, eax ;free_kernel_space call @@ -197,13 +197,13 @@ init_video: ; max VGA=640*480*4=1228800 bytes ; + 32*640*4=81920 bytes for mouse pointer - stdcall alloc_pages, ((1228800+81920)/4096) + stdcall alloc_pages, ((1228800+81920)/PAGE_SIZE) or eax, PG_GLOBAL+PG_UWR and eax, [pte_valid_mask] - mov ecx, (1228800+81920)/4096 + mov ecx, (1228800+81920)/PAGE_SIZE @@: stosd - add eax, 0x1000 + add eax, PAGE_SIZE loop @B call free_kernel_space @@ -221,7 +221,7 @@ set_framebuffer: cli mov [_display.current_lfb], ecx .patch_pde: - lea edi, [eax + PROC.pdt_0+4096-32] ;last 8 pd entries up to 32Mb framebuffer + lea edi, [eax + PROC.pdt_0 + PAGE_SIZE -32] ;last 8 pd entries up to 32Mb framebuffer mov ecx, 4 rep movsd ;patch pde sub esi, 16