From 3e2bc5b35f1bcb25099cfb2db2df1e2ccdf146f9 Mon Sep 17 00:00:00 2001 From: Ivan Poddubny Date: Sun, 6 Aug 2006 10:29:45 +0000 Subject: [PATCH] Introduced APPDATA, TASKDATA, WNDDATA, RECT, BOX structures. git-svn-id: svn://kolibrios.org@115 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/blkdev/cdrom.inc | 2 +- kernel/trunk/blkdev/flp_drv.inc | 8 +- kernel/trunk/blkdev/rdsave.inc | 4 +- kernel/trunk/core/debug.inc | 30 ++-- kernel/trunk/core/mem.inc | 10 +- kernel/trunk/core/newproce.inc | 100 +++++------ kernel/trunk/core/physmem.inc | 4 +- kernel/trunk/core/sched.inc | 18 +- kernel/trunk/core/sync.inc | 6 +- kernel/trunk/core/sys32.inc | 64 +++---- kernel/trunk/core/syscall.inc | 2 +- kernel/trunk/fs/fat12.inc | 2 +- kernel/trunk/fs/fat32.inc | 2 +- kernel/trunk/fs/iso9660.inc | 2 +- kernel/trunk/gui/button.inc | 33 ++-- kernel/trunk/gui/event.inc | 42 ++--- kernel/trunk/gui/skincode.inc | 36 ++-- kernel/trunk/gui/window.inc | 283 +++++++++++++++---------------- kernel/trunk/hid/keyboard.inc | 4 +- kernel/trunk/kernel.asm | 284 ++++++++++++++------------------ kernel/trunk/kernel32.inc | 13 +- kernel/trunk/memmap.inc | 8 +- kernel/trunk/network/stack.inc | 12 +- kernel/trunk/network/tcp.inc | 4 +- kernel/trunk/network/udp.inc | 4 +- kernel/trunk/sound/sb16.inc | 4 +- kernel/trunk/video/vesa12.inc | 34 ++-- kernel/trunk/video/vesa20.inc | 36 ++-- kernel/trunk/video/vga.inc | 44 ++--- 29 files changed, 534 insertions(+), 561 deletions(-) diff --git a/kernel/trunk/blkdev/cdrom.inc b/kernel/trunk/blkdev/cdrom.inc index 6f8903e95b..1b6b256d3c 100644 --- a/kernel/trunk/blkdev/cdrom.inc +++ b/kernel/trunk/blkdev/cdrom.inc @@ -19,7 +19,7 @@ sys_cd_audio: cmp eax,2 jnz nocdtl mov edi,[0x3010] - add edi,0x10 + add edi,TASKDATA.mem_start add ebx,[edi] call sys_cdtracklist ret diff --git a/kernel/trunk/blkdev/flp_drv.inc b/kernel/trunk/blkdev/flp_drv.inc index b5e9cdb00b..c969d7a877 100644 --- a/kernel/trunk/blkdev/flp_drv.inc +++ b/kernel/trunk/blkdev/flp_drv.inc @@ -5,8 +5,8 @@ ; Адаптация и доработка Mario79 give_back_application_data: ; переслать приложению - mov edi,[3010h] - mov edi,[edi+10h] + mov edi,[0x3010] + mov edi,[edi+TASKDATA.mem_start] add edi,ecx give_back_application_data_1: mov esi,0xD000 ;FDD_DataBuffer ;0x40000 @@ -17,8 +17,8 @@ give_back_application_data_1: ret take_data_from_application: ; взять из приложения - mov esi,[3010h] - mov esi,[esi+10h] + mov esi,[0x3010] + mov esi,[esi+TASKDATA.mem_start] add esi,ecx take_data_from_application_1: mov edi,0xD000 ;FDD_DataBuffer ;0x40000 diff --git a/kernel/trunk/blkdev/rdsave.inc b/kernel/trunk/blkdev/rdsave.inc index 9606aba7a5..8fe849c5f3 100644 --- a/kernel/trunk/blkdev/rdsave.inc +++ b/kernel/trunk/blkdev/rdsave.inc @@ -11,8 +11,8 @@ sysfn_saveramdisk: ; 18.6 = SAVE FLOPPY IMAGE (HD version only) img_save_hd_2: cmp ebx,3 jnz exit_for_anyone - mov edx,[3010h] - mov edx,[edx+10h] + mov edx,[0x3010] + mov edx,[edx+TASKDATA.mem_start] add edx,ecx img_save_hd_3: call reserve_hd1 diff --git a/kernel/trunk/core/debug.inc b/kernel/trunk/core/debug.inc index 0b3376bef0..d8d1c02c93 100644 --- a/kernel/trunk/core/debug.inc +++ b/kernel/trunk/core/debug.inc @@ -21,7 +21,7 @@ debug_set_event_data: ; destroys eax mov eax, [0x3000] shl eax, 8 - mov [eax+0x80000+0xBC], ebx + mov [eax+0x80000+APPDATA.dbg_event_mem], ebx ret get_debuggee_slot: @@ -37,7 +37,7 @@ get_debuggee_slot: shl eax, 5 push ebx mov ebx, [0x3000] - cmp [0x80000+eax*8+0xAC], ebx + cmp [0x80000+eax*8+APPDATA.debugger_slot], ebx pop ebx jnz .ret_bad ; clc ; automatically @@ -51,7 +51,7 @@ debug_detach: ; destroys eax,ebx call get_debuggee_slot jc .ret - and dword [eax*8+0x80000+0xAC], 0 + and dword [eax*8+0x80000+APPDATA.debugger_slot], 0 call do_resume .ret: sti @@ -72,13 +72,13 @@ debug_suspend: ; destroys eax,ebx call get_debuggee_slot jc .ret - mov bl, [0x3000+eax+0xA] ; process state + mov bl, [0x3000+eax+TASKDATA.state] ; process state test bl, bl jz .1 cmp bl, 5 jnz .ret mov bl, 2 -.2: mov [0x3000+eax+0xA], bl +.2: mov [0x3000+eax+TASKDATA.state], bl .ret: sti ret @@ -87,13 +87,13 @@ debug_suspend: jmp .2 do_resume: - mov bl, [0x3000+eax+0xA] + mov bl, [0x3000+eax+TASKDATA.state] cmp bl, 1 jz .1 cmp bl, 2 jnz .ret mov bl, 5 -.2: mov [0x3000+eax+0xA], bl +.2: mov [0x3000+eax+TASKDATA.state], bl .ret: ret .1: dec ebx jmp .2 @@ -227,7 +227,7 @@ debug_set_drx: call get_debuggee_slot jc .errret mov ebp, eax - lea eax, [eax*8+0x80000+0xC0] + lea eax, [eax*8+0x80000+APPDATA.dbg_regs] ; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3 ; [eax+10]=dr7 add edx, std_application_base_address @@ -358,7 +358,7 @@ debugger_notify: .1: mov eax, ebp shl eax, 8 - mov edx, [0x80000+eax+0xBC] + mov edx, [0x80000+eax+APPDATA.dbg_event_mem] test edx, edx jz .ret ; read buffer header @@ -414,7 +414,7 @@ debugger_notify: ; new debug event mov eax, ebp shl eax, 8 - or byte [0x80000+eax+0xA8+1], 1 ; set flag 100h + or byte [0x80000+eax+APPDATA.event_mask+1], 1 ; set flag 100h .ret: ret @@ -432,7 +432,7 @@ debug_exc: ; set DRx registers for task and continue mov eax, [0x3000] shl eax, 8 - add eax, 0x80000+0xC0 + add eax, 0x80000+APPDATA.dbg_regs mov ecx, [eax+0] mov dr0, ecx mov ecx, [eax+4] @@ -455,7 +455,7 @@ debug_exc: cli mov eax, [0x3000] shl eax, 8 - mov eax, [0x80000+eax+0xAC] + mov eax, [0x80000+eax+APPDATA.debugger_slot] test eax, eax jnz .debug sti @@ -464,7 +464,7 @@ debug_exc: mov [error_interrupt], 1 call show_error_parameters mov edx, [0x3010] - mov byte [edx+0xA], 4 + mov byte [edx+TASKDATA.state], 4 jmp change_task .debug: ; we are debugged process, notify debugger and suspend ourself @@ -484,7 +484,7 @@ debug_exc: jnz .l1 push edx ; DR6 image mov ecx, [0x3010] - push dword [ecx+4] ; PID + push dword [ecx+TASKDATA.pid] ; PID push 12 pop ecx push 3 ; 3 = debug exception @@ -493,7 +493,7 @@ debug_exc: pop ecx pop ecx mov edx, [0x3010] - mov byte [edx+0xA], 1 ; suspended + mov byte [edx+TASKDATA.state], 1 ; suspended call change_task restore_ring3_context iretd diff --git a/kernel/trunk/core/mem.inc b/kernel/trunk/core/mem.inc index 5d96bd03aa..16aed7c3cf 100644 --- a/kernel/trunk/core/mem.inc +++ b/kernel/trunk/core/mem.inc @@ -188,7 +188,7 @@ create_app_cr3_table: mov eax,[general_page_table] call simple_clone_cr3_table ;clone general page table shl ebx,8 - mov [second_base_address+0x80000+ebx+0xB8],eax ;save address of page directory + mov [second_base_address+0x80000+ebx+APPDATA.dir_table],eax ;save address of page directory pop ebx ret @@ -199,7 +199,7 @@ get_cr3_table: ;result: ; eax - physical address of page directory shl eax,8 ;size of process extended information=256 bytes - mov eax,[second_base_address+0x80000+eax+0xB8] + mov eax,[second_base_address+0x80000+eax+APPDATA.dir_table] ret ;----------------------------------------------------------------------------- dispose_app_cr3_table: @@ -213,7 +213,7 @@ dispose_app_cr3_table: mov ebp,eax ;ebp = process slot in the procedure. shl eax,8 - mov eax,[second_base_address+0x80000+eax+0xB8] + mov eax,[second_base_address+0x80000+eax+APPDATA.dir_table] mov ebx,eax ;ebx = physical address of page directory call MEM_Get_Linear_Address @@ -234,10 +234,10 @@ dispose_app_cr3_table: ;eax = current slot of process mov ecx,eax shl ecx,5 - cmp byte [second_base_address+0x3000+ecx+0xa],9 ;if process running? + cmp byte [second_base_address+0x3000+ecx+TASKDATA.state],9 ;if process running? jz .next ;skip empty slots shl ecx,3 - cmp [second_base_address+0x80000+ecx+0xB8],ebx ;compare page directory addresses + cmp [second_base_address+0x80000+ecx+APPDATA.dir_table],ebx ;compare page directory addresses jnz .next inc edx ;thread found .next: diff --git a/kernel/trunk/core/newproce.inc b/kernel/trunk/core/newproce.inc index 2e5cb7157c..5f41898809 100644 --- a/kernel/trunk/core/newproce.inc +++ b/kernel/trunk/core/newproce.inc @@ -33,7 +33,7 @@ find_new_process_place: cmp eax,ebx jz .endnewprocessplace ;empty slot after high boundary add eax,0x20 - cmp word [eax+0xa],9 ;check process state, 9 means that process slot is empty + cmp word [eax+TASKDATA.state],9 ;check process state, 9 means that process slot is empty jnz .newprocessplace .endnewprocessplace: mov ebx,eax @@ -41,7 +41,7 @@ find_new_process_place: shr eax,5 ;calculate slot index cmp eax,256 jge .failed ;it should be <256 - mov word [ebx+0xa],9 ;set process state to 9 (for slot after hight boundary) + mov word [ebx+TASKDATA.state],9 ;set process state to 9 (for slot after hight boundary) mov [new_process_place],eax ;save process slot pop ebx ret @@ -113,7 +113,7 @@ new_start_application_floppy: ; mov eax,[esp] ;eax - pointer to file name mov ebx,[new_process_place] shl ebx,8 - add ebx,0x80000 + add ebx,0x80000 + APPDATA.app_name mov ecx,11 call memmove @@ -207,7 +207,7 @@ new_start_application_floppy: ;so free directory entry mov eax,[new_process_place] shl eax,8 - mov eax,[0x80000+eax+0xB8] + mov eax,[0x80000+eax+APPDATA.dir_table] call MEM_Free_Page .cleanfailed_mem: ;there is no mem for directory entry, display message. @@ -219,7 +219,7 @@ new_start_application_floppy: ;this avoid problems with panel application. mov edi,[new_process_place] shl edi,8 - add edi,0x80000 + add edi,0x80000 + APPDATA.app_name mov ecx,11 mov eax,' ' cld @@ -280,7 +280,7 @@ new_start_application_fl: mov eax,[esp] ;eax - pointer to file name mov ebx,[new_process_place] shl ebx,8 - add ebx,0x80000 + add ebx,0x80000 + APPDATA.app_name mov ecx,11 call memmove @@ -371,7 +371,7 @@ new_start_application_fl: ;so free directory entry mov eax,[new_process_place] shl eax,8 - mov eax,[0x80000+eax+0xB8] + mov eax,[0x80000+eax+APPDATA.dir_table] call MEM_Free_Page .cleanfailed_mem: ;there is no mem for directory entry, display message. @@ -383,7 +383,7 @@ new_start_application_fl: ;this avoid problems with panel application. mov edi,[new_process_place] shl edi,8 - add edi,0x80000 + add edi,0x80000+APPDATA.app_name mov ecx,11 mov eax,' ' cld @@ -417,13 +417,13 @@ new_start_application_fl: ;(size of application memory) shl ebx,8 mov eax,[app_mem] - mov [second_base_address+0x80000+0x8c+ebx],eax + mov [second_base_address+0x80000+APPDATA.mem_size+ebx],eax ;set 0x10 field of information about process ;(application base address) ; mov ebx,[new_process_place] ; shl ebx,5 shr ebx,3 - mov dword [second_base_address+0x3000+ebx+0x10],std_application_base_address + mov dword [second_base_address+0x3000+ebx+TASKDATA.mem_start],std_application_base_address ;add command line parameters .add_command_line: @@ -466,29 +466,29 @@ new_start_application_fl: mov eax,ebx shl ebx,5 add ebx,0x3000 ;ebx - pointer to information about process - mov [ebx+0xe],al ;set window number on screen = process slot + mov [ebx+TASKDATA.wnd_number],al ;set window number on screen = process slot - mov [ebx],dword 1+2+4 ;set default event flags (see 40 function) + mov [ebx+TASKDATA.event_mask],dword 1+2+4 ;set default event flags (see 40 function) inc dword [process_number] mov eax,[process_number] - mov [ebx+4],eax ;set PID + mov [ebx+TASKDATA.pid],eax ;set PID mov ecx,ebx add ecx,draw_data-0x3000 ;ecx - pointer to draw data ;set draw data to full screen - mov [ecx+0],dword 0 - mov [ecx+4],dword 0 + mov [ecx+RECT.left],dword 0 + mov [ecx+RECT.top],dword 0 mov eax,[0xfe00] - mov [ecx+8],eax + mov [ecx+RECT.right],eax mov eax,[0xfe04] - mov [ecx+12],eax + mov [ecx+RECT.bottom],eax ;set window state to 'normal' (non-minimized/maximized/rolled-up) state mov [ecx+WDATA.fl_wstate],WSTATE_NORMAL ;set cr3 register in TSS of application mov ecx,[new_process_place] shl ecx,8 - mov eax,[0x800B8+ecx] + mov eax,[0x80000+APPDATA.dir_table+ecx] add eax,8+16 ;add flags mov [l.cr3],eax @@ -566,12 +566,12 @@ new_start_application_fl: ; set if debuggee test byte [esp+28], 1 jz .no_debug - mov [0x3000+ebx+0xa], byte 1 ; set process state - suspended + mov [0x3000+ebx+TASKDATA.state], 1 ; set process state - suspended mov eax, [0x3000] - mov [0x80000+ebx*8+0xac], eax ;set debugger PID - current + mov [0x80000+ebx*8+APPDATA.debugger_slot], eax ;set debugger PID - current jmp .debug .no_debug: - mov [0x3000+ebx+0xa], byte 0 ; set process state - running + mov [0x3000+ebx+TASKDATA.state], 0 ; set process state - running .debug: mov esi,new_process_running @@ -622,22 +622,22 @@ new_sys_threads: mov esi,[0x3000] shl esi,8 - add esi,0x80000 + add esi,0x80000+APPDATA.app_name mov ebx,esi ;ebx=esi - pointer to extended information about current thread mov edi,[new_process_place] shl edi,8 add edi,0x80000 - mov edx,edi ;edx=edi - pointer to extended infomation about new thread + lea edx, [edi+APPDATA.app_name] ;edx=edi - pointer to extended infomation about new thread mov ecx,256/4 rep stosd ;clean extended information about new thread mov edi,edx mov ecx,11 rep movsb ;copy process name - mov eax,[ebx+0x8c] + mov eax,[ebx+APPDATA.mem_size] mov [app_mem],eax ;set memory size - mov eax,[ebx+0xb8] - mov [edx+0xb8],eax ;copy page directory + mov eax,[ebx+APPDATA.dir_table] + mov dword [edx-APPDATA.app_name+APPDATA.dir_table],eax ;copy page directory ; mov eax,[new_process_place] ; mov ebx,[0x3000] ; call addreference_app_cr3_table @@ -669,10 +669,10 @@ new_mem_resize: and ebx,not (4096-1) ;round up size mov ecx,[0x3000] shl ecx,8 - mov edx,[0x8008C+ecx] + mov edx,[0x80000 + APPDATA.mem_size +ecx] add edx,4095 and edx,not (4096-1) ;old size - mov eax,[0x800B8+ecx] + mov eax,[0x80000 + APPDATA.dir_table+ecx] call MEM_Get_Linear_Address ;eax - linear address of page directory call MEM_Heap_Lock ;guarantee that two threads willn't @@ -704,10 +704,10 @@ new_mem_resize: mov ebx,esi mov eax,[0x3000] shl eax,8 - mov [eax+0x8008c],ebx ;write new memory size + mov [eax+0x80000 + APPDATA.mem_size],ebx ;write new memory size ;search threads and update ;application memory size infomation - mov ecx,[eax+0x800b8] + mov ecx,[eax+0x80000 + APPDATA.dir_table] mov eax,2 .search_threads: @@ -718,12 +718,12 @@ new_mem_resize: jg .search_threads_end mov edx,eax shl edx,5 - cmp word [0x3000+edx+0xa],9 ;if slot empty? + cmp word [0x3000+edx+TASKDATA.state],9 ;if slot empty? jz .search_threads_next shl edx,3 - cmp [edx+0x800b8],ecx ;if it is our thread? + cmp [edx+0x80000+APPDATA.dir_table],ecx ;if it is our thread? jnz .search_threads_next - mov [edx+0x8008c],ebx ;update memory size + mov [edx+0x80000+APPDATA.mem_size],ebx ;update memory size .search_threads_next: inc eax jmp .search_threads @@ -753,9 +753,9 @@ pid_to_slot: .loop: ;ecx=offset of current process info entry ;ebx=maximum permitted offset - cmp byte [second_base_address+0x3000+ecx+0xa],9 + cmp byte [second_base_address+0x3000+ecx+TASKDATA.state],9 jz .endloop ;skip empty slots - cmp [second_base_address+0x3000+ecx+0x4],eax ;check PID + cmp [second_base_address+0x3000+ecx+TASKDATA.pid],eax ;check PID jz .pid_found .endloop: add ecx,32 @@ -801,7 +801,7 @@ write_process_memory: ; eax - number of bytes written pushad shl eax,8 - mov eax,[0x80000+eax+0xB8] + mov eax,[0x80000+eax+APPDATA.dir_table] call MEM_Get_Linear_Address mov ebp,eax ;ebp=linear address of page directory of other process. @@ -906,7 +906,7 @@ read_process_memory: ; eax - number of bytes read. pushad shl eax,8 - mov eax,[0x80000+eax+0xB8] + mov eax,[0x80000+eax+APPDATA.dir_table] call MEM_Get_Linear_Address mov ebp,eax add edx,std_application_base_address @@ -1009,10 +1009,10 @@ check_process_region: test ecx,ecx jle .ok shl eax,5 - cmp word [0x3000+eax+0xa],0 + cmp word [0x3000+eax+TASKDATA.state],0 jnz .failed shl eax,3 - mov eax,[0x80000+eax+0xb8] + mov eax,[0x80000+eax+APPDATA.dir_table] test eax,eax jz .failed call MEM_Get_Linear_Address @@ -1081,8 +1081,8 @@ new_sys_ipc: shl edi,8 add edi,0x80000 cli - mov [edi+0xA0],ebx ;set fields in extended information area - mov [edi+0xA4],ecx + mov [edi+APPDATA.ipc_start],ebx ;set fields in extended information area + mov [edi+APPDATA.ipc_size],ecx sti mov [esp+36],dword 0 ;success ret @@ -1100,10 +1100,10 @@ new_sys_ipc: mov ebp,eax ;ebp = slot of other process shl eax,8 - mov edi,[eax+0x80000+0xa0] ;is ipc area defined? + mov edi,[eax+0x80000+APPDATA.ipc_start] ;is ipc area defined? test edi,edi jz .no_ipc_area - mov esi,[eax+0x80000+0xa4] ;esi - size of buffer + mov esi,[eax+0x80000+APPDATA.ipc_size] ;esi - size of buffer push dword -1 ;temp variable for read_process_memory mov ebx,esp push ecx @@ -1131,7 +1131,7 @@ new_sys_ipc: add edx,esi sub edx,4 ;move to beginning of place for our message mov eax,[second_base_address+0x3010] - mov eax,[eax+0x4] ;eax - our PID + mov eax,[eax+TASKDATA.pid] ;eax - our PID mov [esp+8],eax mov eax,ebp call write_process_memory ;write PID @@ -1151,7 +1151,7 @@ new_sys_ipc: ;awake other process shl ebp,8 mov eax,ebp - or [eax+0x800A8],dword 0x40 + or [eax+0x80000+APPDATA.event_mask],dword 0x40 cmp dword [check_idle_semaphore],20 jge .ipc_no_cis @@ -1237,7 +1237,7 @@ new_start_application_hd: lea esi,[eax-11] ;last 11 bytes = application name mov edi,[new_process_place] shl edi,8 - add edi,0x80000 + add edi,0x80000+APPDATA.app_name mov ecx,11 cld rep movsb ;copy name to extended information about process @@ -1366,7 +1366,7 @@ new_start_application_hd: ;so free directory entry mov eax,[new_process_place] shl eax,8 - mov eax,[0x80000+eax+0xB8] + mov eax,[0x80000+eax+APPDATA.dir_table] call MEM_Free_Page .cleanfailed_mem: ;there is no mem for directory entry, display message. @@ -1378,7 +1378,7 @@ new_start_application_hd: ;this avoid problems with panel application. mov edi,[new_process_place] shl edi,8 - add edi,0x80000 + add edi,0x80000+APPDATA.app_name mov ecx,11 mov eax,' ' cld @@ -1455,7 +1455,7 @@ fs_execute: mov ecx, 8 ; 8 chars for name mov edi, [new_process_place] shl edi, cl - add edi, 0x80000 + add edi, 0x80000+APPDATA.app_name .copy_process_name_loop: lodsb cmp al, '.' @@ -1600,7 +1600,7 @@ fs_execute: ; clean process name, this avoid problems with @panel mov edi, [new_process_place] shl edi, 8 - add edi, 0x80000 + add edi, 0x80000+APPDATA.app_name mov ecx, 11 mov al, ' ' rep stosb diff --git a/kernel/trunk/core/physmem.inc b/kernel/trunk/core/physmem.inc index eed9d19e69..90d08ab294 100644 --- a/kernel/trunk/core/physmem.inc +++ b/kernel/trunk/core/physmem.inc @@ -95,7 +95,7 @@ Allocate_Physical_Block: mov eax,[esi+physical_mem_block.start] mov [esp+28],eax mov eax,[0x3010] - mov eax,[eax+0x4] + mov eax,[eax+TASKDATA.pid] mov [esi+physical_mem_block.flags],eax popad ret @@ -105,7 +105,7 @@ Allocate_Physical_Block: mov eax,[esi+physical_mem_block.start] mov [esp+28],eax mov ecx,[0x3010] - mov ecx,[ecx+0x4] + mov ecx,[ecx+TASKDATA.pid] mov [esi+physical_mem_block.flags],ecx mov ecx,[esi+physical_mem_block.size] mov [esi+physical_mem_block.size],ebx diff --git a/kernel/trunk/core/sched.inc b/kernel/trunk/core/sched.inc index 56001a184d..5effb54a4b 100644 --- a/kernel/trunk/core/sched.inc +++ b/kernel/trunk/core/sched.inc @@ -91,11 +91,11 @@ endg update_counters: mov edi, [0x3010] - mov ebx, [edi+0x18] ; time stamp counter add + mov ebx, [edi+TASKDATA.counter_add] ; time stamp counter add call _rdtsc sub eax, ebx - add eax, [edi+0x14] ; counter sum - mov [edi+0x14], eax + add eax, [edi+TASKDATA.counter_sum] ; counter sum + mov [edi+TASKDATA.counter_sum], eax ret @@ -123,7 +123,7 @@ find_next_task: add edi,0x20 inc ebx - mov al, byte [edi+0xA] + mov al, byte [edi+TASKDATA.state] test al, al jz .found cmp al, 1 @@ -146,13 +146,13 @@ find_next_task: test eax, eax jz .waiting_for_event mov [event_sched], eax - mov [edi+0xA], byte 0 + mov [edi+TASKDATA.state], byte 0 .noevents: .found: mov [0x3000],ebx mov [0x3010],edi call _rdtsc - mov [edi+0x18],eax + mov [edi+TASKDATA.counter_add],eax xor eax, eax cmp ebx, [prev_slot] @@ -181,9 +181,9 @@ updatecputimes: mov ecx, [0x3004] mov edi, 0x3020 .newupdate: - mov ebx,[edi+0x14] - mov [edi+0x1c],ebx - mov [edi+0x14],dword 0 + mov ebx,[edi+TASKDATA.counter_sum] + mov [edi+TASKDATA.cpu_usage],ebx + mov [edi+TASKDATA.counter_sum],dword 0 add edi,0x20 dec ecx jnz .newupdate diff --git a/kernel/trunk/core/sync.inc b/kernel/trunk/core/sync.inc index 1f50a74e46..c5f04a37fb 100644 --- a/kernel/trunk/core/sync.inc +++ b/kernel/trunk/core/sync.inc @@ -27,7 +27,7 @@ start_wait=$ ok=$ push eax mov eax,dword [0x3010+second_base_address] - mov eax,[eax+0x4] + mov eax,[eax+TASKDATA.pid] mov [name],eax pop eax sti @@ -61,7 +61,7 @@ macro WaitSimpleCriticalSection name local start_wait,first_wait,inc_counter,end_wait push eax mov eax,[0x3010+second_base_address] - mov eax,[eax+0x4] + mov eax,[eax+TASKDATA.pid] start_wait=$ cli cmp [name],dword 0 @@ -93,7 +93,7 @@ macro TryWaitSimpleCriticalSection name ;result in eax and in flags { local ok,try_end mov eax,[0x3000+second_base_address] - mov eax,[eax+0x4] + mov eax,[eax+TASKDATA.pid] cmp [name],eax jz ok cmp [name],0 diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index 8325063d98..564734f76e 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -228,7 +228,7 @@ exc_c: cli mov eax, [0x3000] shl eax, 8 - mov eax, [0x80000+eax+0xAC] + mov eax, [0x80000+eax+APPDATA.debugger_slot] test eax, eax jnz .debug sti @@ -239,7 +239,7 @@ exc_c: call show_error_parameters mov edx, [0x3010] - mov [edx + 0xA], byte 4 + mov [edx + TASKDATA.state], byte 4 jmp change_task @@ -250,7 +250,7 @@ exc_c: movzx ecx, bl push ecx mov ecx, [0x3010] - push dword [ecx+4] ; PID of current process + push dword [ecx+TASKDATA.pid] ; PID of current process push 12 pop ecx push 1 ; 1=exception @@ -259,7 +259,7 @@ exc_c: pop ecx pop ecx mov edx, [0x3010] - mov byte [edx+0xA], 1 ; suspended + mov byte [edx+TASKDATA.state], 1 ; suspended call change_task restore_ring3_context iretd @@ -278,18 +278,18 @@ e7: mov eax, [prev_user_of_fpu] shl eax, 8 - add eax, 0x80000 + 0x10 + add eax, 0x80000 + APPDATA.fpu_save_area fsave [eax] mov eax, [0x3000] mov [prev_user_of_fpu], eax shl eax, 8 add eax, 0x80000 - cmp [eax + 0x7f], byte 0 + cmp [eax + APPDATA.is_fpu_saved], 0 je @f - frstor [eax+0x10] + frstor [eax+APPDATA.fpu_save_area] @@: - mov [eax + 0x7f], byte 1 + mov [eax + APPDATA.is_fpu_saved], 1 restore_ring3_context iret @@ -338,7 +338,7 @@ show_error_parameters: mov [write_error_to],process_pid+43 mov eax,[0x3000] shl eax, 5 - mov eax,[0x3000+4+eax] + mov eax,[0x3000+TASKDATA.pid+eax] call writehex mov [write_error_to],process_error+43 @@ -556,7 +556,7 @@ set_application_table_status: mov eax,[0x3000] shl eax, 5 - add eax,0x3000+4 + add eax,0x3000+TASKDATA.pid mov eax,[eax] mov [application_table_status],eax @@ -571,7 +571,7 @@ clear_application_table_status: mov eax,[0x3000] shl eax, 5 - add eax,0x3000+4 + add eax,0x3000+TASKDATA.pid mov eax,[eax] cmp eax,[application_table_status] @@ -676,17 +676,17 @@ uglobal app_esp dd 0x0 app_i_param dd 0x0 app_i_icon dd 0x0 - app_mem_pos dd 0x0 + ;app_mem_pos dd 0x0 appl_path dd 0x0 appl_path_size dd 0x0 endg -iglobal - hd_app_string db 'HDAPP ' - process_loading db 'K : Process - loading ',13,10,0 - process_running db 'K : Process - done',13,10,0 - first_gdt_search dd 0x2 -endg +;iglobal + ;hd_app_string db 'HDAPP ' + ;process_loading db 'K : Process - loading ',13,10,0 + ;process_running db 'K : Process - done',13,10,0 + ;first_gdt_search dd 0x2 +;endg sys_threads: @@ -812,10 +812,10 @@ terminate: ; terminate application mov [esi+WDATA.box.top],eax mov [esi+WDATA.box.height], 5 xor eax, eax - mov [esi+16],eax - mov [esi+20],eax - mov [esi+24],eax - mov [esi+28],eax + mov [esi+WDATA.cl_workarea],eax + mov [esi+WDATA.cl_titlebar],eax + mov [esi+WDATA.cl_frames],eax + mov dword [esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn lea edi, [esi-window_data+draw_data] mov ecx,32/4 rep stosd @@ -825,12 +825,12 @@ terminate: ; terminate application pushad mov edi, esi shl edi, 5 - mov eax, [0x80000+edi*8+0xAC] + mov eax, [0x80000+edi*8+APPDATA.debugger_slot] test eax, eax jz .nodebug push 8 pop ecx - push dword [0x3000+edi+0x4] ; PID + push dword [0x3000+edi+TASKDATA.pid] ; PID push 2 call debugger_notify pop ecx @@ -850,7 +850,7 @@ terminate: ; terminate application pusha ; name to spaces mov edi,esi shl edi,8 - add edi,0x80000 + add edi,0x80000+APPDATA.app_name mov ecx,11 mov eax,' ' rep stosb @@ -869,7 +869,7 @@ terminate: ; terminate application lea esi, [0xc400+eax*2] movzx edi, word [esi] ; edi = process shl edi, 5 - cmp [0x3000 + edi + 0xa], byte 9 ; skip dead slots + cmp [0x3000 + edi + TASKDATA.state], byte 9 ; skip dead slots je .check_next_window add edi, window_data call waredraw @@ -896,8 +896,8 @@ terminate: ; terminate application pusha ; remove all irq reservations mov eax,esi - shl eax, 5 ;imul edx,0x20 - mov eax,[edx+0x3000+4] + shl eax, 5 + mov eax,[edx+0x3000+TASKDATA.pid] mov edi,irq_owner mov ecx,16 newirqfree: @@ -911,9 +911,9 @@ terminate: ; terminate application pusha ; remove all port reservations mov edx,esi - shl edx, 5 ;imul edx,0x20 + shl edx, 5 add edx,0x3000 - mov edx,[edx+4] + mov edx,[edx+TASKDATA.pid] rmpr0: @@ -956,10 +956,10 @@ terminate: ; terminate application popa mov edi,esi ; do not run this process slot shl edi, 5 - mov [edi+0x300A],byte 9 + mov [edi+0x3000 + TASKDATA.state],byte 9 ; debugger test - terminate all debuggees mov eax, 2 - mov ecx, 0x80000+2*0x100+0xAC + mov ecx, 0x80000+2*0x100+APPDATA.debugger_slot .xd0: cmp eax, [0x3004] ja .xd1 diff --git a/kernel/trunk/core/syscall.inc b/kernel/trunk/core/syscall.inc index 4f1ebe7fdf..7e9a5381d9 100644 --- a/kernel/trunk/core/syscall.inc +++ b/kernel/trunk/core/syscall.inc @@ -40,7 +40,7 @@ i40: align 4 save_registers: mov esi, [0x3010] - mov eax, [esi+0x4] ; load PID + mov eax, [esi+TASKDATA.pid] ; load PID lea esi, [esp+4] inc [save_syscall_count] mov edi,[save_syscall_count] diff --git a/kernel/trunk/fs/fat12.inc b/kernel/trunk/fs/fat12.inc index 22b78a6890..079fed4832 100644 --- a/kernel/trunk/fs/fat12.inc +++ b/kernel/trunk/fs/fat12.inc @@ -33,7 +33,7 @@ reserve_flp: push eax mov eax,[0x3000] shl eax,5 - mov eax,[eax+0x3000+4] + mov eax,[eax+0x3000+TASKDATA.pid] mov [flp_status],eax pop eax sti diff --git a/kernel/trunk/fs/fat32.inc b/kernel/trunk/fs/fat32.inc index b3d078bb50..ac4912dfa8 100644 --- a/kernel/trunk/fs/fat32.inc +++ b/kernel/trunk/fs/fat32.inc @@ -124,7 +124,7 @@ reserve_hd1: push eax mov eax,[0x3000] shl eax,5 - mov eax,[eax+0x3000+4] + mov eax,[eax+0x3000+TASKDATA.pid] mov [hd1_status],eax pop eax sti diff --git a/kernel/trunk/fs/iso9660.inc b/kernel/trunk/fs/iso9660.inc index b863fcf9c1..196d6ef1cf 100644 --- a/kernel/trunk/fs/iso9660.inc +++ b/kernel/trunk/fs/iso9660.inc @@ -25,7 +25,7 @@ reserve_cd: push eax mov eax,[0x3000] shl eax,5 - mov eax,[eax+0x3000+4] + mov eax,[eax+0x3000+TASKDATA.pid] mov [cd_status],eax pop eax sti diff --git a/kernel/trunk/gui/button.inc b/kernel/trunk/gui/button.inc index 7246b5da8a..4d7492c2d9 100644 --- a/kernel/trunk/gui/button.inc +++ b/kernel/trunk/gui/button.inc @@ -70,8 +70,8 @@ drawbuttonframes: shr ebx,16 mov edx,[0x3010] - add eax,[edx-twdw] - add ebx,[edx-twdw+4] + add eax,[edx-twdw + WDATA.box.left] + add ebx,[edx-twdw + WDATA.box.top] mov cx,ax mov dx,bx shl eax,16 @@ -198,8 +198,8 @@ sys_button: shr eax,16 shr ebx,16 mov edx,[0x3010] - mov esi,[edx-twdw] - mov edi,[edx-twdw+4] + mov esi,[edx-twdw + WDATA.box.left] + mov edi,[edx-twdw + WDATA.box.top] add eax,esi add ebx,edi mov cx,ax @@ -237,9 +237,6 @@ sys_button: and ecx,0xffff - mov edi,[0x3010] - sub edi,twdw - mov edi,[0xfe88] movzx eax,word [edi] cmp eax,max_buttons @@ -331,20 +328,20 @@ find_pressed_button_frames: movzx ebx,word [eax+0] shl ebx,5 add ebx,window_data - movzx ecx,word [ebx+0] ; window x start + mov ecx, [ebx+ WDATA.box.left] ; window x start movzx edx,word [eax+4] ; button x start add ecx,edx push ecx - mov dx,[eax+6] ; button x size + mov dx,[eax+6] ; button x size add cx,dx mov esi,ecx inc esi - mov cx,[ebx+4] ; window y start - mov dx,[eax+8] ; button y start + mov ecx, [ebx+WDATA.box.top] ; window y start + mov dx,[eax+8] ; button y start add ecx,edx mov ebx,ecx - mov dx,[eax+10] ; button y size + mov dx,[eax+10] ; button y size add dx,cx inc dx @@ -521,12 +518,12 @@ checkbuttons: ; add ebx,window_data ; mov ecx,[window_data+ebx+8] ; window end X movzx edx,word [eax+4] ; button start X - cmp edx, [window_data+ebx+8] ;ecx + cmp edx, [window_data+ebx+WDATA.box.width] ;ecx jge buttonnewcheck ; mov ecx,[window_data+ebx+12] ; window end Y movzx edx, word [eax+8] ; button start Y - cmp edx, [window_data+ebx+12] ;ecx + cmp edx, [window_data+ebx+WDATA.box.height] ;ecx jge buttonnewcheck ; check coordinates @@ -534,7 +531,7 @@ checkbuttons: movzx ebx,word [eax+0] shl ebx,5 add ebx,window_data - movzx ecx,word [ebx+0] ; window x start + mov ecx, [ebx+WDATA.box.left] ; window x start movzx edx,word [eax+4] ; button x start add edx,ecx mov cx,[0xfb0a] @@ -550,7 +547,7 @@ checkbuttons: movzx ebx,word [eax+0] shl ebx,5 add ebx,window_data - movzx ecx,word [ebx+4] ; window y start + mov ecx, [ebx+WDATA.box.top] ; window y start movzx edx,word [eax+8] ; button y start add edx,ecx mov cx,[0xfb0c] @@ -605,7 +602,7 @@ checkbuttons: movzx ebx,word [eax+0] shl ebx,5 add ebx,window_data - movzx ecx,word [ebx+0] ; window x start + mov ecx, [ebx+WDATA.box.left] ; window x start movzx edx,word [eax+4] ; button x start add edx,ecx mov cx,[0xfb0a] @@ -621,7 +618,7 @@ checkbuttons: movzx ebx,word [eax+0] shl ebx,5 add ebx,window_data - movzx ecx,word [ebx+4] ; window y start + mov ecx, [ebx+WDATA.box.top] ; window y start movzx edx,word [eax+8] ; button y start add edx,ecx mov cx,[0xfb0c] diff --git a/kernel/trunk/gui/event.inc b/kernel/trunk/gui/event.inc index 3c71fb1c4c..ebd8000872 100644 --- a/kernel/trunk/gui/event.inc +++ b/kernel/trunk/gui/event.inc @@ -37,7 +37,7 @@ sys_waitforevent: newwait: mov eax, [0x3010] - mov [eax+0xA], byte 5 + mov [eax+TASKDATA.state], byte 5 call change_task mov eax, [event_sched] @@ -52,10 +52,10 @@ get_event_for_app: pushad mov edi,[0x3010] ; WINDOW REDRAW - test [edi],dword 1 + test [edi+TASKDATA.event_mask],dword 1 jz no_eventoccur1 ;mov edi,[0x3010] - cmp [edi-twdw+31],byte 0 + cmp [edi-twdw+WDATA.fl_redraw],byte 0 je no_eventoccur1 popad mov eax,1 @@ -63,7 +63,7 @@ get_event_for_app: no_eventoccur1: ;mov edi,[0x3010] ; KEY IN BUFFER - test [edi],dword 2 + test [edi+TASKDATA.event_mask],dword 2 jz no_eventoccur2 mov ecx, [0x3000] movzx edx,word [0xC000+ecx*2] @@ -87,7 +87,7 @@ get_event_for_app: no_eventoccur2: ;mov edi,[0x3010] ; BUTTON IN BUFFER - test [edi],dword 4 + test [edi+TASKDATA.event_mask],dword 4 jz no_eventoccur3 cmp [0xf500],byte 0 je no_eventoccur3 @@ -113,13 +113,13 @@ get_event_for_app: ;mov edi,[0x3010] ; mouse event - test [edi],dword 00100000b + test [edi+TASKDATA.event_mask],dword 00100000b jz no_mouse_event mov eax,[0x3000] shl eax,8 - test [eax+0x80000+0xA8],dword 00100000b + test [eax+0x80000+APPDATA.event_mask],dword 00100000b jz no_mouse_event - and [eax+0x80000+0xA8],dword 0xffffffff-00100000b + and [eax+0x80000+APPDATA.event_mask],dword 0xffffffff-00100000b popad mov eax,6 ret @@ -127,7 +127,7 @@ get_event_for_app: ;mov edi,[0x3010] ; DESKTOP BACKGROUND REDRAW - test [edi],dword 16 + test [edi+TASKDATA.event_mask],dword 16 jz no_eventoccur5 cmp [0xfff0],byte 2 jnz no_eventoccur5 @@ -137,13 +137,13 @@ get_event_for_app: no_eventoccur5: ;mov edi,[0x3010] ; IPC - test [edi],dword 01000000b + test [edi+TASKDATA.event_mask],dword 01000000b jz no_ipc mov eax,[0x3000] shl eax,8 - test [eax+0x80000+0xA8],dword 01000000b + test [eax+0x80000+APPDATA.event_mask],dword 01000000b jz no_ipc - and [eax+0x80000+0xA8],dword 0xffffffff-01000000b + and [eax+0x80000+APPDATA.event_mask],dword 0xffffffff-01000000b popad mov eax,7 ret @@ -151,31 +151,31 @@ get_event_for_app: ;mov edi,[0x3010] ; STACK - test [edi],dword 10000000b + test [edi+TASKDATA.event_mask],dword 10000000b jz no_stack_event mov eax,[0x3000] shl eax,8 - test [eax+0x80000+0xA8],dword 10000000b + test [eax+0x80000+APPDATA.event_mask],dword 10000000b jz no_stack_event - and [eax+0x80000+0xA8],dword 0xffffffff-10000000b + and [eax+0x80000+APPDATA.event_mask],dword 0xffffffff-10000000b popad mov eax,8 ret no_stack_event: - test byte [edi+1], 1 ; DEBUG + test byte [edi+TASKDATA.event_mask+1], 1 ; DEBUG jz no_debug_event mov eax, [0x3000] shl eax, 8 - test [eax+0x80000+0xA8+1], byte 1 + test byte [eax+0x80000+APPDATA.event_mask+1], byte 1 jz no_debug_event - and byte [eax+0x80000+0xA8+1], not 1 + and byte [eax+0x80000+APPDATA.event_mask+1], not 1 popad mov eax, 9 ret no_debug_event: - cmp dword [edi], 0xFFFF + cmp dword [edi+TASKDATA.event_mask], 0xFFFF jbe no_events mov esi,0x2e0000 ; IRQ'S AND DATA @@ -183,14 +183,14 @@ get_event_for_app: xor ecx, ecx irq_event_test: mov edi,[0x3010] - test [edi],ebx + test [edi+TASKDATA.event_mask],ebx jz no_irq_event mov edi,ecx shl edi,2 add edi,irq_owner mov edx,[edi] mov eax,[0x3010] - mov eax,[eax+0x4] + mov eax,[eax+TASKDATA.pid] cmp edx,eax jne no_irq_event cmp [esi],dword 0 diff --git a/kernel/trunk/gui/skincode.inc b/kernel/trunk/gui/skincode.inc index 31ff3a0492..60f28fdd1a 100644 --- a/kernel/trunk/gui/skincode.inc +++ b/kernel/trunk/gui/skincode.inc @@ -203,7 +203,7 @@ drawwindow_IV_caption: @@: mov esi,[esp+4] - mov eax,[esi+8] ; window width + mov eax,[esi+WDATA.box.width] ; window width mov edx,[ebp+SKIN_DATA.left.left] shl edx,16 mov ecx,[ebp+SKIN_DATA.left.width] @@ -214,7 +214,7 @@ drawwindow_IV_caption: call sys_putimage_with_check mov esi,[esp+4] - mov eax,[esi+8] + mov eax,[esi+WDATA.box.width] sub eax,[ebp+SKIN_DATA.left.width] sub eax,[ebp+SKIN_DATA.oper.width] cmp eax,[ebp+SKIN_DATA.base.left] @@ -247,7 +247,7 @@ drawwindow_IV_caption: .non_base: mov esi,[esp+4] - mov edx,[esi+8] + mov edx,[esi+WDATA.box.width] sub edx,[ebp+SKIN_DATA.oper.width] inc edx shl edx,16 @@ -278,14 +278,14 @@ drawwindow_IV: mov ebp,skin_inactive @@: - mov eax,[edi+0] + mov eax,[edi+WDATA.box.left] shl eax,16 - mov ax,[edi+0] - add ax,[edi+8] - mov ebx,[edi+4] + mov ax,word [edi+WDATA.box.left] + add ax,word [edi+WDATA.box.width] + mov ebx,[edi+WDATA.box.top] shl ebx,16 - mov bx,[edi+4] - add bx,[edi+12] + mov bx,word [edi+WDATA.box.top] + add bx,word [edi+WDATA.box.height] ; mov esi,[edi+24] ; shr esi,1 ; and esi,0x007f7f7f @@ -317,7 +317,7 @@ drawwindow_IV: xor eax,eax xor ebx,ebx mov esi,[esp] - mov ecx,[esi+8] + mov ecx,[esi+WDATA.box.width] inc ecx mov edx,[_skinh] mov edi,[common_colours+4] ; standard grab color @@ -332,19 +332,19 @@ drawwindow_IV: mov esi,[esp] - mov edx,[esi+04] ; WORK AREA + mov edx,[esi+WDATA.box.top] ; WORK AREA add edx,21+5 - mov ebx,[esi+04] - add ebx,[esi+12] + mov ebx,[esi+WDATA.box.top] + add ebx,[esi+WDATA.box.height] cmp edx,ebx jg _noinside2 mov eax,5 mov ebx,[_skinh] - mov ecx,[esi+8] - mov edx,[esi+12] + mov ecx,[esi+WDATA.box.width] + mov edx,[esi+WDATA.box.height] sub ecx,4 sub edx,4 - mov edi,[esi+16] + mov edi,[esi+WDATA.cl_workarea] call [drawbar] _noinside2: @@ -373,7 +373,7 @@ drawwindow_IV: cmp [skin_btn_close.left],0 jge _bCx_at_right mov ebx,[esp] - mov ebx,[ebx+8] + mov ebx,[ebx+WDATA.box.width] inc ebx _bCx_at_right: add ebx,[skin_btn_close.left] @@ -412,7 +412,7 @@ drawwindow_IV: cmp [skin_btn_minimize.left],0 jge _bMx_at_right mov ebx,[esp] - mov ebx,[ebx+8] + mov ebx,[ebx+WDATA.box.width] inc ebx _bMx_at_right: add ebx,[skin_btn_minimize.left] diff --git a/kernel/trunk/gui/window.inc b/kernel/trunk/gui/window.inc index 915714d1f9..ce2e3fd947 100644 --- a/kernel/trunk/gui/window.inc +++ b/kernel/trunk/gui/window.inc @@ -68,7 +68,7 @@ calculatescreen: movzx edi, word [0xC400 + esi * 2] shl edi, 5 - cmp [0x3000+edi+0xa], byte 9 + cmp [0x3000+edi+TASKDATA.state], byte 9 je .not_wnd add edi, window_data @@ -147,8 +147,8 @@ setscreen: pushad mov edi, esi ;;;word [esi*2+0xc400] shl edi, 8 - add edi, 0x80000+0x80 ; address of random shaped window area - cmp [edi], dword 0 + add edi, 0x80000 ; address of random shaped window area + cmp [edi+APPDATA.wnd_shape], dword 0 jne .free_form ; get x&y size @@ -214,7 +214,7 @@ pushad inc ecx inc edx - push dword [edi+4] ; push scale first -> for loop + push dword [edi+APPDATA.wnd_shape_scale] ; push scale first -> for loop ; get WinMap start -> ebp push eax @@ -225,7 +225,7 @@ pushad add eax, WinMapAddress mov ebp, eax - mov edi, [edi] + mov edi, [edi+APPDATA.wnd_shape] pop eax ; eax = x_start @@ -364,7 +364,7 @@ display_settings: jne no_com_colours mov [windowtypechanged],dword 1 mov esi,[0x3010] - add esi,0x10 + add esi,TASKDATA.mem_start add ebx,[esi] mov esi,ebx mov edi,common_colours @@ -378,7 +378,7 @@ display_settings: cmp eax,3 ; get common window colours jne no_get_com mov esi,[0x3010] - add esi,0x10 + add esi,TASKDATA.mem_start add ebx,[esi] mov edi,ebx mov esi,common_colours @@ -457,7 +457,7 @@ display_settings: jne no_set_skin mov eax,ebx mov edi,[0x3010] - add ebx,[edi+0x10] ; abs start of info block + add ebx,[edi+TASKDATA.mem_start] ; abs start of info block pushd [ebx+0] [ebx+4] [ebx+8] [ebx+12] mov dword[ebx+0],0 ; read mov dword[ebx+4],0 ; from the beginning @@ -567,16 +567,16 @@ check_window_position: pushad ; window inside screen ? - movzx eax,word [edi+0] - movzx ebx,word [edi+4] - movzx ecx,word [edi+8] - movzx edx,word [edi+12] + movzx eax,word [edi+WDATA.box.left] + movzx ebx,word [edi+WDATA.box.top] + movzx ecx,word [edi+WDATA.box.width] + movzx edx,word [edi+WDATA.box.height] mov esi,ecx ; check x pos add esi,eax cmp esi,[0xfe00] jbe x_pos_ok - mov [edi+0],dword 0 + mov [edi+WDATA.box.left],dword 0 xor eax, eax x_pos_ok: @@ -584,7 +584,7 @@ check_window_position: add esi,ebx cmp esi,[0xfe04] jbe y_pos_ok - mov [edi+4],dword 0 + mov [edi+WDATA.box.top],dword 0 mov ebx,0 y_pos_ok: @@ -593,7 +593,7 @@ check_window_position: cmp esi,[0xfe00] jbe x_size_ok mov ecx,[0xfe00] - mov [edi+8],ecx + mov [edi+WDATA.box.width],ecx x_size_ok: mov esi,edx ; check y size @@ -601,7 +601,7 @@ check_window_position: cmp esi,[0xfe04] jbe y_size_ok mov edx,[0xfe04] - mov [edi+12],edx + mov [edi+WDATA.box.height],edx y_size_ok: popad @@ -618,7 +618,7 @@ sys_window_mouse: push eax - mov eax,[timer_ticks] ;[0xfdf0] + mov eax,[timer_ticks] cmp [new_window_starting],eax jb swml1 @@ -638,15 +638,15 @@ sys_window_mouse: drawwindow_I_caption: - mov ecx,[edx+20] ; grab bar + mov ecx,[edx+WDATA.cl_titlebar] ; grab bar push ecx mov esi,edx - mov edx,[esi+04] + mov edx,[esi+WDATA.box.top] add edx,1 - mov ebx,[esi+04] + mov ebx,[esi+WDATA.box.top] add ebx,21 - mov eax,[esi+04] - add eax,[esi+12] + mov eax,[esi+WDATA.box.top] + add eax,[esi+WDATA.box.height] cmp ebx,eax jb .wdsizeok mov ebx,eax @@ -656,25 +656,25 @@ drawwindow_I_caption: mov ebx,edx shl ebx,16 add ebx,edx - mov eax,[esi+00] + mov eax,[esi+WDATA.box.left] inc eax shl eax,16 - add eax,[esi+00] - add eax,[esi+8] + add eax,[esi+WDATA.box.left] + add eax,[esi+WDATA.box.width] sub eax,1 push edx mov edx,0x80000000 - mov ecx,[esi+20] + mov ecx,[esi+WDATA.cl_titlebar] and ecx,edx cmp ecx,edx jnz .nofa - mov ecx,[esi+20] + mov ecx,[esi+WDATA.cl_titlebar] sub ecx,0x00040404 - mov [esi+20],ecx + mov [esi+WDATA.cl_titlebar],ecx and ecx,0x00ffffff jmp .faj .nofa: - mov ecx,[esi+20] + mov ecx,[esi+WDATA.cl_titlebar] and ecx,0x00ffffff .faj: pop edx @@ -685,7 +685,7 @@ drawwindow_I_caption: jb .drwi add esp,4 pop ecx - mov [esi+20],ecx + mov [esi+WDATA.cl_titlebar],ecx ret @@ -694,30 +694,30 @@ drawwindow_I: pushad - mov esi,[edx+24] ; rectangle - mov eax,[edx+0] + mov esi,[edx+WDATA.cl_frames] ; rectangle + mov eax,[edx+WDATA.box.left] shl eax,16 - add eax,[edx+0] - add eax,[edx+8] - mov ebx,[edx+04] + add eax,[edx+WDATA.box.left] + add eax,[edx+WDATA.box.width] + mov ebx,[edx+WDATA.box.top] shl ebx,16 - add ebx,[edx+4] - add ebx,[edx+12] + add ebx,[edx+WDATA.box.top] + add ebx,[edx+WDATA.box.height] call draw_rectangle call drawwindow_I_caption - mov edx,[esi+04] ; inside work area + mov edx,[esi+WDATA.box.top] ; inside work area add edx,21+5 - mov ebx,[esi+04] - add ebx,[esi+12] + mov ebx,[esi+WDATA.box.top] + add ebx,[esi+WDATA.box.height] cmp edx,ebx jg noinside mov eax,1 mov ebx,21 - mov ecx,[esi+8] - mov edx,[esi+12] - mov edi,[esi+16] + mov ecx,[esi+WDATA.box.width] + mov edx,[esi+WDATA.box.height] + mov edi,[esi+WDATA.cl_workarea] call [drawbar] noinside: @@ -771,15 +771,15 @@ r_bx equ [esp+18] ; y end drawwindow_III_caption: - mov ecx,[edx+20] ; GRAB BAR + mov ecx,[edx+WDATA.cl_titlebar] ; GRAB BAR push ecx mov esi,edx - mov edx,[esi+04] + mov edx,[esi+WDATA.box.top] add edx,4 - mov ebx,[esi+04] + mov ebx,[esi+WDATA.box.top] add ebx,20 - mov eax,[esi+04] - add eax,[esi+12] + mov eax,[esi+WDATA.box.top] + add eax,[esi+WDATA.box.height] cmp ebx,eax jb .wdsizeok mov ebx,eax @@ -789,12 +789,12 @@ drawwindow_III_caption: mov ebx,edx shl ebx,16 add ebx,edx - mov eax,[esi+00] + mov eax,[esi+WDATA.box.left] shl eax,16 - add eax,[esi+00] - add eax,[esi+8] + add eax,[esi+WDATA.box.left] + add eax,[esi+WDATA.box.width] add eax,4*65536-4 - mov ecx,[esi+20] + mov ecx,[esi+WDATA.cl_titlebar] test ecx,0x40000000 jz .nofa add ecx,0x040404 @@ -803,7 +803,7 @@ drawwindow_III_caption: jz .nofa2 sub ecx,0x040404 .nofa2: - mov [esi+20],ecx + mov [esi+WDATA.cl_titlebar],ecx and ecx,0xffffff xor edi, edi call [draw_line] @@ -812,7 +812,7 @@ drawwindow_III_caption: jb .drwi add esp,4 pop ecx - mov [esi+20],ecx + mov [esi+WDATA.cl_titlebar],ecx ret @@ -822,15 +822,15 @@ drawwindow_III: pushad mov edi,edx ; RECTANGLE - mov eax,[edi+0] + mov eax,[edi+WDATA.box.left] shl eax,16 - mov ax,[edi+0] - add ax,[edi+8] - mov ebx,[edi+4] + mov ax, word [edi+WDATA.box.left] + add ax, word [edi+WDATA.box.width] + mov ebx,[edi+WDATA.box.top] shl ebx,16 - mov bx,[edi+4] - add bx,[edi+12] - mov esi,[edi+24] + mov bx, word [edi+WDATA.box.top] + add bx, word [edi+WDATA.box.height] + mov esi,[edi+WDATA.cl_frames] shr esi,1 and esi,0x007f7f7f push esi @@ -839,7 +839,7 @@ drawwindow_III: dw3l: add eax,1*65536-1 add ebx,1*65536-1 - mov esi,[edi+24] + mov esi,[edi+WDATA.cl_frames] call draw_rectangle dec ecx jnz dw3l @@ -850,19 +850,19 @@ drawwindow_III: call drawwindow_III_caption - mov edx,[esi+04] ; WORK AREA + mov edx,[esi+WDATA.box.top] ; WORK AREA add edx,21+5 - mov ebx,[esi+04] - add ebx,[esi+12] + mov ebx,[esi+WDATA.box.top] + add ebx,[esi+WDATA.box.height] cmp edx,ebx jg noinside2 mov eax,5 mov ebx,20 - mov ecx,[esi+8] - mov edx,[esi+12] + mov ecx,[esi+WDATA.box.width] + mov edx,[esi+WDATA.box.height] sub ecx,4 sub edx,4 - mov edi,[esi+16] + mov edi,[esi+WDATA.cl_workarea] call [drawbar] noinside2: @@ -971,31 +971,31 @@ checkwindowdraw: movzx eax, word [esi] shl eax, 5 - cmp [0x3000 + eax + 0xa], byte 9 + cmp [0x3000 + eax + TASKDATA.state], byte 9 je .new_check ; skip dead windows lea esi, [eax+window_data] - mov ebx, [edi+4] ; y0 - mov edx, [edi+12] + mov ebx, [edi+WDATA.box.top] ; y0 + mov edx, [edi+WDATA.box.height] add edx, ebx ; y0e - mov ecx, [esi+4] ; y ; y check + mov ecx, [esi+WDATA.box.top] ; y ; y check cmp ecx, edx jae .new_check ; y < y0e - mov eax, [esi+12] + mov eax, [esi+WDATA.box.height] add ecx, eax ; ye cmp ebx, ecx ; y0 >= ye ja .new_check - mov eax, [edi+0] ; x0 - mov ecx, [edi+8] + mov eax, [edi+WDATA.box.left] ; x0 + mov ecx, [edi+WDATA.box.width] add ecx, eax ; x0e - mov edx, [esi+0] ; x ; x check + mov edx, [esi+WDATA.box.left] ; x ; x check cmp edx, ecx jae .new_check ; x < x0e - mov ecx, [esi+8] + mov ecx, [esi+WDATA.box.width] add edx, ecx cmp eax, edx ja .new_check @@ -1035,10 +1035,10 @@ waredraw: ; if redraw necessary at activate add esi, window_data ; coordinates of the upper window - mov eax, [esi+00] ; cx - mov ebx, [esi+04] ; cy - mov ecx, [esi+08] ; sx - mov edx, [esi+12] ; sy + mov eax, [esi + WDATA.box.left] ; cx + mov ebx, [esi + WDATA.box.top] ; cy + mov ecx, [esi + WDATA.box.width] ; sx + mov edx, [esi + WDATA.box.height] ; sy add ecx, eax ; ecx = x_end add edx, ebx ; edx = y_end @@ -1048,8 +1048,8 @@ waredraw: ; if redraw necessary at activate call setscreen popad - mov [edi+31],byte 1 ; redraw flag for app - mov [0xfb44],byte 0 ; mouse down checks + mov [edi + WDATA.fl_redraw], 1 ; redraw flag for app + mov [0xfb44],byte 0 ; mouse down checks ret @@ -1175,8 +1175,8 @@ checkwindows: shl edi, 5 add edi, window_data ; mov edi, ebx - mov ecx, [edi+0] - mov edx, [edi+4] + mov ecx, [edi + WDATA.box.left] + mov edx, [edi + WDATA.box.top] mov eax,ecx mov ebx,edx @@ -1190,8 +1190,8 @@ checkwindows: jae cwloop cmp edx, ebx jae cwloop - add ecx, [edi+8] - add edx, [edi+12] + add ecx, [edi + WDATA.box.width] + add edx, [edi + WDATA.box.height] cmp eax, ecx jae cwloop cmp ebx, edx @@ -1218,7 +1218,7 @@ checkwindows: popad ; Check for user enabled fixed window - mov edx, [edi+0x14] + mov edx, [edi + WDATA.cl_titlebar] and edx, 0x0f000000 cmp edx, 0x01000000 jne .window_move_enabled_for_user @@ -1226,17 +1226,17 @@ checkwindows: ret .window_move_enabled_for_user: - test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP + test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP jnz .no_resize_2 mov [do_resize_from_corner],byte 0 ; resize for skinned window - mov edx, [edi+0x10] + mov edx, [edi + WDATA.cl_workarea] and edx, 0x0f000000 cmp edx, 0x02000000 jb .no_resize_2 ; not type 2 wnd - mov edx, [edi+4] - add edx, [edi+12] + mov edx, [edi + WDATA.box.top] + add edx, [edi + WDATA.box.height] sub edx, 6 ; edx = y_end - 6 cmp ebx, edx ; ebx = mouse_y jb .no_resize_2 @@ -1246,7 +1246,7 @@ checkwindows: push eax call get_titlebar_height - add eax,[edi+4] + add eax,[edi + WDATA.box.top] cmp ebx,eax pop eax jae .exit @@ -1267,15 +1267,15 @@ checkwindows: mov cl, [0xfb40] ; save for shade check mov [do_resize], cl no_emulation_righ_button: - mov ecx, [edi+0] - mov edx, [edi+4] + mov ecx, [edi + WDATA.box.left] + mov edx, [edi + WDATA.box.top] push eax ecx edx mov [dlx], ecx ; save for drawlimits mov [dly], edx - mov eax, [edi+8] + mov eax, [edi + WDATA.box.width] add ecx, eax - mov eax, [edi+12] + mov eax, [edi + WDATA.box.height] add edx, eax mov [dlxe], ecx mov [dlye], edx @@ -1290,22 +1290,22 @@ checkwindows: pushad ; wait for putimages to finish ; mov eax,5 ; call delay_hs - mov eax,[edi+0] + mov eax,[edi + WDATA.box.left] mov [npx],eax - mov eax,[edi+4] + mov eax,[edi + WDATA.box.top] mov [npy],eax popad push eax ; save old coordinates - mov ax,[edi+00] - mov word [oldc+00],ax - mov ax,[edi+04] - mov word [oldc+04],ax - mov ax,[edi+8] - mov word [oldc+8],ax + mov ax, word [edi + WDATA.box.left] + mov word [oldc+BOX.left],ax + mov ax, word [edi + WDATA.box.top] + mov word [oldc+BOX.top],ax + mov ax, word [edi + WDATA.box.width] + mov word [oldc+BOX.width],ax mov word [npxe],ax - mov ax,[edi+12] - mov word [oldc+12],ax + mov ax, word [edi + WDATA.box.height] + mov word [oldc+BOX.height],ax mov word [npye],ax pop eax @@ -1388,14 +1388,15 @@ checkwindows: mov edx,edi sub edx,window_data - shr edx,5 - shl edx,8 - add edx,0x80000 ; process base at 0x80000+ + ;shr edx,5 + ;shl edx,8 + ;add edx,0x80000 ; process base at 0x80000+ + lea edx, [0x80000 + edx*8] movzx eax,word [0xfb0a] - cmp eax,[edi+0] + cmp eax,[edi + WDATA.box.left] jb nnepx - sub eax,[edi+0] + sub eax,[edi + WDATA.box.left] cmp eax,32 ; [edx+0x90+8] jge nnepx2 mov eax,32 ; [edx+0x90+8] @@ -1406,9 +1407,9 @@ checkwindows: call get_rolledup_height mov ebx,eax movzx eax,word [0xfb0c] - cmp eax,[edi+4] + cmp eax,[edi + WDATA.box.top] jb nnepy - sub eax,[edi+4] + sub eax,[edi + WDATA.box.top] cmp eax,ebx ; [edx+0x90+12] jge nnepy2 mov eax,ebx ; [edx+0x90+12] @@ -1443,13 +1444,13 @@ checkwindows: call drawwindowframes mov eax,[npx] - mov [edi+0],eax + mov [edi + WDATA.box.left],eax mov eax,[npy] - mov [edi+4],eax + mov [edi + WDATA.box.top],eax mov eax,[npxe] - mov [edi+8],eax + mov [edi + WDATA.box.width],eax mov eax,[npye] - mov [edi+12],eax + mov [edi + WDATA.box.height],eax @@: mov [reposition],cl @@ -1464,7 +1465,7 @@ checkwindows: @@: sub edi,window_data shr edi,5 shl edi,8 - add edi,0x80000+0x90 + add edi,0x80000+APPDATA.saved_box cld rep movsd pop ecx edi esi @@ -1492,7 +1493,7 @@ checkwindows: jmp @f wnd_rolldown: and [edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP - mov eax,[edx+0x90+BOX.height] + mov eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED jz @f mov eax,[screen_workarea.bottom] @@ -1527,7 +1528,7 @@ checkwindows: and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED push [edi+WDATA.box.height] push edi ; restore - lea esi, [edx + 0x90] + lea esi, [edx + APPDATA.saved_box] mov ecx,4 cld rep movsd @@ -1540,20 +1541,20 @@ checkwindows: no_fullscreen_restore: - mov eax,[edi+4] ; check Y inside screen - add eax,[edi+12] + mov eax,[edi+WDATA.box.top] ; check Y inside screen + add eax,[edi+WDATA.box.height] cmp eax,[0xfe04] jbe no_window_sizing - mov eax,[edi+0] ; check X inside screen - add eax,[edi+8] + mov eax,[edi+WDATA.box.left] ; check X inside screen + add eax,[edi+WDATA.box.width] cmp eax,[0xfe00] jbe no_window_sizing mov eax,[0xfe00] - sub eax,[edi+8] - mov [edi+0],eax + sub eax,[edi+WDATA.box.width] + mov [edi+WDATA.box.left],eax mov eax,[0xfe04] - sub eax,[edi+12] - mov [edi+4],eax + sub eax,[edi+WDATA.box.height] + mov [edi+WDATA.box.top],eax no_window_sizing: popad @@ -1565,18 +1566,18 @@ checkwindows: push eax ebx ecx edx - mov eax,[edi+00] - mov ebx,[edi+04] - mov ecx,[edi+8] - mov edx,[edi+12] + mov eax,[edi+WDATA.box.left] + mov ebx,[edi+WDATA.box.top] + mov ecx,[edi+WDATA.box.width] + mov edx,[edi+WDATA.box.height] add ecx,eax add edx,ebx call calculatescreen - mov eax,[oldc+00] - mov ebx,[oldc+04] - mov ecx,[oldc+8] - mov edx,[oldc+12] + mov eax,[oldc+BOX.left] + mov ebx,[oldc+BOX.top] + mov ecx,[oldc+BOX.width] + mov edx,[oldc+BOX.height] add ecx,eax add edx,ebx call calculatescreen @@ -1701,7 +1702,7 @@ drawwindowframes: mov edi,[0x3000] shl edi,5 add edi,window_data - mov [edi+30],byte 1 + mov [edi+WDATA.fl_wdrawn],byte 1 pop edi popad @@ -1715,7 +1716,7 @@ random_shaped_window: ; ; eax = 0 giving address of data area ; ebx address -; ebx = 1 shape area scale +; eax = 1 shape area scale ; ebx 2^ebx scale test eax, eax @@ -1723,14 +1724,14 @@ random_shaped_window: mov eax,[0x3000] shl eax,8 - mov [eax+0x80000+0x80],ebx + mov [eax+0x80000+APPDATA.wnd_shape],ebx rsw_no_address: cmp eax,1 jne rsw_no_scale mov eax,[0x3000] shl eax,8 - mov [eax+0x80000+0x84],bl + mov byte [eax+0x80000+APPDATA.wnd_shape_scale], bl rsw_no_scale: ret diff --git a/kernel/trunk/hid/keyboard.inc b/kernel/trunk/hid/keyboard.inc index b79a7184d2..525222b053 100644 --- a/kernel/trunk/hid/keyboard.inc +++ b/kernel/trunk/hid/keyboard.inc @@ -91,10 +91,10 @@ irq1: mov ds, ax mov es, ax - movzx eax,word[0x3004] ; top window process + mov eax, [0x3004] ; top window process movzx eax,word[0xC400+eax*2] shl eax,8 - mov al,[0x800B4+eax] + mov al,[0x80000+eax+APPDATA.keyboard_mode] mov [keyboard_mode],al in al,0x60 diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 4838e219c6..cd5b45aa9f 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -644,12 +644,12 @@ finit ;reset the registers, contents which are still equal RM mov esi,boot_setostask call boot_log ; name for OS/IDLE process - mov [0x80000+256+0],dword 'OS/I' - mov [0x80000+256+4],dword 'DLE ' + mov dword [0x80000+256+APPDATA.app_name], dword 'OS/I' + mov dword [0x80000+256+APPDATA.app_name+4], dword 'DLE ' ; task list - mov [0x3020+0xE],byte 1 ; on screen number - mov [0x3020+0x4],dword 1 ; process id number - mov [0x3020+0x10], dword 0 ; process base address + mov [0x3020+TASKDATA.wnd_number], 1 ; on screen number + mov [0x3020+TASKDATA.pid], 1 ; process id number + mov [0x3020+TASKDATA.mem_start], 0 ; process base address ; set default flags & stacks mov [l.eflags],dword 0x11202 ; sti and resume @@ -1442,7 +1442,7 @@ display_number: cmp al,1 ; ecx is a pointer ? jne displnl1 mov edi,[0x3010] - mov edi,[edi+0x10] + mov edi,[edi+TASKDATA.mem_start] mov ebx,[edi+ebx] displnl1: sub esp,64 @@ -1452,8 +1452,6 @@ display_number: shr eax,16 and eax,0x3f push eax - ;mov edi,[0x3010] - ;mov edi,[edi+0x10] mov edi,esp add edi,4+64 mov ecx,eax @@ -1478,8 +1476,6 @@ display_number: shr eax,16 and eax,0x3f push eax - ;mov edi,[0x3010] - ;mov edi,[edi+0x10] mov edi,esp add edi,4+64 mov ecx,eax @@ -1505,8 +1501,6 @@ display_number: shr eax,16 and eax,0x3f push eax - ;mov edi,[0x3010] - ;mov edi,[edi+0x10] mov edi,esp add edi,4+64 mov ecx,eax @@ -1551,9 +1545,9 @@ draw_num_text: push edx ; add window start x & y push ebx mov edx,[0x3010] - mov ebx,[edx-twdw] + mov ebx,[edx-twdw+WDATA.box.left] shl ebx,16 - add ebx,[edx-twdw+4] + add ebx,[edx-twdw+WDATA.box.top] add eax,ebx pop ebx pop edx @@ -1615,7 +1609,7 @@ midi_base dw 0 cmp ebx,1 jnz kbnobase mov edi,[0x3010] - add ecx,[edi+0x10] + add ecx,[edi+TASKDATA.mem_start] mov eax,ecx mov ebx,keymap mov ecx,128 @@ -1625,7 +1619,7 @@ midi_base dw 0 cmp ebx,2 jnz kbnoshift mov edi,[0x3010] - add ecx,[edi+0x10] + add ecx,[edi+TASKDATA.mem_start] mov eax,ecx mov ebx,keymap_shift mov ecx,128 @@ -1635,7 +1629,7 @@ midi_base dw 0 cmp ebx,3 jne kbnoalt mov edi,[0x3010] - add ecx,[edi+0x10] + add ecx,[edi+TASKDATA.mem_start] mov eax,ecx mov ebx,keymap_alt mov ecx,128 @@ -1827,7 +1821,7 @@ sys_getsetup: cmp ebx,1 jnz kbnobaseret mov edi,[0x3010] - add ecx,[edi+0x10] + add ecx,[edi+TASKDATA.mem_start] mov ebx,ecx mov eax,keymap mov ecx,128 @@ -1837,7 +1831,7 @@ sys_getsetup: cmp ebx,2 jnz kbnoshiftret mov edi,[0x3010] - add ecx,[edi+0x10] + add ecx,[edi+TASKDATA.mem_start] mov ebx,ecx mov eax,keymap_shift mov ecx,128 @@ -1847,7 +1841,7 @@ sys_getsetup: cmp ebx,3 jne kbnoaltret mov edi,[0x3010] - add ecx,[edi+0x10] + add ecx,[edi+TASKDATA.mem_start] mov ebx,ecx mov eax,keymap_alt mov ecx,128 @@ -1950,10 +1944,9 @@ readmousepos: shl eax,16 mov ax,[0xfb0c] mov esi,[0x3010] - sub esi,twdw - mov bx,[esi] + mov bx, word [esi-twdw+WDATA.box.left] shl ebx,16 - mov bx,[esi+4] + mov bx, word [esi-twdw+WDATA.box.top] sub eax,ebx mov [esp+36],eax ret @@ -2081,8 +2074,7 @@ include 'detect/ps2mouse.inc' sys_end: mov eax,[0x3010] - add eax,0xa - mov [eax],byte 3 ; terminate this program + mov [eax+TASKDATA.state], 3 ; terminate this program waitterm: ; wait here for termination mov eax,5 @@ -2141,8 +2133,8 @@ sysfn_terminate: ; 18.2 = TERMINATE ja noprocessterminate mov eax,[0x3004] shl ebx,5 - mov edx,[ebx+0x3000+4] - add ebx,0x3000+0xa + mov edx,[ebx+0x3000+TASKDATA.pid] + add ebx,0x3000+TASKDATA.state cmp byte [ebx], 9 jz noprocessterminate @@ -2262,8 +2254,8 @@ sysfn_getdiskinfo: ; 18.11 = get disk info table rep movsb ret for_all_tables: - mov edi,[3010h] - mov edi,[edi+10h] + mov edi,[0x3010] + mov edi,[edi+TASKDATA.mem_start] add edi,ecx mov esi,0x40000 ret @@ -2281,8 +2273,8 @@ sysfn_lastkey: ; 18.12 = return 0 (backward compatibility) ret sysfn_getversion: ; 18.13 = get kernel ID and version - mov edi,[3010h] - mov edi,[edi+10h] + mov edi,[0x3010] + mov edi,[edi+TASKDATA.mem_start] add edi,ebx mov esi,version_inf mov ecx,version_end-version_inf @@ -2447,7 +2439,7 @@ draw_background_temp: jnz nosb5 ; bughere mov edi, [0x3010] - add ebx, [edi+0x10] + add ebx, [edi+TASKDATA.mem_start] ; mov esi, ebx ; mov edi, ecx mov eax, ebx @@ -2589,8 +2581,7 @@ sys_cpuusage: ; mov edi,[0x3010] ; eax = return area - add edi,0x10 - add eax,[edi] + add eax,[edi + TASKDATA.mem_start] cmp ebx,-1 ; who am I ? jne no_who_am_i @@ -2609,27 +2600,20 @@ sys_cpuusage: xor edx,edx mov eax,0x20 mul ebx - add eax,0x3000+0x1c + add eax,0x3000+TASKDATA.cpu_usage mov ebx,eax pop eax mov ecx,[ebx] mov [eax],ecx pop ebx -; mov ebx,[esp] -; shl ebx,1 -; add ebx,0xc000 mov cx, [0xC000 + ebx * 2] mov [eax+4],cx -; mov ebx,[esp] -; shl ebx,1 -; add ebx,0xc400 mov cx, [0xC400 + ebx * 2] mov [eax+6],cx -; pop ebx push eax mov eax,ebx shl eax,8 - add eax,0x80000 + add eax,0x80000+APPDATA.app_name pop ebx add ebx,10 mov ecx,11 @@ -2643,19 +2627,9 @@ sys_cpuusage: cmp ecx,1 je os_mem shl ecx,8 - mov edx,[0x80000+ecx+0x8c] + mov edx,[0x80000+ecx+APPDATA.mem_size] ;0x8c mov eax,std_application_base_address - ;add ecx,0x80000+0x88 - ;mov ecx,[ecx] -; shl ecx,3 ; eax run base -> edx used memory -; mov al,[ecx+gdts+ app_code-3 +4] ; base 23:16 -; mov ah,[ecx+gdts+ app_code-3 +7] ; base 31:24 -; shl eax,16 -; mov ax,[ecx+gdts+ app_code-3 +2] ; base 0:15 -; movzx edx,word [ecx+gdts+ app_code-3 +0] -; shl edx,12 - os_mem: dec edx mov [ebx+12],eax @@ -2665,7 +2639,7 @@ sys_cpuusage: mov eax,[esp] shl eax,5 - add eax,0x3000+0x4 + add eax,0x3000+TASKDATA.pid mov eax,[eax] mov [ebx+20],eax @@ -2673,18 +2647,18 @@ sys_cpuusage: mov esi,[esp] shl esi,5 - add esi,window_data + add esi,window_data + WDATA.box mov edi,[esp+4] add edi,34 - mov ecx,4*4 + mov ecx,4 cld - rep movsb + rep movsd ; Process state (+50) mov eax,[esp] shl eax,5 - add eax,0x3000+0xa + add eax,0x3000+TASKDATA.state mov eax,[eax] mov [ebx+40],ax @@ -2826,16 +2800,15 @@ sys_redrawstat: mov edx,[0x3010] ; return whole screen draw area for this app add edx,draw_data-0x3000 - mov [edx+0],dword 0 - mov [edx+4],dword 0 + mov [edx+RECT.left], 0 + mov [edx+RECT.top], 0 mov eax,[0xfe00] - mov [edx+8],eax + mov [edx+RECT.right],eax mov eax,[0xfe04] - mov [edx+12],eax + mov [edx+RECT.bottom],eax mov edi,[0x3010] - sub edi,twdw - mov [edi+30],byte 1 ; no new position & buttons from app + mov [edi-twdw+WDATA.fl_wdrawn], 1 ; no new position & buttons from app call sys_window_mouse @@ -2961,7 +2934,7 @@ draw_window_caption: mov ecx,[edi*8+0x80000+APPDATA.wnd_caption] or ecx,ecx jz @f - add ecx,[edi+twdw+0x10] + add ecx,[edi+twdw+TASKDATA.mem_start] movzx eax,[edi+window_data+WDATA.fl_wstyle] and al,0x0F @@ -3118,15 +3091,16 @@ sys_set_window: sub edi,window_data shl edi,3 - add edi,0x80000+0x90 + add edi,0x80000 and cl,0x0F - mov [edi-0x90+APPDATA.wnd_caption],0 + mov [edi+APPDATA.wnd_caption],0 cmp cl,3 jne @f - mov [edi-0x90+APPDATA.wnd_caption],esi + mov [edi+APPDATA.wnd_caption],esi @@: mov esi,[esp+0] + add edi, APPDATA.saved_box mov ecx,4 cld rep movsd @@ -3135,10 +3109,10 @@ sys_set_window: push eax ebx ecx edx ;;; mov eax, 1 ;;; call delay_hs - movzx eax, word [edi+00] - movzx ebx, word [edi+04] - movzx ecx, word [edi+8] - movzx edx, word [edi+12] + mov eax, [edi+WDATA.box.left] + mov ebx, [edi+WDATA.box.top] + mov ecx, [edi+WDATA.box.width] + mov edx, [edi+WDATA.box.height] add ecx, eax add edx, ebx call calculatescreen @@ -3148,7 +3122,7 @@ sys_set_window: mov [0xf500],byte 0 ; empty button buffer newd: - mov [edi+31],byte 0 ; no redraw + mov [edi+WDATA.fl_redraw],byte 0 ; no redraw mov edx,edi ret @@ -3195,25 +3169,25 @@ syscall_windowsettings: sys_window_move: - mov edi,[0x00003000] + mov edi,[0x3000] shl edi,5 add edi,window_data test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED jnz .window_move_return - push dword [edi+0] ; save old coordinates - push dword [edi+4] - push dword [edi+8] - push dword [edi+12] + push dword [edi + WDATA.box.left] ; save old coordinates + push dword [edi + WDATA.box.top] + push dword [edi + WDATA.box.width] + push dword [edi + WDATA.box.height] cmp eax,-1 ; set new position and size je .no_x_reposition - mov [edi+0],eax + mov [edi + WDATA.box.left], eax .no_x_reposition: cmp ebx,-1 je .no_y_reposition - mov [edi+4],ebx + mov [edi + WDATA.box.top], ebx .no_y_reposition: test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP @@ -3221,11 +3195,11 @@ sys_window_move: cmp ecx,-1 je .no_x_resizing - mov [edi+8],ecx + mov [edi + WDATA.box.width], ecx .no_x_resizing: cmp edx,-1 je .no_y_resizing - mov [edi+12],edx + mov [edi + WDATA.box.height], edx .no_y_resizing: call check_window_position @@ -3235,19 +3209,19 @@ sys_window_move: sub edi,window_data shr edi,5 shl edi,8 - add edi,0x80000+0x90 + add edi, 0x80000 + APPDATA.saved_box mov ecx,4 cld rep movsd popad pushad ; calculcate screen at new position - mov eax,[edi+00] - mov ebx,[edi+04] - mov ecx,[edi+8] - mov edx,[edi+12] - add ecx,eax - add edx,ebx + mov eax, [edi + WDATA.box.left] + mov ebx, [edi + WDATA.box.top] + mov ecx, [edi + WDATA.box.width] + mov edx, [edi + WDATA.box.height] + add ecx, eax + add edx, ebx call calculatescreen popad @@ -3263,7 +3237,7 @@ sys_window_move: mov [dlye],edx call calculatescreen - mov [edi+31],byte 1 ; flag the process as redraw + mov [edi + WDATA.fl_redraw], 1 ; flag the process as redraw mov eax,edi ; redraw screen at old position xor esi,esi @@ -3463,7 +3437,7 @@ checkmisc: mov ecx, [0x3004] set_mouse_event: add edi, 256 - or [edi+0x80000+0xA8], dword 00100000b + or [edi+0x80000+APPDATA.event_mask], dword 00100000b loop set_mouse_event mouse_not_active: @@ -3474,12 +3448,12 @@ checkmisc: jz nobackgr mov [0xfff0],byte 2 call change_task - mov [draw_data+32+0],dword 0 - mov [draw_data+32+4],dword 0 + mov [draw_data+32 + RECT.left],dword 0 + mov [draw_data+32 + RECT.top],dword 0 mov eax,[0xfe00] mov ebx,[0xfe04] - mov [draw_data+32+8],eax - mov [draw_data+32+12],ebx + mov [draw_data+32 + RECT.right],eax + mov [draw_data+32 + RECT.bottom],ebx call drawbackground mov [0xfff0],byte 0 mov [0xfff4],byte 0 @@ -3502,7 +3476,7 @@ checkmisc: movzx ecx,byte [0xff00] add ecx,5 markz: - mov [edx+0xa],byte 3 + mov [edx+TASKDATA.state],byte 3 add edx,0x20 loop markz @@ -3519,7 +3493,7 @@ checkmisc: mov eax,[0x3004] ; termination - mov ebx,0x3020+0xa + mov ebx,0x3020+TASKDATA.state mov esi,1 newct: @@ -3570,12 +3544,12 @@ redrawscreen: cmp ecx,1 ; limit for background jz bgli - mov eax,[edi+0] - mov ebx,[edi+4] - mov ecx,[edi+8] - mov edx,[edi+12] - add ecx,eax - add edx,ebx + mov eax, [edi + WDATA.box.left] + mov ebx, [edi + WDATA.box.top] + mov ecx, [edi + WDATA.box.width] + mov edx, [edi + WDATA.box.height] + add ecx, eax + add edx, ebx mov ecx,[dlye] ; ecx = area y end ebx = window y start cmp ecx,ebx @@ -3585,13 +3559,13 @@ redrawscreen: cmp ecx,eax jb ricino - mov eax,[edi+0] - mov ebx,[edi+4] - mov ecx,[edi+8] - mov edx,[edi+12] - add ecx,eax - add edx,ebx - + mov eax, [edi + WDATA.box.left] + mov ebx, [edi + WDATA.box.top] + mov ecx, [edi + WDATA.box.width] + mov edx, [edi + WDATA.box.height] + add ecx, eax + add edx, ebx + mov eax,[dly] ; eax = area y start edx = window y end cmp edx,eax jb ricino @@ -3609,13 +3583,13 @@ redrawscreen: add eax,draw_data-window_data mov ebx,[dlx] ; set limits - mov [eax+0],ebx + mov [eax + RECT.left], ebx mov ebx,[dly] - mov [eax+4],ebx + mov [eax + RECT.top], ebx mov ebx,[dlxe] - mov [eax+8],ebx + mov [eax + RECT.right], ebx mov ebx,[dlye] - mov [eax+12],ebx + mov [eax + RECT.bottom], ebx sub eax,draw_data-window_data @@ -3628,7 +3602,7 @@ redrawscreen: newdw8: nobgrd: - mov [eax+31],byte 1 ; mark as redraw + mov [eax + WDATA.fl_redraw],byte 1 ; mark as redraw ricino: @@ -3707,7 +3681,7 @@ set_app_param: push edi mov edi,[0x3010] - mov [edi],eax + mov [edi+TASKDATA.event_mask],eax pop edi ret @@ -3719,11 +3693,11 @@ delay_hs: ; delay in 1/100 secs push ecx push edx - mov edx,[timer_ticks];[0xfdf0] + mov edx,[timer_ticks] add edx,eax newtic: - mov ecx,[timer_ticks];[0xfdf0] + mov ecx,[timer_ticks] cmp edx,ecx jbe zerodelay @@ -3824,13 +3798,12 @@ align 4 sys_programirq: mov edi,[0x3010] - add edi,0x10 - add eax,[edi] + add eax,[edi+TASKDATA.mem_start] cmp ebx,16 jae .not_owner mov edi,[0x3010] - mov edi,[edi+0x4] + mov edi,[edi+TASKDATA.pid] cmp edi,[irq_owner+ebx*4] je spril1 .not_owner: @@ -3859,7 +3832,7 @@ get_irq_data: add edx,irq_owner mov edx,[edx] mov edi,[0x3010] - mov edi,[edi+0x4] + mov edi,[edi+TASKDATA.pid] cmp edx,edi je gidril1 .not_owner: @@ -4011,7 +3984,7 @@ r_f_port_area: shl edi,4 add edi,0x2d0000 mov esi,[0x3010] - mov esi,[esi+0x4] + mov esi,[esi+TASKDATA.pid] mov [edi],esi mov [edi+4],ebx mov [edi+8],ecx @@ -4030,7 +4003,7 @@ free_port_area: test esi,esi je frpal2 mov edx,[0x3010] - mov edx,[edx+4] + mov edx,[edx+TASKDATA.pid] frpal3: mov edi,esi shl edi,4 @@ -4104,7 +4077,7 @@ reserve_free_irq: lea edi,[irq_owner+ebx*4] mov edx,[edi] mov eax,[0x3010] - cmp edx,[eax+0x4] + cmp edx,[eax+TASKDATA.pid] jne fril1 dec ecx mov [edi],ecx @@ -4119,7 +4092,7 @@ reserve_free_irq: jnz ril1 mov edx,[0x3010] - mov edx,[edx+0x4] + mov edx,[edx+TASKDATA.pid] mov [edi],edx dec ecx ril1: @@ -4597,7 +4570,7 @@ sys_trace: mov esi,save_syscall_data ; data mov edi,[0x3010] - mov edi,[edi+0x10] + mov edi,[edi+TASKDATA.mem_start] add edi,ebx cld rep movsb @@ -4619,7 +4592,7 @@ sys_process_def: jne no_set_keyboard_setup shl edi,8 - mov [edi+0x800B4],bl + mov [edi+0x80000 + APPDATA.keyboard_mode],bl ret @@ -4629,7 +4602,7 @@ sys_process_def: jne no_get_keyboard_setup shl edi,8 - movzx eax, byte [0x800B4+edi] + movzx eax, byte [0x80000+edi + APPDATA.keyboard_mode] mov [esp+36],eax @@ -4734,8 +4707,8 @@ sys_ipc: mov edi,[0x3000] shl edi,8 add edi,0x80000 - mov [edi+0xA0],ebx - mov [edi+0xA4],ecx + mov [edi + APPDATA.ipc_start], ebx + mov [edi + APPDATA.ipc_size], ecx mov [esp+36],dword 0 ret no_ipc_def: @@ -4745,7 +4718,7 @@ sys_ipc: mov esi,1 mov edi,0x3020 ipcs1: - cmp [edi+4],ebx + cmp [edi+TASKDATA.pid], ebx je ipcs2 add edi,0x20 inc esi @@ -4760,22 +4733,22 @@ sys_ipc: push esi mov eax,esi shl eax,8 - mov ebx,[eax+0x80000+0xa0] + mov ebx,[eax+0x80000 + APPDATA.ipc_start] test ebx,ebx ; ipc area not defined ? je ipc_err1 - add ebx,[eax+0x80000+0xa4] + add ebx,[eax+0x80000 + APPDATA.ipc_size] mov eax,esi shl eax,5 - add ebx,[eax+0x3000+0x10] ; ebx <- max data position + add ebx,[eax+0x3000 + TASKDATA.mem_start] ; ebx <- max data position mov eax,esi ; to shl esi,8 add esi,0x80000 - mov edi,[esi+0xa0] + mov edi,[esi+APPDATA.ipc_start] shl eax,5 add eax,0x3000 - add edi,[eax+0x10] + add edi,[eax+TASKDATA.mem_start] cmp [edi],byte 0 ; overrun ? jne ipc_err2 @@ -4786,7 +4759,7 @@ sys_ipc: mov esi,ecx ; from mov eax,[0x3010] - mov eax,[eax+0x10] + mov eax,[eax+TASKDATA.mem_start] add esi,eax mov ecx,edx ; size @@ -4799,7 +4772,7 @@ sys_ipc: push ecx mov eax,[0x3010] - mov eax,[eax+4] + mov eax,[eax+TASKDATA.pid] mov [edi-8],eax mov [edi-4],ecx cld @@ -4813,7 +4786,7 @@ sys_ipc: mov edi,[esp] shl edi,8 - or dword [edi+0x80000+0xA8],dword 01000000b ; ipc message + or dword [edi+0x80000+APPDATA.event_mask],dword 01000000b ; ipc message cmp [check_idle_semaphore],dword 20 jge ipc_no_cis @@ -4897,8 +4870,8 @@ syscall_setpixel: ; SetPixel mov edx,[0x3010] - add eax,[edx-twdw] - add ebx,[edx-twdw+4] + add eax,[edx-twdw+WDATA.box.left] + add ebx,[edx-twdw+WDATA.box.top] mov edi,[0x3000] shl edi,8 add eax,[edi+0x80000+APPDATA.wnd_clientbox.left] @@ -4913,15 +4886,14 @@ align 4 syscall_writetext: ; WriteText mov edi,[0x3010] - mov ebp,[edi-twdw] + mov ebp,[edi-twdw+WDATA.box.left] mov esi,[0x3000] shl esi,8 add ebp,[esi+0x80000+APPDATA.wnd_clientbox.left] shl ebp,16 - add ebp,[edi-twdw+4] + add ebp,[edi-twdw+WDATA.box.top] add bp,word[esi+0x80000+APPDATA.wnd_clientbox.top] - add edi,0x10 - add ecx,[edi] + add ecx,[edi+TASKDATA.mem_start] add eax,ebp xor edi,edi jmp dtext @@ -4932,7 +4904,7 @@ syscall_openramdiskfile: ; OpenRamdiskFile mov edi,[0x3010] - add edi,0x10 + add edi, TASKDATA.mem_start add eax,[edi] add edx,[edi] mov esi,12 @@ -4978,7 +4950,7 @@ align 4 syscall_startapp: ; StartApp mov edi,[0x3010] - add edi,0x10 + add edi, TASKDATA.mem_start add eax,[edi] test ebx,ebx jz noapppar @@ -5032,7 +5004,7 @@ align 4 syscall_delramdiskfile: ; DelRamdiskFile mov edi,[0x3010] - add edi,0x10 + add edi, TASKDATA.mem_start add eax,[edi] call filedelete mov [esp+36],eax @@ -5043,7 +5015,7 @@ align 4 syscall_writeramdiskfile: ; WriteRamdiskFile mov edi,[0x3010] - add edi,0x10 + add edi, TASKDATA.mem_start add eax,[edi] add ebx,[edi] call filesave @@ -5069,7 +5041,7 @@ align 4 syscall_readstring: ; ReadString mov edi,[0x3010] - add edi,0x10 + add edi, TASKDATA.mem_start add eax,[edi] call read_string mov [esp+36],eax @@ -5080,7 +5052,7 @@ align 4 syscall_drawline: ; DrawLine mov edi,[0x3010] - movzx edx,word[edi-twdw] + movzx edx,word[edi-twdw+WDATA.box.left] mov ebp,edx mov esi,[0x3000] shl esi,8 @@ -5088,7 +5060,7 @@ syscall_drawline: ; DrawLine add dx,word[esi+0x80000+APPDATA.wnd_clientbox.left] shl edx,16 add ebp,edx - movzx edx,word[edi-twdw+4] + movzx edx,word[edi-twdw+WDATA.box.top] add eax,ebp mov ebp,edx add ebp,[esi+0x80000+APPDATA.wnd_clientbox.top] @@ -5167,7 +5139,7 @@ align 4 read_from_hd: ; Read from hd - fn not in use mov edi,[0x3010] - add edi,0x10 + add edi,TASKDATA.mem_start add eax,[edi] add ecx,[edi] add edx,[edi] @@ -5184,7 +5156,7 @@ align 4 write_to_hd: ; Write a file to hd mov edi,[0x3010] - add edi,0x10 + add edi,TASKDATA.mem_start add eax,[edi] add ecx,[edi] add edx,[edi] diff --git a/kernel/trunk/kernel32.inc b/kernel/trunk/kernel32.inc index bb097f2642..7eb691bf1a 100644 --- a/kernel/trunk/kernel32.inc +++ b/kernel/trunk/kernel32.inc @@ -107,12 +107,13 @@ WSTATE_WNDDRAWN = 00000010b WSTYLE_HASCAPTION = 00010000b WSTYLE_CLIENTRELATIVE = 00100000b -struc TASKLIST +struc TASKDATA { .event_mask dd ? .pid dd ? dw ? - .state dw ? + .state db ? + db ? dw ? .wnd_number db ? db ? @@ -122,7 +123,7 @@ struc TASKLIST .cpu_usage dd ? } virtual at 0 - TASKLIST TASKLIST + TASKDATA TASKDATA end virtual ; structures definition @@ -145,19 +146,19 @@ struc APPDATA { .app_name db 11 dup(?) db 5 dup(?) - .fpu_save_area db 108 dup(?) + .fpu_save_area: db 108 dup(?) db 3 dup(?) .is_fpu_saved db ? .wnd_shape dd ? .wnd_shape_scale dd ? - .gdt dd ? + dd ? .mem_size dd ? .saved_box BOX .ipc_start dd ? .ipc_size dd ? .event_mask dd ? .debugger_slot dd ? - .int40_handler dd ? + dd ? .keyboard_mode db ? db 3 dup(?) .dir_table dd ? diff --git a/kernel/trunk/memmap.inc b/kernel/trunk/memmap.inc index ea82fac4aa..df7ddcd9ff 100644 --- a/kernel/trunk/memmap.inc +++ b/kernel/trunk/memmap.inc @@ -44,7 +44,9 @@ ; ; 20 dword application event mask ; 24 dword PID - process identification number -; 2a word 0, state 1,2=suspended 3=zombie, 4=terminate +; 2a byte slot state: 0=running, 1,2=suspended +; 3=zombie, 4=terminate, +; 5=waiting for event, 9 = not used ; 2e byte window number on screen ; 30 dword exact position in memory ; 34 dword counter sum @@ -134,7 +136,7 @@ ; 7f byte 0= no fpu saved , 1= fpu saved to 0x10 -> restore ; 80 dword address of random shaped window area ; 84 byte shape area scale -; 88 dword used GDT of TSS +; 88 dword free ; 8C dword application memory size ; 90 dword window X position save ; 94 dword window Y position save @@ -144,7 +146,7 @@ ; A4 dword IPC memory size ; A8 dword event bits: mouse, stack,.. ; AC dword 0 or debugger slot -; B0 dword int40 handler in use ; 0 if not in use +; B0 dword free ; B4 byte keyboard mode: 0 = keymap, 1 = scancodes ; B8 dword physical address of directory table ; BC dword address of debug event memory diff --git a/kernel/trunk/network/stack.inc b/kernel/trunk/network/stack.inc index dc06115093..2d0427d1f3 100644 --- a/kernel/trunk/network/stack.inc +++ b/kernel/trunk/network/stack.inc @@ -995,7 +995,7 @@ stack_get_packet: ; Get the address of the callers data mov edi,[0x3010] - add edi,0x10 + add edi,TASKDATA.mem_start add edx,[edi] mov edi, edx @@ -1058,7 +1058,7 @@ stack_insert_packet: ; Get the address of the callers data mov edi,[0x3010] - add edi,0x10 + add edi,TASKDATA.mem_start add eax,[edi] mov esi, eax @@ -1117,7 +1117,7 @@ socket_open: mov [eax + 24], dword 0 ; recieved data count mov esi, [0x3010] - mov ebx, [esi+0x4] + mov ebx, [esi+TASKDATA.pid] mov [eax + 4], ebx ; save the process ID pop eax ; Get the socket number back, so we can return it @@ -1176,7 +1176,7 @@ sot_001: mov [eax + 28], ebx ; Indicate the state of the TCB mov esi, [0x3010] - mov ecx, [esi+0x4] + mov ecx, [esi+TASKDATA.pid] mov [eax + 4], ecx ; save the process ID cmp ebx, TCB_LISTEN @@ -1548,7 +1548,7 @@ socket_write: ; Get the address of the callers data mov edi,[0x3010] - add edi,0x10 + add edi,TASKDATA.mem_start add eax,[edi] mov esi, eax @@ -1671,7 +1671,7 @@ socket_write_tcp: ; Get the address of the callers data mov edi,[0x3010] - add edi,0x10 + add edi,TASKDATA.mem_start add edx,[edi] mov esi, edx diff --git a/kernel/trunk/network/tcp.inc b/kernel/trunk/network/tcp.inc index b27106c19d..179f42535e 100644 --- a/kernel/trunk/network/tcp.inc +++ b/kernel/trunk/network/tcp.inc @@ -1004,7 +1004,7 @@ ste_data: ; flag an event to the application pop eax mov ecx,1 - mov esi,0x3020+0x4 + mov esi,0x3020+TASKDATA.pid news: cmp [esi],eax @@ -1016,7 +1016,7 @@ news: foundPID1: shl ecx,8 - or dword [ecx+0x80000+0xA8],dword 10000000b ; stack event + or dword [ecx+0x80000+APPDATA.event_mask],dword 10000000b ; stack event pop ecx diff --git a/kernel/trunk/network/udp.inc b/kernel/trunk/network/udp.inc index 1ac2d4a3ac..ff36d37ab2 100644 --- a/kernel/trunk/network/udp.inc +++ b/kernel/trunk/network/udp.inc @@ -114,7 +114,7 @@ udprx_002: ; flag an event to the application pop eax mov ecx,1 - mov esi,0x3020+0x4 + mov esi,0x3020+TASKDATA.pid newsearch: cmp [esi],eax @@ -126,7 +126,7 @@ newsearch: foundPID: shl ecx,8 - or dword [ecx+0x80000+0xA8],dword 10000000b ; stack event + or dword [ecx+0x80000+APPDATA.event_mask],dword 10000000b ; stack event mov [check_idle_semaphore],200 diff --git a/kernel/trunk/sound/sb16.inc b/kernel/trunk/sound/sb16.inc index 21f6f70dca..6d7ec5e979 100644 --- a/kernel/trunk/sound/sb16.inc +++ b/kernel/trunk/sound/sb16.inc @@ -31,7 +31,7 @@ sound_interface: cmp eax,0 ; Load data jne no_SB16_load_music mov edi,[0x3010] - add edi,0x10 + add edi,TASKDATA.mem_start add ebx,[edi] call code_SB16_load_music ret @@ -78,7 +78,7 @@ sound_interface: ; mov [memAdrNote], eax mov [memAdrNote],edx mov eax,[0x3010] - mov eax,[eax+4] + mov eax,[eax+TASKDATA.pid] mov [pidProcessNote],eax xor eax, eax ; Ok! EAX = 0 retFunc55: diff --git a/kernel/trunk/video/vesa12.inc b/kernel/trunk/video/vesa12.inc index 58672f5052..fd8aeef34a 100644 --- a/kernel/trunk/video/vesa12.inc +++ b/kernel/trunk/video/vesa12.inc @@ -208,8 +208,8 @@ vesa12_drawbackground: mov ebx,3 mul ebx mov [imax],eax - mov eax,[draw_data+32+0] - mov ebx,[draw_data+32+4] + mov eax,[draw_data+32+RECT.left] + mov ebx,[draw_data+32+RECT.top] mov edi,0 ;no force v12dp3: @@ -330,15 +330,15 @@ vesa12_drawbackground: popa add esi,3 inc eax - cmp eax,[draw_data+32+8] + cmp eax,[draw_data+32+RECT.right] jg v12nodp31 jmp v12dp3 v12nodp31: - mov eax,[draw_data+32+0] + mov eax,[draw_data+32+RECT.left] inc ebx - cmp ebx,[draw_data+32+12] + cmp ebx,[draw_data+32+RECT.bottom] jg v12dp4 jmp v12dp3 @@ -365,8 +365,8 @@ vesa12_drawbar: push ecx push edx mov ecx,[0x3010] - add eax,[ecx-twdw] - add ebx,[ecx-twdw+4] + add eax,[ecx-twdw+WDATA.box.left] + add ebx,[ecx-twdw+WDATA.box.top] push eax mov eax,ebx ; y mov ebx,[0xfe08] @@ -403,16 +403,16 @@ vesa12_drawbar: push eax push ecx mov eax,[0x3010] - mov ecx,[eax+draw_data-0x3000+0] + mov ecx,[eax+draw_data-0x3000+RECT.left] cmp ecx,0 jnz dbcblimitlset12 - mov ecx,[eax+draw_data-0x3000+4] + mov ecx,[eax+draw_data-0x3000+RECT.top] cmp ecx,0 jnz dbcblimitlset12 - mov ecx,[eax+draw_data-0x3000+8] + mov ecx,[eax+draw_data-0x3000+RECT.right] cmp ecx,[0xfe00] jnz dbcblimitlset12 - mov ecx,[eax+draw_data-0x3000+12] + mov ecx,[eax+draw_data-0x3000+RECT.bottom] cmp ecx,[0xfe04] jnz dbcblimitlset12 pop ecx @@ -726,8 +726,8 @@ vesa12_putimage: movzx eax,word [esp+2] movzx ebx,word [esp+0] mov ecx,[0x3010] - add eax,[ecx-twdw] - add ebx,[ecx-twdw+4] + add eax,[ecx-twdw+WDATA.box.left] + add ebx,[ecx-twdw+WDATA.box.top] push eax mov eax,ebx ; y mov ebx,[0xfe08] @@ -765,16 +765,16 @@ vesa12_putimage: push eax push ecx mov eax,[0x3010] - mov ecx,[eax+draw_data-0x3000+0] + mov ecx,[eax+draw_data-0x3000+RECT.left] cmp ecx,0 jnz dbcblimitlset212 - mov ecx,[eax+draw_data-0x3000+4] + mov ecx,[eax+draw_data-0x3000+RECT.top] cmp ecx,0 jnz dbcblimitlset212 - mov ecx,[eax+draw_data-0x3000+8] + mov ecx,[eax+draw_data-0x3000+RECT.right] cmp ecx,[0xfe00] jnz dbcblimitlset212 - mov ecx,[eax+draw_data-0x3000+12] + mov ecx,[eax+draw_data-0x3000+RECT.bottom] cmp ecx,[0xfe04] jnz dbcblimitlset212 pop ecx diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc index 5a8fd3d68d..3dfaca5b2a 100644 --- a/kernel/trunk/video/vesa20.inc +++ b/kernel/trunk/video/vesa20.inc @@ -118,15 +118,15 @@ vesa20_putimage: ; calculate absolute (i.e. screen) coordinates mov eax, [0x3010] - mov ebx, [eax-twdw + 0] + mov ebx, [eax-twdw + WDATA.box.left] add ebx, [putimg.image_cx] mov [putimg.abs_cx], ebx - mov ebx, [eax-twdw + 4] + mov ebx, [eax-twdw + WDATA.box.top] add ebx, [putimg.image_cy] mov [putimg.abs_cy], ebx ; real_sx = MIN(wnd_sx-image_cx, image_sx); - mov ebx, [eax-twdw + 8] ; ebx = wnd_sx + mov ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx sub ebx, [putimg.image_cx] ja @f add esp, putimg.stack_data @@ -142,7 +142,7 @@ vesa20_putimage: mov [putimg.real_sx], ebx ; init real_sy - mov ebx, [eax-twdw + 12] ; ebx = wnd_sy + mov ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy sub ebx, [putimg.image_cy] ja @f add esp, putimg.stack_data @@ -602,13 +602,13 @@ vesa20_drawbar: mov [drbar.bar_cy], ebx mov edi, [0x3010] - add eax, [edi-twdw + 0] ; win_cx - add ebx, [edi-twdw + 4] ; win_cy + add eax, [edi-twdw + WDATA.box.left] ; win_cx + add ebx, [edi-twdw + WDATA.box.top] ; win_cy mov [drbar.abs_cx], eax mov [drbar.abs_cy], ebx ; real_sx = MIN(wnd_sx-bar_cx, bar_sx); - mov ebx, [edi-twdw + 8] ; ebx = wnd_sx + mov ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx sub ebx, [drbar.bar_cx] ja @f .exit: ;// mike.dld, 2005-01-29 @@ -626,7 +626,7 @@ vesa20_drawbar: mov [drbar.real_sx], ebx ; real_sy = MIN(wnd_sy-bar_cy, bar_sy); - mov ebx, [edi-twdw + 12] ; ebx = wnd_sy + mov ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy sub ebx, [drbar.bar_cy] ja @f add esp, drbar.stack_data @@ -852,8 +852,8 @@ vesa20_drawbackground_tiled: add edx,dword [WinMapAddress-8] ; +B push edx - mov ebp,[draw_data+32+0] ; x start:=(x+Xwin) - mov ebx,[draw_data+32+4] ; y start:=(y+Ywin) + mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin) + mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) mov eax,[BytesPerScanLine] mul ebx @@ -934,14 +934,14 @@ vesa20_drawbackground_tiled: inc edi ; ptrBuffer++ add esi,3 ; ptrImage+=3 inc eax - cmp eax,[draw_data+32+8] ; X > xend? + cmp eax,[draw_data+32+RECT.right] ; X > xend? ; jg nodp3 ; jmp dp3 ; ; nodp3: jle dp3 - mov ebp,[draw_data+32+0] + mov ebp,[draw_data+32+RECT.left] inc ebx @@ -961,7 +961,7 @@ vesa20_drawbackground_tiled: call calculate_edi - cmp ebx,[draw_data+32+12] + cmp ebx,[draw_data+32+RECT.bottom] ; jg dp4 ; ; jmp dp3 @@ -997,8 +997,8 @@ vesa20_drawbackground_stretch: add edx,dword [WinMapAddress-8] ; +B push edx - mov ebp,[draw_data+32+0] ; x start:=(x+Xwin) - mov ebx,[draw_data+32+4] ; y start:=(y+Ywin) + mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin) + mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) mov eax,[BytesPerScanLine] mul ebx @@ -1070,10 +1070,10 @@ vesa20_drawbackground_stretch: inc edi ; ptrBuffer++ add esi,3 ; ptrImage+=3 inc eax - cmp eax,[draw_data+32+8] ; X > xend? + cmp eax,[draw_data+32+RECT.right] ; X > xend? jle sdp3 - mov ebp,[draw_data+32+0] + mov ebp,[draw_data+32+RECT.left] inc ebx @@ -1093,7 +1093,7 @@ vesa20_drawbackground_stretch: call calculate_edi - cmp ebx,[draw_data+32+12] + cmp ebx,[draw_data+32+RECT.bottom] jle sdp3 add esp,4 diff --git a/kernel/trunk/video/vga.inc b/kernel/trunk/video/vga.inc index ddd8f857cc..32fa50093d 100644 --- a/kernel/trunk/video/vga.inc +++ b/kernel/trunk/video/vga.inc @@ -71,8 +71,8 @@ vga_putimage: movzx eax,word [esp+2] ; eax:=x movzx ebx,word [esp+0] ; ebx:=y mov ecx,[0x3010] ; - add eax,[ecx-twdw] ; eax+=Xwin - add ebx,[ecx-twdw+4] ; ebx+=Ywin + add eax,[ecx-twdw+WDATA.box.left] ; eax+=Xwin + add ebx,[ecx-twdw+WDATA.box.top] ; ebx+=Ywin mov ecx,ebx ; ecx = y+Ywin mov edx,eax ; edx = x+Xwin @@ -104,19 +104,19 @@ vga_putimage: push eax ; LFB address mov eax,[0x3010] - mov ecx,[eax+draw_data-0x3000+0] + mov ecx,[eax+draw_data-0x3000+RECT.left] cmp ecx,0 jnz dbcblimitlset_vga - mov ecx,[eax+draw_data-0x3000+4] + mov ecx,[eax+draw_data-0x3000+RECT.top] cmp ecx,0 jnz dbcblimitlset_vga - mov ecx,[eax+draw_data-0x3000+8] + mov ecx,[eax+draw_data-0x3000+RECT.right] cmp ecx,[0xfe00] ; ecx <> Screen X size jnz dbcblimitlset_vga - mov ecx,[eax+draw_data-0x3000+12] + mov ecx,[eax+draw_data-0x3000+RECT.bottom] cmp ecx,[0xfe04] ; ecx <> Screen Y size jnz dbcblimitlset_vga @@ -323,8 +323,8 @@ vga_drawbar: push edx ; +0 mov ecx,[0x3010] ; - add eax,[ecx-twdw] ; eax:=Xwin+x - add ebx,[ecx-twdw+4] ; ebx:=Ywin+y + add eax,[ecx-twdw+WDATA.box.left] ; eax:=Xwin+x + add ebx,[ecx-twdw+WDATA.box.top] ; ebx:=Ywin+y mov ecx, eax ; ecx:=(x+Xwin) mov edx, ebx ; edx:=(y+Ywin) @@ -377,19 +377,19 @@ vga_drawbar: mov eax,[0x3010] - mov ecx,[eax+draw_data-0x3000+0] + mov ecx,[eax+draw_data-0x3000+RECT.left] cmp ecx,0 jnz dbcblimitlset_vga2 - mov ecx,[eax+draw_data-0x3000+4] + mov ecx,[eax+draw_data-0x3000+RECT.top] cmp ecx,0 jnz dbcblimitlset_vga2 - mov ecx,[eax+draw_data-0x3000+8] + mov ecx,[eax+draw_data-0x3000+RECT.right] cmp ecx,[0xfe00] jnz dbcblimitlset_vga2 - mov ecx,[eax+draw_data-0x3000+12] + mov ecx,[eax+draw_data-0x3000+RECT.bottom] cmp ecx,[0xfe04] jnz dbcblimitlset_vga2 @@ -514,8 +514,8 @@ vga_drawbackground_tiled: add edx,dword [WinMapAddress-8] ; +B push edx - mov eax,[draw_data+32+0] ; x start:=(x+Xwin) - mov ebx,[draw_data+32+4] ; y start:=(y+Ywin) + mov eax,[draw_data+32+RECT.left] ; x start:=(x+Xwin) + mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) mov ecx,eax mov edx,ebx @@ -587,7 +587,7 @@ vga_drawbackground_tiled: nbgpvga: inc eax ; x++ - cmp eax,[draw_data+32+8] ; X > xend? + cmp eax,[draw_data+32+RECT.right] ; X > xend? jg nodp3vga test eax,0x07 ; x test modulo 8 @@ -602,7 +602,7 @@ vga_drawbackground_tiled: nodp3vga: - mov eax,[draw_data+32+0] ; x+Xwin + mov eax,[draw_data+32+RECT.left] ; x+Xwin inc ebx ; y position mov ecx,eax mov edx,ebx @@ -622,7 +622,7 @@ vga_drawbackground_tiled: call calculate_edi - cmp ebx,[draw_data+32+12] ; Y > yend + cmp ebx,[draw_data+32+RECT.bottom] ; Y > yend jg dp4vga jmp dp3vga @@ -657,8 +657,8 @@ vga_drawbackground_stretch: add edx,dword [WinMapAddress-8] ; +B push edx - mov eax,[draw_data+32+0] ; x start:=(x+Xwin) - mov ebx,[draw_data+32+4] ; y start:=(y+Ywin) + mov eax,[draw_data+32+RECT.left] ; x start:=(x+Xwin) + mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) mov ecx,eax mov edx,ebx @@ -731,7 +731,7 @@ vga_drawbackground_stretch: snbgpvga: inc eax ; x++ - cmp eax,[draw_data+32+8] ; X > xend? + cmp eax,[draw_data+32+RECT.right] ; X > xend? jg snodp3vga test eax,0x07 ; x test modulo 8 @@ -746,7 +746,7 @@ vga_drawbackground_stretch: snodp3vga: - mov eax,[draw_data+32+0] ; x+Xwin + mov eax,[draw_data+32+RECT.left] ; x+Xwin inc ebx ; y position mov ecx,eax mov edx,ebx @@ -766,7 +766,7 @@ vga_drawbackground_stretch: call calculate_edi - cmp ebx,[draw_data+32+12] ; Y > yend + cmp ebx,[draw_data+32+RECT.bottom] ; Y > yend jg sdp4vga jmp sdp3vga