From e7bade16fed581296e1be84ab52da7a59a7fdfe6 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Thu, 23 Feb 2012 18:52:13 +0000 Subject: [PATCH] Adapted more structures to use new struct.inc git-svn-id: svn://kolibrios.org@2384 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/blkdev/hd_drv.inc | 6 +- kernel/trunk/const.inc | 555 +++++++++++++-------------------- kernel/trunk/core/dll.inc | 148 ++++----- kernel/trunk/core/heap.inc | 48 ++- kernel/trunk/core/irq.inc | 12 +- kernel/trunk/core/taskman.inc | 54 ++-- kernel/trunk/core/v86.inc | 114 +++---- kernel/trunk/data32.inc | 2 +- kernel/trunk/gui/button.inc | 45 ++- kernel/trunk/gui/event.inc | 12 +- kernel/trunk/gui/mouse.inc | 6 +- kernel/trunk/kernel.asm | 2 +- kernel/trunk/kernel32.inc | 10 - kernel/trunk/video/blitter.inc | 47 ++- kernel/trunk/video/cursors.inc | 42 ++- 15 files changed, 466 insertions(+), 637 deletions(-) diff --git a/kernel/trunk/blkdev/hd_drv.inc b/kernel/trunk/blkdev/hd_drv.inc index bd99cac725..f9ab2d0ea5 100644 --- a/kernel/trunk/blkdev/hd_drv.inc +++ b/kernel/trunk/blkdev/hd_drv.inc @@ -891,8 +891,8 @@ bd_write_cache_chain: jmp hd_write_error uglobal -int13_regs_in rb v86_regs.size -int13_regs_out rb v86_regs.size +int13_regs_in rb sizeof.v86_regs +int13_regs_out rb sizeof.v86_regs endg int13_call: @@ -907,7 +907,7 @@ int13_call: push ebx ecx esi edi mov ebx, int13_regs_in mov edi, ebx - mov ecx, v86_regs.size/4 + mov ecx, sizeof.v86_regs/4 xor eax, eax rep stosd mov byte [ebx+v86_regs.eax+1], dl diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index 10e9633306..81395aa27a 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -179,8 +179,6 @@ struct TSS _io_map_1 rb 4096 ends -TSS_SIZE equ (128+8192) - OS_BASE equ 0x80000000 window_data equ (OS_BASE+0x0001000) @@ -397,381 +395,256 @@ EVENT_EXTENDED equ 0x00000200 EV_INTR equ 1 -struc THR_DATA -{ - rb (8192-512) - .pl0_stack: - .fpu_state rb 512 - .tls_page rb 4096 - .pdbr rb 4096 -} +struct THR_DATA + rb (8192-512) +; pl0_stack + fpu_state rb 512 + tls_page rb 4096 + pdbr rb 4096 +ends -THR_DATA_SIZE equ 4096*4 - -virtual at (OS_BASE-THR_DATA_SIZE) +virtual at (OS_BASE-sizeof.THR_DATA) thr_data THR_DATA end virtual -struc SYS_VARS -{ .bpp dd ? - .scanline dd ? - .vesa_mode dd ? - .x_res dd ? - .y_res dd ? -} +struct SYS_VARS + bpp dd ? + scanline dd ? + vesa_mode dd ? + x_res dd ? + y_res dd ? +ends -struc APPOBJ ;common object header -{ - .magic dd ? ; - .destroy dd ? ;internal destructor - .fd dd ? ;next object in list - .bk dd ? ;prev object in list - .pid dd ? ;owner id -}; - -virtual at 0 - APPOBJ APPOBJ -end virtual +struct APPOBJ ; common object header + magic dd ? ; + destroy dd ? ; internal destructor + fd dd ? ; next object in list + bk dd ? ; prev object in list + pid dd ? ; owner id +ends APP_OBJ_OFFSET equ 48 APP_EV_OFFSET equ 40 -struc CURSOR -{ -;common object header - .magic dd ? ;'CURS' - .destroy dd ? ;internal destructor - .fd dd ? ;next object in list - .bk dd ? ;prev object in list - .pid dd ? ;owner id +struct CURSOR APPOBJ + base dd ? ;allocated memory + hot_x dd ? ;hotspot coords + hot_y dd ? - ;cursor data - .base dd ? ;allocated memory - .hot_x dd ? ;hotspot coords - .hot_y dd ? - - .list_next dd ? ;next cursor in cursor list - .list_prev dd ? ;prev cursor in cursor list - .dev_obj dd ? ;device depended data - - .sizeof: -} -virtual at 0 - CURSOR CURSOR -end virtual + list_next dd ? ;next cursor in cursor list + list_prev dd ? ;prev cursor in cursor list + dev_obj dd ? ;device depended data +ends -struc EVENT -{ - .magic dd ? ;'EVNT' - .destroy dd ? ;internal destructor - .fd dd ? ;next object in list - .bk dd ? ;prev object in list - .pid dd ? ;owner id - - .id dd ? ;event uid - .state dd ? ;internal flags - .code dd ? - rd 5 - .size = $ - .magic - .codesize = $ - .code -} - -virtual at 0 - EVENT EVENT -end virtual +struct EVENT APPOBJ + id dd ? ;event uid + state dd ? ;internal flags + code dd ? + rd 5 +ends -struc SMEM -{ - .bk dd ? - .fd dd ? ;+4 - .base dd ? ;+8 - .size dd ? ;+12 - .access dd ? ;+16 - .refcount dd ? ;+20 - .name rb 32 ;+24 - .sizeof: -} +struct SMEM + bk dd ? + fd dd ? ;+4 + base dd ? ;+8 + size dd ? ;+12 + access dd ? ;+16 + refcount dd ? ;+20 + name rb 32 ;+24 +ends -struc SMAP -{ - .magic dd ? ; SMAP - .destroy dd ? ;internal destructor - .fd dd ? ;next object in list - .bk dd ? ;prev object in list - .pid dd ? ;owner id +struct SMAP APPOBJ + base dd ? ;mapped base + parent dd ? ;SMEM +ends - .base dd ? ;mapped base - .parent dd ? ;SMEM - .sizeof: -} +struct DLLDESCR + bk dd ? + fd dd ? ;+4 + data dd ? ;+8 + size dd ? ;+12 + timestamp dq ? + refcount dd ? + defaultbase dd ? + coff_hdr dd ? + symbols_ptr dd ? + symbols_num dd ? + symbols_lim dd ? + exports dd ? ;export table + name rb 260 +ends -virtual at 0 - SMEM SMEM -end virtual +struct HDLL + fd dd ? ;next object in list + bk dd ? ;prev object in list + pid dd ? ;owner id -virtual at 0 - SMAP SMAP -end virtual + base dd ? ;mapped base + size dd ? ;mapped size + refcount dd ? ;reference counter for this process and this lib + parent dd ? ;DLLDESCR +ends -struc DLLDESCR -{ - .bk dd ? - .fd dd ? ;+4 - .data dd ? ;+8 - .size dd ? ;+12 - .timestamp dq ? - .refcount dd ? - .defaultbase dd ? - .coff_hdr dd ? - .symbols_ptr dd ? - .symbols_num dd ? - .symbols_lim dd ? - .exports dd ? ;export table - .name: - .sizeof: -} +struct display_t + x dd ? + y dd ? + width dd ? + height dd ? + bpp dd ? + vrefresh dd ? + pitch dd ? + lfb dd ? -struc HDLL -{ - .fd dd ? ;next object in list - .bk dd ? ;prev object in list - .pid dd ? ;owner id + modes dd ? + ddev dd ? + connector dd ? + crtc dd ? - .base dd ? ;mapped base - .size dd ? ;mapped size - .refcount dd ? ;reference counter for this process and this lib - .parent dd ? ;DLLDESCR - .sizeof: -} + cr_list.next dd ? + cr_list.prev dd ? -virtual at 0 - DLLDESCR DLLDESCR -end virtual + cursor dd ? -virtual at 0 - HDLL HDLL -end virtual + init_cursor dd ? + select_cursor dd ? + show_cursor dd ? + move_cursor dd ? + restore_cursor dd ? + disable_mouse dd ? +ends -struc display_t -{ - .x dd ? - .y dd ? - .width dd ? - .height dd ? - .bpp dd ? - .vrefresh dd ? - .pitch dd ? - .lfb dd ? +struct BOOT_DATA + bpp dd ? + scanline dd ? + vesa_mode dd ? + x_res dd ? + y_res dd ? + mouse_port dd ? + bank_switch dd ? + lfb dd ? + vesa_mem dd ? + log dd ? + direct_lfb dd ? + pci_data dd ? + dd ? + vrr dd ? + ide_base dd ? + mem_amount dd ? + pages_count dd ? + pagemap_size dd ? + kernel_max dd ? + kernel_pages dd ? + kernel_tables dd ? - .modes dd ? - .ddev dd ? - .connector dd ? - .crtc dd ? + cpu_vendor dd ? + dd ? + dd ? + cpu_sign dd ? + cpu_info dd ? + cpu_caps dd ? + dd ? + dd ? +ends - .cr_list.next dd ? - .cr_list.prev dd ? +struct LHEAD + next dd ? ;next object in list + prev dd ? ;prev object in list +ends - .cursor dd ? +struct MUTEX + lhead LHEAD + count dd ? +ends - .init_cursor dd ? - .select_cursor dd ? - .show_cursor dd ? - .move_cursor dd ? - .restore_cursor dd ? - .disable_mouse dd ? -} +struct MEM_STATE + mutex MUTEX + smallmap dd ? + treemap dd ? + topsize dd ? + top dd ? + smallbins rd 4*32 + treebins rd 32 +ends -virtual at 0 - display_t display_t -end virtual +struct PG_DATA + mem_amount dd ? + vesa_mem dd ? + pages_count dd ? + pages_free dd ? + pages_faults dd ? + pagemap_size dd ? + kernel_pages dd ? + kernel_tables dd ? + sys_page_dir dd ? + mutex MUTEX +ends -struc BOOT_DATA -{ .bpp dd ? - .scanline dd ? - .vesa_mode dd ? - .x_res dd ? - .y_res dd ? - .mouse_port dd ? - .bank_switch dd ? - .lfb dd ? - .vesa_mem dd ? - .log dd ? - .direct_lfb dd ? - .pci_data dd ? -; dd ? - .vrr dd ? - .ide_base dd ? - .mem_amount dd ? - .pages_count dd ? - .pagemap_size dd ? - .kernel_max dd ? - .kernel_pages dd ? - .kernel_tables dd ? - - .cpu_vendor dd ? - dd ? - dd ? - .cpu_sign dd ? - .cpu_info dd ? - .cpu_caps dd ? - dd ? - dd ? -} - -virtual at 0 - BOOT_DATA BOOT_DATA -end virtual - -struc MEM_STATE -{ .mutex MUTEX - .smallmap rd 1 - .treemap rd 1 - .topsize rd 1 - .top rd 1 - .smallbins rd 4*32 - .treebins rd 32 -} - -struc PG_DATA -{ .mem_amount dd ? - .vesa_mem dd ? - .pages_count dd ? - .pages_free dd ? - .pages_faults dd ? - .pagemap_size dd ? - .kernel_pages dd ? - .kernel_tables dd ? - .sys_page_dir dd ? - .mutex MUTEX -} - -;struc LIB -;{ .lib_name rb 16 -; .lib_base dd ? -; .lib_start dd ? -; .export dd ? -; .import dd ? -;} - -struc SRV -{ - .srv_name rb 16 ;ASCIIZ string - .magic dd ? ;+0x10 ;'SRV ' - .size dd ? ;+0x14 ;size of structure SRV - .fd dd ? ;+0x18 ;next SRV descriptor - .bk dd ? ;+0x1C ;prev SRV descriptor - .base dd ? ;+0x20 ;service base address - .entry dd ? ;+0x24 ;service START function - .srv_proc dd ? ;+0x28 ;user mode service handler - .srv_proc_ex dd ? ;+0x2C ;kernel mode service handler - .sizeof: -} - -SRV_FD_OFFSET equ 0x18 +struct SRV + srv_name rb 16 ;ASCIIZ string + magic dd ? ;+0x10 ;'SRV ' + size dd ? ;+0x14 ;size of structure SRV + fd dd ? ;+0x18 ;next SRV descriptor + bk dd ? ;+0x1C ;prev SRV descriptor + base dd ? ;+0x20 ;service base address + entry dd ? ;+0x24 ;service START function + srv_proc dd ? ;+0x28 ;user mode service handler + srv_proc_ex dd ? ;+0x2C ;kernel mode service handler +ends DRV_ENTRY equ 1 DRV_EXIT equ -1 -struc COFF_HEADER -{ .machine dw ? - .nSections dw ? - .DataTime dd ? - .pSymTable dd ? - .nSymbols dd ? - .optHeader dw ? - .flags dw ? -}; +struct COFF_HEADER + machine dw ? + nSections dw ? + DataTime dd ? + pSymTable dd ? + nSymbols dd ? + optHeader dw ? + flags dw ? +ends +struct COFF_SECTION + Name rb 8 + VirtualSize dd ? + VirtualAddress dd ? + SizeOfRawData dd ? + PtrRawData dd ? + PtrReloc dd ? + PtrLinenumbers dd ? + NumReloc dw ? + NumLinenum dw ? + Characteristics dd ? +ends -struc COFF_SECTION -{ .Name rb 8 - .VirtualSize dd ? - .VirtualAddress dd ? - .SizeOfRawData dd ? - .PtrRawData dd ? - .PtrReloc dd ? - .PtrLinenumbers dd ? - .NumReloc dw ? - .NumLinenum dw ? - .Characteristics dd ? -} -COFF_SECTION_SIZE equ 40 +struct COFF_RELOC + VirtualAddress dd ? + SymIndex dd ? + Type dw ? +ends -struc COFF_RELOC -{ .VirtualAddress dd ? - .SymIndex dd ? - .Type dw ? -} +struct COFF_SYM + Name rb 8 + Value dd ? + SectionNumber dw ? + Type dw ? + StorageClass db ? + NumAuxSymbols db ? +ends -struc COFF_SYM -{ .Name rb 8 - .Value dd ? - .SectionNumber dw ? - .Type dw ? - .StorageClass db ? - .NumAuxSymbols db ? -} -CSYM_SIZE equ 18 - -struc IOCTL -{ .handle dd ? - .io_code dd ? - .input dd ? - .inp_size dd ? - .output dd ? - .out_size dd ? -} - -virtual at 0 - IOCTL IOCTL -end virtual - -;virtual at 0 -; LIB LIB -;end virtual - -virtual at 0 - SRV SRV -end virtual - -virtual at 0 - CFH COFF_HEADER -end virtual - -virtual at 0 - CFS COFF_SECTION -end virtual - -virtual at 0 - CRELOC COFF_RELOC -end virtual - -virtual at 0 - CSYM COFF_SYM -end virtual - -struc LHEAD -{ - .next dd ? ;next object in list - .prev dd ? ;prev object in list - .sizeof: -} - -virtual at 0 - LHEAD LHEAD -end virtual - -struc IRQH -{ - .list LHEAD - .handler dd ? ;handler roututine - .data dd ? ;user-specific data - .sizeof: -} - -virtual at 0 - IRQH IRQH -end virtual +struct IOCTL + handle dd ? + io_code dd ? + input dd ? + inp_size dd ? + output dd ? + out_size dd ? +ends +struct IRQH + list LHEAD + handler dd ? ;handler roututine + data dd ? ;user-specific data +ends \ No newline at end of file diff --git a/kernel/trunk/core/dll.inc b/kernel/trunk/core/dll.inc index 0f13008ebc..b69a35965b 100644 --- a/kernel/trunk/core/dll.inc +++ b/kernel/trunk/core/dll.inc @@ -139,7 +139,7 @@ proc srv_handler stdcall, ioctl:dword cmp [edi+SRV.magic], ' SRV' jne .fail - cmp [edi+SRV.size], SRV.sizeof + cmp [edi+SRV.size], sizeof.SRV jne .fail stdcall [edi+SRV.srv_proc], esi @@ -171,7 +171,7 @@ srv_handlerEx: cmp [eax+SRV.magic], ' SRV' jne .fail - cmp [eax+SRV.size], SRV.sizeof + cmp [eax+SRV.size], sizeof.SRV jne .fail stdcall [eax+SRV.srv_proc], ecx @@ -196,7 +196,7 @@ proc get_service stdcall, sz_name:dword @@: mov edx, [srv.fd] @@: - cmp edx, srv.fd-SRV_FD_OFFSET + cmp edx, srv.fd-SRV.fd je .not_load stdcall strncmp, edx, [sz_name], 16 @@ -226,7 +226,7 @@ proc reg_service stdcall, name:dword, handler:dword cmp [handler], eax je .fail - mov eax, SRV.sizeof + mov eax, sizeof.SRV call malloc test eax, eax jz .fail @@ -243,9 +243,9 @@ proc reg_service stdcall, name:dword, handler:dword pop esi mov [eax+SRV.magic], ' SRV' - mov [eax+SRV.size], SRV.sizeof + mov [eax+SRV.size], sizeof.SRV - mov ebx, srv.fd-SRV_FD_OFFSET + mov ebx, srv.fd-SRV.fd mov edx, [ebx+SRV.fd] mov [eax+SRV.fd], edx mov [eax+SRV.bk], ebx @@ -514,10 +514,10 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\ mov edi, [symbols] mov [retval], 1 .fix: - movzx ebx, [edi+CSYM.SectionNumber] + movzx ebx, [edi+COFF_SYM.SectionNumber] test ebx, ebx jnz .internal - mov eax, dword [edi+CSYM.Name] + mov eax, dword [edi+COFF_SYM.Name] test eax, eax jnz @F @@ -542,7 +542,7 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\ mov [retval], 0 @@: mov edi, [symbols] - mov [edi+CSYM.Value], eax + mov [edi+COFF_SYM.Value], eax jmp .next .internal: cmp bx, -1 @@ -555,10 +555,10 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\ lea ebx, [ebx+ebx*4] add ebx, [sec] - mov eax, [ebx+CFS.VirtualAddress] - add [edi+CSYM.Value], eax + mov eax, [ebx+COFF_SECTION.VirtualAddress] + add [edi+COFF_SYM.Value], eax .next: - add edi, CSYM_SIZE + add edi, sizeof.COFF_SYM mov [symbols], edi dec [sym_count] jnz .fix @@ -574,38 +574,38 @@ proc fix_coff_relocs stdcall uses ebx esi, coff:dword, sym:dword, \ endl mov eax, [coff] - movzx ebx, [eax+CFH.nSections] + movzx ebx, [eax+COFF_HEADER.nSections] mov [n_sec], ebx lea esi, [eax+20] .fix_sec: - mov edi, [esi+CFS.PtrReloc] + mov edi, [esi+COFF_SECTION.PtrReloc] add edi, [coff] - movzx ecx, [esi+CFS.NumReloc] + movzx ecx, [esi+COFF_SECTION.NumReloc] test ecx, ecx jz .next .reloc_loop: - mov ebx, [edi+CRELOC.SymIndex] + mov ebx, [edi+COFF_RELOC.SymIndex] add ebx, ebx lea ebx, [ebx+ebx*8] add ebx, [sym] - mov edx, [ebx+CSYM.Value] + mov edx, [ebx+COFF_SYM.Value] - cmp [edi+CRELOC.Type], 6 + cmp [edi+COFF_RELOC.Type], 6 je .dir_32 - cmp [edi+CRELOC.Type], 20 + cmp [edi+COFF_RELOC.Type], 20 jne .next_reloc .rel_32: - mov eax, [edi+CRELOC.VirtualAddress] - add eax, [esi+CFS.VirtualAddress] + mov eax, [edi+COFF_RELOC.VirtualAddress] + add eax, [esi+COFF_SECTION.VirtualAddress] sub edx, eax sub edx, 4 jmp .fix .dir_32: - mov eax, [edi+CRELOC.VirtualAddress] - add eax, [esi+CFS.VirtualAddress] + mov eax, [edi+COFF_RELOC.VirtualAddress] + add eax, [esi+COFF_SECTION.VirtualAddress] .fix: add eax, [delta] add [eax], edx @@ -614,7 +614,7 @@ proc fix_coff_relocs stdcall uses ebx esi, coff:dword, sym:dword, \ dec ecx jnz .reloc_loop .next: - add esi, COFF_SECTION_SIZE + add esi, sizeof.COFF_SECTION dec [n_sec] jnz .fix_sec .exit: @@ -629,30 +629,30 @@ proc rebase_coff stdcall uses ebx esi, coff:dword, sym:dword, \ endl mov eax, [coff] - movzx ebx, [eax+CFH.nSections] + movzx ebx, [eax+COFF_HEADER.nSections] mov [n_sec], ebx lea esi, [eax+20] mov edx, [delta] .fix_sec: - mov edi, [esi+CFS.PtrReloc] + mov edi, [esi+COFF_SECTION.PtrReloc] add edi, [coff] - movzx ecx, [esi+CFS.NumReloc] + movzx ecx, [esi+COFF_SECTION.NumReloc] test ecx, ecx jz .next .reloc_loop: - cmp [edi+CRELOC.Type], 6 + cmp [edi+COFF_RELOC.Type], 6 jne .next_reloc .dir_32: - mov eax, [edi+CRELOC.VirtualAddress] - add eax, [esi+CFS.VirtualAddress] + mov eax, [edi+COFF_RELOC.VirtualAddress] + add eax, [esi+COFF_SECTION.VirtualAddress] add [eax+edx], edx .next_reloc: add edi, 10 dec ecx jnz .reloc_loop .next: - add esi, COFF_SECTION_SIZE + add esi, sizeof.COFF_SECTION dec [n_sec] jnz .fix_sec .exit: @@ -700,15 +700,15 @@ proc load_driver stdcall, driver_name:dword mov [coff], eax - movzx ecx, [eax+CFH.nSections] + movzx ecx, [eax+COFF_HEADER.nSections] xor ebx, ebx lea edx, [eax+20] @@: - add ebx, [edx+CFS.SizeOfRawData] + add ebx, [edx+COFF_SECTION.SizeOfRawData] add ebx, 15 and ebx, not 15 - add edx, COFF_SECTION_SIZE + add edx, sizeof.COFF_SECTION dec ecx jnz @B mov [img_size], ebx @@ -728,32 +728,32 @@ proc load_driver stdcall, driver_name:dword rep stosd mov edx, [coff] - movzx ebx, [edx+CFH.nSections] + movzx ebx, [edx+COFF_HEADER.nSections] mov edi, [img_base] lea eax, [edx+20] @@: - mov [eax+CFS.VirtualAddress], edi - mov esi, [eax+CFS.PtrRawData] + mov [eax+COFF_SECTION.VirtualAddress], edi + mov esi, [eax+COFF_SECTION.PtrRawData] test esi, esi jnz .copy - add edi, [eax+CFS.SizeOfRawData] + add edi, [eax+COFF_SECTION.SizeOfRawData] jmp .next .copy: add esi, edx - mov ecx, [eax+CFS.SizeOfRawData] + mov ecx, [eax+COFF_SECTION.SizeOfRawData] cld rep movsb .next: add edi, 15 and edi, not 15 - add eax, COFF_SECTION_SIZE + add eax, sizeof.COFF_SECTION dec ebx jnz @B - mov ebx, [edx+CFH.pSymTable] + mov ebx, [edx+COFF_HEADER.pSymTable] add ebx, edx mov [sym], ebx - mov ecx, [edx+CFH.nSymbols] + mov ecx, [edx+COFF_HEADER.nSymbols] add ecx, ecx lea ecx, [ecx+ecx*8];ecx*=18 = nSymbols*CSYM_SIZE add ecx, [sym] @@ -764,7 +764,7 @@ proc load_driver stdcall, driver_name:dword mov dword [ebx+4], 0 lea eax, [edx+20] - stdcall fix_coff_symbols, eax, [sym], [edx+CFH.nSymbols], \ + stdcall fix_coff_symbols, eax, [sym], [edx+COFF_HEADER.nSymbols], \ [strings], ebx test eax, eax jz .link_fail @@ -772,7 +772,7 @@ proc load_driver stdcall, driver_name:dword mov ebx, [coff] stdcall fix_coff_relocs, ebx, [sym], 0 - stdcall get_coff_sym, [sym], [ebx+CFH.nSymbols], szVersion + stdcall get_coff_sym, [sym], [ebx+COFF_HEADER.nSymbols], szVersion test eax, eax jz .link_fail @@ -785,7 +785,7 @@ proc load_driver stdcall, driver_name:dword ja .ver_fail mov ebx, [coff] - stdcall get_coff_sym, [sym], [ebx+CFH.nSymbols], szSTART + stdcall get_coff_sym, [sym], [ebx+COFF_HEADER.nSymbols], szSTART mov [start], eax stdcall kernel_free, [coff] @@ -851,7 +851,7 @@ coff_get_align: ; - if alignment is given and is no more than 4K, use it; ; - if alignment is more than 4K, revert to 4K. push ecx - mov cl, byte [edx+CFS.Characteristics+2] + mov cl, byte [edx+COFF_SECTION.Characteristics+2] mov eax, 1 shr cl, 4 dec cl @@ -955,7 +955,7 @@ proc load_library stdcall, file_name:dword xor eax, eax repnz scasb not ecx - lea eax, [ecx+DLLDESCR.sizeof] + lea eax, [ecx+sizeof.DLLDESCR] push ecx call malloc pop ecx @@ -979,7 +979,7 @@ proc load_library stdcall, file_name:dword ; calculate size of loaded DLL mov edx, [coff] - movzx ecx, [edx+CFH.nSections] + movzx ecx, [edx+COFF_HEADER.nSections] xor ebx, ebx add edx, 20 @@ -988,8 +988,8 @@ proc load_library stdcall, file_name:dword add ebx, eax not eax and ebx, eax - add ebx, [edx+CFS.SizeOfRawData] - add edx, COFF_SECTION_SIZE + add ebx, [edx+COFF_SECTION.SizeOfRawData] + add edx, sizeof.COFF_SECTION dec ecx jnz @B ; it must be nonzero and not too big @@ -1019,7 +1019,7 @@ proc load_library stdcall, file_name:dword ; copy sections and set correct values for VirtualAddress'es in headers push esi mov edx, [coff] - movzx ebx, [edx+CFH.nSections] + movzx ebx, [edx+COFF_HEADER.nSections] mov edi, eax add edx, 20 cld @@ -1030,11 +1030,11 @@ proc load_library stdcall, file_name:dword not eax and ecx, eax and edi, eax - mov [edx+CFS.VirtualAddress], ecx - add ecx, [edx+CFS.SizeOfRawData] - mov esi, [edx+CFS.PtrRawData] + mov [edx+COFF_SECTION.VirtualAddress], ecx + add ecx, [edx+COFF_SECTION.SizeOfRawData] + mov esi, [edx+COFF_SECTION.PtrRawData] push ecx - mov ecx, [edx+CFS.SizeOfRawData] + mov ecx, [edx+COFF_SECTION.SizeOfRawData] test esi, esi jnz .copy xor eax, eax @@ -1045,7 +1045,7 @@ proc load_library stdcall, file_name:dword rep movsb .next: pop ecx - add edx, COFF_SECTION_SIZE + add edx, sizeof.COFF_SECTION dec ebx jnz @B pop esi @@ -1054,28 +1054,28 @@ proc load_library stdcall, file_name:dword ; later we will use COFF header, headers for sections and symbol table ; and also relocations table for all sections mov edx, [coff] - mov ebx, [edx+CFH.pSymTable] + mov ebx, [edx+COFF_HEADER.pSymTable] mov edi, dword [fileinfo+32] sub edi, ebx jc .fail_and_free_data mov [esi+DLLDESCR.symbols_lim], edi add ebx, edx - movzx ecx, [edx+CFH.nSections] + movzx ecx, [edx+COFF_HEADER.nSections] lea ecx, [ecx*5] lea edi, [edi+ecx*8+20] add edx, 20 @@: - movzx eax, [edx+CFS.NumReloc] + movzx eax, [edx+COFF_SECTION.NumReloc] lea eax, [eax*5] lea edi, [edi+eax*2] - add edx, COFF_SECTION_SIZE + add edx, sizeof.COFF_SECTION sub ecx, 5 jnz @b stdcall kernel_alloc, edi test eax, eax jz .fail_and_free_data mov edx, [coff] - movzx ecx, [edx+CFH.nSections] + movzx ecx, [edx+COFF_HEADER.nSections] lea ecx, [ecx*5] lea ecx, [ecx*2+5] mov [esi+DLLDESCR.coff_hdr], eax @@ -1086,7 +1086,7 @@ proc load_library stdcall, file_name:dword pop esi mov [esi+DLLDESCR.symbols_ptr], edi push esi - mov ecx, [edx+CFH.nSymbols] + mov ecx, [edx+COFF_HEADER.nSymbols] mov [esi+DLLDESCR.symbols_num], ecx mov ecx, [esi+DLLDESCR.symbols_lim] mov esi, ebx @@ -1094,27 +1094,27 @@ proc load_library stdcall, file_name:dword pop esi mov ebx, [esi+DLLDESCR.coff_hdr] push esi - movzx eax, [edx+CFH.nSections] + movzx eax, [edx+COFF_HEADER.nSections] lea edx, [ebx+20] @@: - movzx ecx, [edx+CFS.NumReloc] + movzx ecx, [edx+COFF_SECTION.NumReloc] lea ecx, [ecx*5] - mov esi, [edx+CFS.PtrReloc] - mov [edx+CFS.PtrReloc], edi - sub [edx+CFS.PtrReloc], ebx + mov esi, [edx+COFF_SECTION.PtrReloc] + mov [edx+COFF_SECTION.PtrReloc], edi + sub [edx+COFF_SECTION.PtrReloc], ebx add esi, [coff] shr ecx, 1 rep movsd adc ecx, ecx rep movsw - add edx, COFF_SECTION_SIZE + add edx, sizeof.COFF_SECTION dec eax jnz @b pop esi ; fixup symbols mov edx, ebx - mov eax, [ebx+CFH.nSymbols] + mov eax, [ebx+COFF_HEADER.nSymbols] add edx, 20 mov ecx, [esi+DLLDESCR.symbols_num] lea ecx, [ecx*9] @@ -1128,11 +1128,11 @@ proc load_library stdcall, file_name:dword ; ;@@: - stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+CFH.nSymbols], szEXPORTS + stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+COFF_HEADER.nSymbols], szEXPORTS test eax, eax jnz @F - stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+CFH.nSymbols], sz_EXPORTS + stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+COFF_HEADER.nSymbols], sz_EXPORTS @@: mov [esi+DLLDESCR.exports], eax @@ -1160,7 +1160,7 @@ proc load_library stdcall, file_name:dword jz .fail_and_dereference @@: mov [img_base], eax - mov eax, HDLL.sizeof + mov eax, sizeof.HDLL call malloc test eax, eax jz .fail_and_free_user @@ -1369,11 +1369,11 @@ stop_all_services: push ebp mov edx, [srv.fd] .next: - cmp edx, srv.fd-SRV_FD_OFFSET + cmp edx, srv.fd-SRV.fd je .done cmp [edx+SRV.magic], ' SRV' jne .next - cmp [edx+SRV.size], SRV.sizeof + cmp [edx+SRV.size], sizeof.SRV jne .next mov ebx, [edx+SRV.entry] diff --git a/kernel/trunk/core/heap.inc b/kernel/trunk/core/heap.inc index c9a2af85a4..6055f5ad6e 100644 --- a/kernel/trunk/core/heap.inc +++ b/kernel/trunk/core/heap.inc @@ -8,26 +8,20 @@ $Revision$ -struc MEM_BLOCK -{ - .list LHEAD - .next_block dd ? ;+8 - .prev_block dd ? ;+4 - .base dd ? ;+16 - .size dd ? ;+20 - .flags dd ? ;+24 - .handle dd ? ;+28 - .sizeof: -} +struct MEM_BLOCK + list LHEAD + next_block dd ? ;+8 + prev_block dd ? ;+4 + base dd ? ;+16 + size dd ? ;+20 + flags dd ? ;+24 + handle dd ? ;+28 +ends FREE_BLOCK equ 4 USED_BLOCK equ 8 DONT_FREE_BLOCK equ 10h -virtual at 0 - MEM_BLOCK MEM_BLOCK -end virtual - block_next equ MEM_BLOCK.next_block block_prev equ MEM_BLOCK.prev_block @@ -146,8 +140,8 @@ proc init_kernel_heap jnz .l1 mov edi, HEAP_BASE ;descriptors - mov ebx, HEAP_BASE+MEM_BLOCK.sizeof ;free space - mov ecx, HEAP_BASE+MEM_BLOCK.sizeof*2 ;terminator + mov ebx, HEAP_BASE+sizeof.MEM_BLOCK ;free space + mov ecx, HEAP_BASE+sizeof.MEM_BLOCK*2 ;terminator xor eax, eax mov [edi+block_next], ebx @@ -155,7 +149,7 @@ proc init_kernel_heap mov [edi+list_fd], eax mov [edi+list_bk], eax mov [edi+block_base], HEAP_BASE - mov [edi+block_size], 4096*MEM_BLOCK.sizeof + mov [edi+block_size], 4096*sizeof.MEM_BLOCK mov [edi+block_flags], USED_BLOCK mov [ecx+block_next], eax @@ -168,11 +162,11 @@ proc init_kernel_heap mov [ebx+block_next], ecx mov [ebx+block_prev], edi - mov [ebx+block_base], HEAP_BASE+4096*MEM_BLOCK.sizeof + mov [ebx+block_base], HEAP_BASE+4096*sizeof.MEM_BLOCK mov ecx, [pg_data.kernel_pages] shl ecx, 12 - sub ecx, HEAP_BASE-OS_BASE+4096*MEM_BLOCK.sizeof + sub ecx, HEAP_BASE-OS_BASE+4096*sizeof.MEM_BLOCK mov [heap_size], ecx mov [heap_free], ecx mov [ebx+block_size], ecx @@ -185,15 +179,15 @@ proc init_kernel_heap list_add ebx, ecx mov ecx, 4096-3-1 - mov eax, HEAP_BASE+MEM_BLOCK.sizeof*4 + mov eax, HEAP_BASE+sizeof.MEM_BLOCK*4 - mov [next_memblock], HEAP_BASE+MEM_BLOCK.sizeof*3 + mov [next_memblock], HEAP_BASE+sizeof.MEM_BLOCK *3 @@: - mov [eax-MEM_BLOCK.sizeof], eax - add eax, MEM_BLOCK.sizeof + mov [eax-sizeof.MEM_BLOCK], eax + add eax, sizeof.MEM_BLOCK loop @B - mov [eax-MEM_BLOCK.sizeof], dword 0 + mov [eax-sizeof.MEM_BLOCK], dword 0 mov ecx, heap_mutex call mutex_init @@ -1292,7 +1286,7 @@ align 4 and ecx, -4096 mov [size], ecx - mov eax, SMEM.sizeof + mov eax, sizeof.SMEM call malloc test eax, eax mov esi, eax @@ -1354,7 +1348,7 @@ align 4 mov ebx, [CURRENT_TASK] shl ebx, 5 mov ebx, [CURRENT_TASK+ebx+4] - mov eax, SMAP.sizeof + mov eax, sizeof.SMAP call create_kernel_object test eax, eax diff --git a/kernel/trunk/core/irq.inc b/kernel/trunk/core/irq.inc index 2b592b7516..de75fb2543 100644 --- a/kernel/trunk/core/irq.inc +++ b/kernel/trunk/core/irq.inc @@ -12,9 +12,9 @@ IRQ_POOL_SIZE equ 48 uglobal align 16 -irqh_tab rd LHEAD.sizeof * IRQ_RESERVED / 4 +irqh_tab rd sizeof.LHEAD * IRQ_RESERVED / 4 -irqh_pool rd IRQH.sizeof * IRQ_POOL_SIZE /4 +irqh_pool rd sizeof.IRQH * IRQ_POOL_SIZE /4 next_irqh rd 1 irq_active_set rd 1 @@ -34,14 +34,14 @@ init_irqs: loop @B mov ecx, IRQ_POOL_SIZE-1 - mov eax, irqh_pool+IRQH.sizeof + mov eax, irqh_pool+sizeof.IRQH mov [next_irqh], irqh_pool @@: - mov [eax-IRQH.sizeof], eax - add eax, IRQH.sizeof + mov [eax-sizeof.IRQH], eax + add eax, sizeof.IRQH loop @B - mov [eax-IRQH.sizeof], dword 0 + mov [eax-sizeof.IRQH], dword 0 ret diff --git a/kernel/trunk/core/taskman.inc b/kernel/trunk/core/taskman.inc index 38f42a24b5..f1df807e63 100644 --- a/kernel/trunk/core/taskman.inc +++ b/kernel/trunk/core/taskman.inc @@ -10,34 +10,34 @@ $Revision$ GREEDY_KERNEL equ 0 -struc APP_HEADER_00 -{ .banner dq ? - .version dd ? ;+8 - .start dd ? ;+12 - .i_end dd ? ;+16 - .mem_size dd ? ;+20 - .i_param dd ? ;+24 -} +struct APP_HEADER_00_ + banner dq ? + version dd ? ;+8 + start dd ? ;+12 + i_end dd ? ;+16 + mem_size dd ? ;+20 + i_param dd ? ;+24 +ends -struc APP_HEADER_01 -{ .banner dq ? - .version dd ? ;+8 - .start dd ? ;+12 - .i_end dd ? ;+16 - .mem_size dd ? ;+20 - .stack_top dd ? ;+24 - .i_param dd ? ;+28 - .i_icon dd ? ;+32 -} +struct APP_HEADER_01_ + banner dq ? + version dd ? ;+8 + start dd ? ;+12 + i_end dd ? ;+16 + mem_size dd ? ;+20 + stack_top dd ? ;+24 + i_param dd ? ;+28 + i_icon dd ? ;+32 +ends -struc APP_PARAMS -{ .app_cmdline ;0x00 - .app_path ;0x04 - .app_eip ;0x08 - .app_esp ;0x0C - .app_mem ;0x10 -} +struct APP_PARAMS + app_cmdline dd ? ;0x00 + app_path dd ? ;0x04 + app_eip dd ? ;0x08 + app_esp dd ? ;0x0C + app_mem dd ? ;0x10 +ends macro _clear_ op { mov ecx, op/4 @@ -254,10 +254,10 @@ endp align 4 test_app_header: virtual at eax - APP_HEADER_00 APP_HEADER_00 + APP_HEADER_00 APP_HEADER_00_ end virtual virtual at eax - APP_HEADER_01 APP_HEADER_01 + APP_HEADER_01 APP_HEADER_01_ end virtual cmp dword [eax], 'MENU' diff --git a/kernel/trunk/core/v86.inc b/kernel/trunk/core/v86.inc index a941b96917..9db83d8680 100644 --- a/kernel/trunk/core/v86.inc +++ b/kernel/trunk/core/v86.inc @@ -12,21 +12,16 @@ $Revision$ DEBUG_SHOW_IO = 0 -struc V86_machine -{ +struct V86_machine ; page directory - .pagedir dd ? + pagedir dd ? ; translation table: V86 address -> flat linear address - .pages dd ? + pages dd ? ; mutex to protect all data from writing by multiple threads at one time - .mutex dd ? + mutex dd ? ; i/o permission map - .iopm dd ? -.size = $ -} -virtual at 0 -V86_machine V86_machine -end virtual + iopm dd ? +ends ; Create V86 machine ; in: nothing @@ -35,7 +30,7 @@ end virtual ; destroys: ebx, ecx, edx (due to malloc) v86_create: ; allocate V86_machine structure - mov eax, V86_machine.size + mov eax, sizeof.V86_machine call malloc test eax, eax jz .fail @@ -245,31 +240,26 @@ end if .ret: ret -struc v86_regs -{ +struct v86_regs ; don't change the order, it is important - .edi dd ? - .esi dd ? - .ebp dd ? - dd ? ; ignored - .ebx dd ? - .edx dd ? - .ecx dd ? - .eax dd ? - .eip dd ? - .cs dd ? - .eflags dd ? ; VM flag must be set! - .esp dd ? - .ss dd ? - .es dd ? - .ds dd ? - .fs dd ? - .gs dd ? -.size = $ -} -virtual at 0 -v86_regs v86_regs -end virtual + edi dd ? + esi dd ? + ebp dd ? + dd ? ; ignored + ebx dd ? + edx dd ? + ecx dd ? + eax dd ? + eip dd ? + cs dd ? + eflags dd ? ; VM flag must be set! + esp dd ? + ss dd ? + es dd ? + ds dd ? + fs dd ? + gs dd ? +ends ; Run V86 machine ; in: ebx -> registers for V86 (two structures: in and out) @@ -319,10 +309,10 @@ v86_start: ; sti mov eax, esi - sub esp, v86_regs.size + sub esp, sizeof.v86_regs mov esi, ebx mov edi, esp - mov ecx, v86_regs.size/4 + mov ecx, sizeof.v86_regs/4 rep movsd cmp edx, -1 @@ -372,7 +362,7 @@ v86_exc_c: xor eax, eax mov dr6, eax @@: - mov eax, [esp+v86_regs.size+10h+18h] + mov eax, [esp+sizeof.v86_regs+10h+18h] cmp word [esp+v86_regs.eip], ax jnz @f shr eax, 16 @@ -444,7 +434,7 @@ v86_exc_c: sub eax, 6 add edx, eax mov eax, edx - mov esi, [esp+4+v86_regs.size+10h+4] + mov esi, [esp+4+sizeof.v86_regs+10h+4] call v86_get_lin_addr cmp eax, 0x1000 jae @f @@ -492,7 +482,7 @@ v86_exc_c: movzx eax, word [esp+v86_regs.esp] add edx, eax mov eax, edx - mov esi, [esp+v86_regs.size+10h+4] + mov esi, [esp+sizeof.v86_regs+10h+4] call v86_get_lin_addr cmp eax, 0x1000 jae @f @@ -528,7 +518,7 @@ v86_exc_c: movzx eax, ax add edx, eax mov eax, edx - mov esi, [esp+v86_regs.size+10h+4] + mov esi, [esp+sizeof.v86_regs+10h+4] call v86_get_lin_addr cmp eax, 0x1000 jae @f @@ -560,7 +550,7 @@ v86_exc_c: sub eax, 4 add edx, eax mov eax, edx - mov esi, [esp+v86_regs.size+10h+4] + mov esi, [esp+sizeof.v86_regs+10h+4] call v86_get_lin_addr cmp eax, 0x1000 jae @f @@ -591,7 +581,7 @@ v86_exc_c: movzx eax, word [esp+v86_regs.esp] add edx, eax mov eax, edx - mov esi, [esp+v86_regs.size+10h+4] + mov esi, [esp+sizeof.v86_regs+10h+4] call v86_get_lin_addr cmp eax, 0x1000 jae @f @@ -622,7 +612,7 @@ v86_exc_c: movzx eax, word [esp+v86_regs.esp] add edx, eax mov eax, edx - mov esi, [esp+v86_regs.size+10h+4] + mov esi, [esp+sizeof.v86_regs+10h+4] call v86_get_lin_addr cmp eax, 0x1000 jae @f @@ -748,7 +738,7 @@ end if shl edx, 4 add edx, [esp+32] @@: - mov esi, [esp+v86_regs.size+10h+4] + mov esi, [esp+sizeof.v86_regs+10h+4] mov eax, edx call v86_get_lin_addr cmp eax, 0x1000 @@ -773,10 +763,10 @@ end if xor eax, eax .exit: - mov [esp+v86_regs.size+10h+1Ch], eax - mov [esp+v86_regs.size+10h+18h], ebx + mov [esp+sizeof.v86_regs+10h+1Ch], eax + mov [esp+sizeof.v86_regs+10h+18h], ebx - mov edx, [esp+v86_regs.size+10h+14h] + mov edx, [esp+sizeof.v86_regs+10h+14h] cmp edx, -1 jz @f dec [v86_irqhooks+edx*8+4] @@ -785,9 +775,9 @@ end if @@: mov esi, esp - mov edi, [esi+v86_regs.size+10h+10h] - add edi, v86_regs.size - mov ecx, v86_regs.size/4 + mov edi, [esi+sizeof.v86_regs+10h+10h] + add edi, sizeof.v86_regs + mov ecx, sizeof.v86_regs/4 rep movsd mov esp, esi @@ -874,12 +864,12 @@ v86_irq2: jnz .cont push ecx mov ecx, [ebx+APPDATA.saved_esp0] - cmp word [ecx-v86_regs.size+v86_regs.esp], 6 + cmp word [ecx-sizeof.v86_regs+v86_regs.esp], 6 jb .cont2 - movzx edx, word [ecx-v86_regs.size+v86_regs.ss] + movzx edx, word [ecx-sizeof.v86_regs+v86_regs.ss] shl edx, 4 push eax - movzx eax, word [ecx-v86_regs.size+v86_regs.esp] + movzx eax, word [ecx-sizeof.v86_regs+v86_regs.esp] sub eax, 6 add edx, eax mov eax, edx @@ -905,12 +895,12 @@ v86_irq2: iretd .found: mov cr3, eax - sub word [esi-v86_regs.size+v86_regs.esp], 6 - mov ecx, [esi-v86_regs.size+v86_regs.eip] + sub word [esi-sizeof.v86_regs+v86_regs.esp], 6 + mov ecx, [esi-sizeof.v86_regs+v86_regs.eip] mov word [edx], cx - mov ecx, [esi-v86_regs.size+v86_regs.cs] + mov ecx, [esi-sizeof.v86_regs+v86_regs.cs] mov word [edx+2], cx - mov ecx, [esi-v86_regs.size+v86_regs.eflags] + mov ecx, [esi-sizeof.v86_regs+v86_regs.eflags] mov word [edx+4], cx lea eax, [edi+8] cmp al, 10h @@ -918,10 +908,10 @@ v86_irq2: add al, 60h @@: mov cx, [eax*4] - mov word [esi-v86_regs.size+v86_regs.eip], cx + mov word [esi-sizeof.v86_regs+v86_regs.eip], cx mov cx, [eax*4+2] - mov word [esi-v86_regs.size+v86_regs.cs], cx - and byte [esi-v86_regs.size+v86_regs.eflags+1], not 3 + mov word [esi-sizeof.v86_regs+v86_regs.cs], cx + and byte [esi-sizeof.v86_regs+v86_regs.eflags+1], not 3 call update_counters lea edi, [ebx + 0x100000000 - SLOT_BASE] shr edi, 3 diff --git a/kernel/trunk/data32.inc b/kernel/trunk/data32.inc index 8797b4fd78..adc9e73a14 100644 --- a/kernel/trunk/data32.inc +++ b/kernel/trunk/data32.inc @@ -275,7 +275,7 @@ graph_data_l: dw 11010000b *256 +11110010b db 0x00 tss0_l: - dw TSS_SIZE-1 + dw sizeof.TSS-1 dw tss and 0xFFFF db (tss shr 16) and 0xFF db 10001001b diff --git a/kernel/trunk/gui/button.inc b/kernel/trunk/gui/button.inc index 243179dc29..b1db263aef 100644 --- a/kernel/trunk/gui/button.inc +++ b/kernel/trunk/gui/button.inc @@ -14,21 +14,16 @@ $Revision$ button.MAX_BUTTONS = 4095 -struc SYS_BUTTON -{ - .pslot dw ? - .id_lo dw ? - .left dw ? - .width dw ? - .top dw ? - .height dw ? - .id_hi dw ? - dw ? - .sizeof: -} -virtual at 0 - SYS_BUTTON SYS_BUTTON -end virtual +struct SYS_BUTTON + pslot dw ? + id_lo dw ? + left dw ? + width dw ? + top dw ? + height dw ? + id_hi dw ? + dw ? +ends align 4 ;------------------------------------------------------------------------------ @@ -216,18 +211,18 @@ syscall_button.remove_button: mov edi, [BTN_ADDR] mov ebx, [edi] inc ebx - imul esi, ebx, SYS_BUTTON.sizeof + imul esi, ebx, sizeof.SYS_BUTTON add esi, edi xor ecx, ecx - add ecx, -SYS_BUTTON.sizeof - add esi, SYS_BUTTON.sizeof + add ecx, -sizeof.SYS_BUTTON + add esi, sizeof.SYS_BUTTON .next_button: dec ebx jz .exit - add ecx, SYS_BUTTON.sizeof - add esi, -SYS_BUTTON.sizeof + add ecx, sizeof.SYS_BUTTON + add esi, -sizeof.SYS_BUTTON ; does it belong to our process? mov ax, [CURRENT_TASK] @@ -244,10 +239,10 @@ syscall_button.remove_button: ; okay, undefine it push ebx mov ebx, esi - lea eax, [esi + SYS_BUTTON.sizeof] + lea eax, [esi + sizeof.SYS_BUTTON] call memmove dec dword[edi] - add ecx, -SYS_BUTTON.sizeof + add ecx, -sizeof.SYS_BUTTON pop ebx jmp .next_button @@ -334,16 +329,16 @@ button._.find_button: ;//////////////////////////////////////////////////////// mov edi, [BTN_ADDR] mov ecx, [edi] - imul esi, ecx, SYS_BUTTON.sizeof + imul esi, ecx, sizeof.SYS_BUTTON add esi, edi inc ecx - add esi, SYS_BUTTON.sizeof + add esi, sizeof.SYS_BUTTON .next_button: dec ecx jz .not_found - add esi, -SYS_BUTTON.sizeof + add esi, -sizeof.SYS_BUTTON ; does it belong to our process? cmp dx, [esi + SYS_BUTTON.pslot] diff --git a/kernel/trunk/gui/event.inc b/kernel/trunk/gui/event.inc index 63f50949c5..1d36626fc4 100644 --- a/kernel/trunk/gui/event.inc +++ b/kernel/trunk/gui/event.inc @@ -25,7 +25,7 @@ FreeEvents = event_start-EVENT.fd ; " ; FreeEvents.fd=event_start и FreeEvents.bk=event_end align 4 init_events: ;; used from kernel.asm - stdcall kernel_alloc, EV_SPACE*EVENT.size + stdcall kernel_alloc, EV_SPACE*sizeof.EVENT or eax, eax jz .fail ; eax - current event, ebx - previos event below @@ -36,7 +36,7 @@ init_events: ;; used from kernel.asm mov [ebx+EVENT.fd], eax mov [eax+EVENT.bk], ebx mov ebx, eax ; previos <- current - add eax, EVENT.size ; new current + add eax, sizeof.EVENT ; new current loop @b pop eax ; вот оно концом и стало mov [ebx+EVENT.fd], eax @@ -100,7 +100,7 @@ set_event: ;; INTERNAL use !!! don't use or esi, esi jz RemoveEventTo lea edi, [eax+EVENT.code] - mov ecx, EVENT.codesize/4 + mov ecx, (sizeof.EVENT -EVENT.code)/4 cld rep movsd @@ -155,7 +155,7 @@ raise_event: ;; EXPORT use or esi, esi jz @f lea edi, [ebx+EVENT.code] - mov ecx, EVENT.codesize/4 + mov ecx, (sizeof.EVENT -EVENT.code)/4 cld rep movsd @@: @@ -299,10 +299,10 @@ get_event_ex: ;; f68:14 mov edx, get_event_queue ; wait_test call Wait_events ; timeout ignored lea esi, [eax+EVENT.code] - mov ecx, EVENT.codesize/4 + mov ecx, (sizeof.EVENT-EVENT.code)/4 cld rep movsd - mov [edi-EVENT.codesize+2], cl;clear priority field + mov byte[edi-(sizeof.EVENT-EVENT.code)+2], cl;clear priority field wait_finish: test byte[eax+EVENT.state+3], MANUAL_RESET shr 24 jnz get_event_queue.ret ; RET diff --git a/kernel/trunk/gui/mouse.inc b/kernel/trunk/gui/mouse.inc index bafecdd821..0de8b38260 100644 --- a/kernel/trunk/gui/mouse.inc +++ b/kernel/trunk/gui/mouse.inc @@ -568,16 +568,16 @@ mouse._.find_sys_button_under_cursor: ;//////////////////////////////////////// ; check if any process button contains cursor mov eax, [BTN_ADDR] mov ecx, [eax] - imul esi, ecx, SYS_BUTTON.sizeof + imul esi, ecx, sizeof.SYS_BUTTON add esi, eax inc ecx - add esi, SYS_BUTTON.sizeof + add esi, sizeof.SYS_BUTTON .next_button: dec ecx jz .not_found - add esi, -SYS_BUTTON.sizeof + add esi, -sizeof.SYS_BUTTON ; does it belong to our process? cmp dx, [esi + SYS_BUTTON.pslot] diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 3490422499..eff8a0560b 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -566,7 +566,7 @@ high_code: mov [unpack.p], eax call init_events - mov eax, srv.fd-SRV_FD_OFFSET + mov eax, srv.fd-SRV.fd mov [srv.fd], eax mov [srv.bk], eax diff --git a/kernel/trunk/kernel32.inc b/kernel/trunk/kernel32.inc index 0cd5211123..49d4cf4c6f 100644 --- a/kernel/trunk/kernel32.inc +++ b/kernel/trunk/kernel32.inc @@ -148,16 +148,6 @@ struct APPDATA ends - - -;// mike.dld, 2006-29-01 ] - -struct MUTEX - lhead LHEAD - count dd ? -ends - - ; Core functions include "core/sync.inc" ; macros for synhronization objects include "core/sys32.inc" ; process management diff --git a/kernel/trunk/video/blitter.inc b/kernel/trunk/video/blitter.inc index 4fa2a8d081..460cb7ba1e 100644 --- a/kernel/trunk/video/blitter.inc +++ b/kernel/trunk/video/blitter.inc @@ -1,34 +1,25 @@ +struct BLITTER_BLOCK + xmin dd ? + ymin dd ? + xmax dd ? + ymax dd ? +ends + +struct BLITTER + dc BLITTER_BLOCK + sc BLITTER_BLOCK + dst_x dd ? ; 32 + dst_y dd ? ; 36 + src_x dd ? ; 40 + src_y dd ? ; 44 + w dd ? ; 48 + h dd ? ; 52 -struc BLITTER -{ - .dc.xmin rd 1 ; 0 - .dc.ymin rd 1 ; 4 - .dc.xmax rd 1 ; 8 - .dc.ymax rd 1 ; 12 - - .sc: - .sc.xmin rd 1 ; 16 - .sc.ymin rd 1 ; 20 - .sc.xmax rd 1 ; 24 - .sc.ymax rd 1 ; 28 - - .dst_x rd 1 ; 32 - .dst_y rd 1 ; 36 - .src_x rd 1 ; 40 - .src_y rd 1 ; 44 - .w rd 1 ; 48 - .h rd 1 ; 52 - - .bitmap rd 1 ; 56 - .stride rd 1 ; 60 - -} - -virtual at 0 - BLITTER BLITTER -end virtual + bitmap dd ? ; 56 + stride dd ? ; 60 +ends align 4 diff --git a/kernel/trunk/video/cursors.inc b/kernel/trunk/video/cursors.inc index 2617f738ef..fb674bb71f 100644 --- a/kernel/trunk/video/cursors.inc +++ b/kernel/trunk/video/cursors.inc @@ -13,23 +13,19 @@ LOAD_FROM_MEM equ 1 LOAD_INDIRECT equ 2 LOAD_SYSTEM equ 3 -struc BITMAPINFOHEADER { - .biSize dd ? ; DWORD - .biWidth dd ? ; LONG - .biHeight dd ? ; LONG - .biPlanes dw ? ; WORD - .biBitCount dw ? ; WORD - .biCompression dd ? ; DWORD - .biSizeImage dd ? ; DWORD - .biXPelsPerMeter dd ? ; LONG - .biYPelsPerMeter dd ? ; LONG - .biClrUsed dd ? ; DWORD - .biClrImportant dd ? ; DWORD -} - -virtual at 0 - BI BITMAPINFOHEADER -end virtual +struct BITMAPINFOHEADER + Size dd ? + Width dd ? + Height dd ? + Planes dw ? + BitCount dw ? + Compression dd ? + SizeImage dd ? + XPelsPerMeter dd ? + YPelsPerMeter dd ? + ClrUsed dd ? + ClrImportant dd ? +ends align 4 proc init_cursor stdcall, dst:dword, src:dword @@ -47,11 +43,11 @@ proc init_cursor stdcall, dst:dword, src:dword add esi, [esi+18] mov eax, esi - cmp [esi+BI.biBitCount], 24 + cmp [esi+BITMAPINFOHEADER.BitCount], 24 je .img_24 - cmp [esi+BI.biBitCount], 8 + cmp [esi+BITMAPINFOHEADER.BitCount], 8 je .img_8 - cmp [esi+BI.biBitCount], 4 + cmp [esi+BITMAPINFOHEADER.BitCount], 4 je .img_4 .img_2: @@ -226,9 +222,9 @@ proc init_cursor stdcall, dst:dword, src:dword mov [pQuad], eax add eax, 0xC00 mov [pAnd], eax - mov eax, [esi+BI.biWidth] + mov eax, [esi+BITMAPINFOHEADER.Width] mov [width], eax - mov ebx, [esi+BI.biHeight] + mov ebx, [esi+BITMAPINFOHEADER.Height] shr ebx, 1 mov [height], ebx @@ -300,7 +296,7 @@ create_cursor: push ebx mov ebx, eax - mov eax, CURSOR.sizeof + mov eax, sizeof.CURSOR call create_kernel_object test eax, eax jz .fail