diff --git a/kernel/branches/net/blkdev/hd_drv.inc b/kernel/branches/net/blkdev/hd_drv.inc index 56cfcb6d98..fb768c1ce8 100644 --- a/kernel/branches/net/blkdev/hd_drv.inc +++ b/kernel/branches/net/blkdev/hd_drv.inc @@ -888,14 +888,14 @@ bd_write_cache_chain: .writeerr: popa mov [hd_error], 1 - jmp hd_write_error - -uglobal -int13_regs_in rb v86_regs.size -int13_regs_out rb v86_regs.size -endg - -int13_call: + jmp hd_write_error + +uglobal +int13_regs_in rb sizeof.v86_regs +int13_regs_out rb sizeof.v86_regs +endg + +int13_call: ; Because this code uses fixed addresses, ; it can not be run simultaniously by many threads. ; In current implementation it is protected by common mutex 'hd1_status' @@ -904,13 +904,13 @@ int13_call: mov dword [OS_BASE + 514h], 9A000000h ; buffer 9A00:0000 mov dword [OS_BASE + 518h], eax and dword [OS_BASE + 51Ch], 0 - push ebx ecx esi edi - mov ebx, int13_regs_in - mov edi, ebx - mov ecx, v86_regs.size/4 - xor eax, eax - rep stosd - mov byte [ebx+v86_regs.eax+1], dl + push ebx ecx esi edi + mov ebx, int13_regs_in + mov edi, ebx + mov ecx, sizeof.v86_regs/4 + xor eax, eax + rep stosd + mov byte [ebx+v86_regs.eax+1], dl mov eax, [hdpos] lea eax, [BiosDisksData+(eax-80h)*4] mov dl, [eax] diff --git a/kernel/branches/net/const.inc b/kernel/branches/net/const.inc index d6dc26028b..5a53a07185 100644 --- a/kernel/branches/net/const.inc +++ b/kernel/branches/net/const.inc @@ -176,14 +176,12 @@ struct TSS _io rw 1 rb 24 _io_map_0 rb 4096 - _io_map_1 rb 4096 -ends - -TSS_SIZE equ (128+8192) - -OS_BASE equ 0x80000000 - -window_data equ (OS_BASE+0x0001000) + _io_map_1 rb 4096 +ends + +OS_BASE equ 0x80000000 + +window_data equ (OS_BASE+0x0001000) CURRENT_TASK equ (OS_BASE+0x0003000) TASK_COUNT equ (OS_BASE+0x0003004) @@ -394,384 +392,259 @@ EVENT_IPC equ 0x00000040 EVENT_NETWORK equ 0x00000080 EVENT_DEBUG equ 0x00000100 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 -} - -THR_DATA_SIZE equ 4096*4 - -virtual at (OS_BASE-THR_DATA_SIZE) - thr_data THR_DATA -end virtual - -struc SYS_VARS -{ .bpp dd ? - .scanline dd ? - .vesa_mode dd ? - .x_res dd ? - .y_res dd ? -} - -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 - -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 - - ;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 - - -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 - - -struc SMEM -{ - .bk dd ? - .fd dd ? ;+4 - .base dd ? ;+8 - .size dd ? ;+12 - .access dd ? ;+16 - .refcount dd ? ;+20 - .name rb 32 ;+24 - .sizeof: -} - -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 - - .base dd ? ;mapped base - .parent dd ? ;SMEM - .sizeof: -} - -virtual at 0 - SMEM SMEM -end virtual - -virtual at 0 - SMAP SMAP -end virtual - -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: -} - -struc HDLL -{ - .fd dd ? ;next object in list - .bk dd ? ;prev object in list - .pid dd ? ;owner id - - .base dd ? ;mapped base - .size dd ? ;mapped size - .refcount dd ? ;reference counter for this process and this lib - .parent dd ? ;DLLDESCR - .sizeof: -} - -virtual at 0 - DLLDESCR DLLDESCR -end virtual - -virtual at 0 - HDLL HDLL -end virtual - -struc display_t -{ - .x dd ? - .y dd ? - .width dd ? - .height dd ? - .bpp dd ? - .vrefresh dd ? - .pitch dd ? - .lfb dd ? - - .modes dd ? - .ddev dd ? - .connector dd ? - .crtc dd ? - - .cr_list.next dd ? - .cr_list.prev dd ? - - .cursor dd ? - - .init_cursor dd ? - .select_cursor dd ? - .show_cursor dd ? - .move_cursor dd ? - .restore_cursor dd ? - .disable_mouse dd ? -} - -virtual at 0 - display_t display_t -end virtual - -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 - -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 ? -}; - - -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 - -struc COFF_RELOC -{ .VirtualAddress dd ? - .SymIndex dd ? - .Type dw ? -} - -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 - + +EV_INTR equ 1 + +struct THR_DATA + rb (8192-512) +; pl0_stack + fpu_state rb 512 + tls_page rb 4096 + pdbr rb 4096 +ends + +virtual at (OS_BASE-sizeof.THR_DATA) + thr_data THR_DATA +end virtual + +struct SYS_VARS + bpp dd ? + scanline dd ? + vesa_mode dd ? + x_res dd ? + y_res dd ? +ends + +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 + +struct CURSOR APPOBJ + 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 +ends + + +struct EVENT APPOBJ + id dd ? ;event uid + state dd ? ;internal flags + code dd ? + rd 5 +ends + + +struct SMEM + bk dd ? + fd dd ? ;+4 + base dd ? ;+8 + size dd ? ;+12 + access dd ? ;+16 + refcount dd ? ;+20 + name rb 32 ;+24 +ends + +struct SMAP APPOBJ + base dd ? ;mapped base + parent dd ? ;SMEM +ends + +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 + +struct HDLL + fd dd ? ;next object in list + bk dd ? ;prev object in list + pid dd ? ;owner id + + base dd ? ;mapped base + size dd ? ;mapped size + refcount dd ? ;reference counter for this process and this lib + parent dd ? ;DLLDESCR +ends + +struct display_t + x dd ? + y dd ? + width dd ? + height dd ? + bpp dd ? + vrefresh dd ? + pitch dd ? + lfb dd ? + + modes dd ? + ddev dd ? + connector dd ? + crtc dd ? + + cr_list.next dd ? + cr_list.prev dd ? + + cursor dd ? + + init_cursor dd ? + select_cursor dd ? + show_cursor dd ? + move_cursor dd ? + restore_cursor dd ? + disable_mouse dd ? +ends + +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 ? + + cpu_vendor dd ? + dd ? + dd ? + cpu_sign dd ? + cpu_info dd ? + cpu_caps dd ? + dd ? + dd ? +ends + +struct LHEAD + next dd ? ;next object in list + prev dd ? ;prev object in list +ends + +struct MUTEX + lhead LHEAD + count dd ? +ends + +struct MEM_STATE + mutex MUTEX + smallmap dd ? + treemap dd ? + topsize dd ? + top dd ? + smallbins rd 4*32 + treebins rd 32 +ends + +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 + +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 + +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 + +struct COFF_RELOC + VirtualAddress dd ? + SymIndex dd ? + Type dw ? +ends + +struct COFF_SYM + Name rb 8 + Value dd ? + SectionNumber dw ? + Type dw ? + StorageClass db ? + NumAuxSymbols db ? +ends + +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/branches/net/core/dll.inc b/kernel/branches/net/core/dll.inc index bb2ace59e5..c7215f12cb 100644 --- a/kernel/branches/net/core/dll.inc +++ b/kernel/branches/net/core/dll.inc @@ -136,13 +136,13 @@ proc srv_handler stdcall, ioctl:dword jz .err mov edi, [esi+handle] - cmp [edi+SRV.magic], ' SRV' - jne .fail - - cmp [edi+SRV.size], SRV.sizeof - jne .fail - - stdcall [edi+SRV.srv_proc], esi + cmp [edi+SRV.magic], ' SRV' + jne .fail + + cmp [edi+SRV.size], sizeof.SRV + jne .fail + + stdcall [edi+SRV.srv_proc], esi ret .fail: xor eax, eax @@ -168,13 +168,13 @@ srv_handlerEx: jae .fail mov eax, [ecx+handle] - cmp [eax+SRV.magic], ' SRV' - jne .fail - - cmp [eax+SRV.size], SRV.sizeof - jne .fail - - stdcall [eax+SRV.srv_proc], ecx + cmp [eax+SRV.magic], ' SRV' + jne .fail + + cmp [eax+SRV.size], sizeof.SRV + jne .fail + + stdcall [eax+SRV.srv_proc], ecx ret .fail: or eax, -1 @@ -193,13 +193,13 @@ proc get_service stdcall, sz_name:dword test eax, eax jnz @F ret -@@: - mov edx, [srv.fd] -@@: - cmp edx, srv.fd-SRV_FD_OFFSET - je .not_load - - stdcall strncmp, edx, [sz_name], 16 +@@: + mov edx, [srv.fd] +@@: + cmp edx, srv.fd-SRV.fd + je .not_load + + stdcall strncmp, edx, [sz_name], 16 test eax, eax je .ok @@ -223,13 +223,13 @@ proc reg_service stdcall, name:dword, handler:dword cmp [name], eax je .fail - cmp [handler], eax - je .fail - - mov eax, SRV.sizeof - call malloc - test eax, eax - jz .fail + cmp [handler], eax + je .fail + + mov eax, sizeof.SRV + call malloc + test eax, eax + jz .fail push esi push edi @@ -240,15 +240,15 @@ proc reg_service stdcall, name:dword, handler:dword movsd movsd pop edi - pop esi - - mov [eax+SRV.magic], ' SRV' - mov [eax+SRV.size], SRV.sizeof - - mov ebx, srv.fd-SRV_FD_OFFSET - mov edx, [ebx+SRV.fd] - mov [eax+SRV.fd], edx - mov [eax+SRV.bk], ebx + pop esi + + mov [eax+SRV.magic], ' SRV' + mov [eax+SRV.size], sizeof.SRV + + mov ebx, srv.fd-SRV.fd + mov edx, [ebx+SRV.fd] + mov [eax+SRV.fd], edx + mov [eax+SRV.bk], ebx mov [ebx+SRV.fd], eax mov [edx+SRV.bk], eax @@ -511,16 +511,16 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\ retval dd ? endl - mov edi, [symbols] - mov [retval], 1 -.fix: - movzx ebx, [edi+CSYM.SectionNumber] - test ebx, ebx - jnz .internal - mov eax, dword [edi+CSYM.Name] - test eax, eax - jnz @F - + mov edi, [symbols] + mov [retval], 1 +.fix: + movzx ebx, [edi+COFF_SYM.SectionNumber] + test ebx, ebx + jnz .internal + mov eax, dword [edi+COFF_SYM.Name] + test eax, eax + jnz @F + mov edi, [edi+4] add edi, [strings] @@: @@ -539,29 +539,29 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\ mov esi, msg_CR call sys_msg_board_str - mov [retval], 0 -@@: - mov edi, [symbols] - mov [edi+CSYM.Value], eax - jmp .next -.internal: - cmp bx, -1 + mov [retval], 0 +@@: + mov edi, [symbols] + mov [edi+COFF_SYM.Value], eax + jmp .next +.internal: + cmp bx, -1 je .next cmp bx, -2 je .next dec ebx shl ebx, 3 - lea ebx, [ebx+ebx*4] - add ebx, [sec] - - mov eax, [ebx+CFS.VirtualAddress] - add [edi+CSYM.Value], eax -.next: - add edi, CSYM_SIZE - mov [symbols], edi - dec [sym_count] - jnz .fix + lea ebx, [ebx+ebx*4] + add ebx, [sec] + + mov eax, [ebx+COFF_SECTION.VirtualAddress] + add [edi+COFF_SYM.Value], eax +.next: + add edi, sizeof.COFF_SYM + mov [symbols], edi + dec [sym_count] + jnz .fix mov eax, [retval] ret endp @@ -571,53 +571,53 @@ proc fix_coff_relocs stdcall uses ebx esi, coff:dword, sym:dword, \ delta:dword locals n_sec dd ? - endl - - mov eax, [coff] - movzx ebx, [eax+CFH.nSections] - mov [n_sec], ebx - lea esi, [eax+20] -.fix_sec: - mov edi, [esi+CFS.PtrReloc] - add edi, [coff] - - movzx ecx, [esi+CFS.NumReloc] - test ecx, ecx - jz .next -.reloc_loop: - mov ebx, [edi+CRELOC.SymIndex] - add ebx, ebx - lea ebx, [ebx+ebx*8] - add ebx, [sym] - - mov edx, [ebx+CSYM.Value] - - cmp [edi+CRELOC.Type], 6 - je .dir_32 - - cmp [edi+CRELOC.Type], 20 - jne .next_reloc -.rel_32: - mov eax, [edi+CRELOC.VirtualAddress] - add eax, [esi+CFS.VirtualAddress] - sub edx, eax - sub edx, 4 - jmp .fix -.dir_32: - mov eax, [edi+CRELOC.VirtualAddress] - add eax, [esi+CFS.VirtualAddress] -.fix: - add eax, [delta] - add [eax], edx + endl + + mov eax, [coff] + movzx ebx, [eax+COFF_HEADER.nSections] + mov [n_sec], ebx + lea esi, [eax+20] +.fix_sec: + mov edi, [esi+COFF_SECTION.PtrReloc] + add edi, [coff] + + movzx ecx, [esi+COFF_SECTION.NumReloc] + test ecx, ecx + jz .next +.reloc_loop: + mov ebx, [edi+COFF_RELOC.SymIndex] + add ebx, ebx + lea ebx, [ebx+ebx*8] + add ebx, [sym] + + mov edx, [ebx+COFF_SYM.Value] + + cmp [edi+COFF_RELOC.Type], 6 + je .dir_32 + + cmp [edi+COFF_RELOC.Type], 20 + jne .next_reloc +.rel_32: + 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+COFF_RELOC.VirtualAddress] + add eax, [esi+COFF_SECTION.VirtualAddress] +.fix: + add eax, [delta] + add [eax], edx .next_reloc: add edi, 10 - dec ecx - jnz .reloc_loop -.next: - add esi, COFF_SECTION_SIZE - dec [n_sec] - jnz .fix_sec -.exit: + dec ecx + jnz .reloc_loop +.next: + add esi, sizeof.COFF_SECTION + dec [n_sec] + jnz .fix_sec +.exit: ret endp @@ -626,36 +626,36 @@ proc rebase_coff stdcall uses ebx esi, coff:dword, sym:dword, \ delta:dword locals n_sec dd ? - endl - - mov eax, [coff] - movzx ebx, [eax+CFH.nSections] - mov [n_sec], ebx - lea esi, [eax+20] - mov edx, [delta] -.fix_sec: - mov edi, [esi+CFS.PtrReloc] - add edi, [coff] - - movzx ecx, [esi+CFS.NumReloc] - test ecx, ecx - jz .next -.reloc_loop: - cmp [edi+CRELOC.Type], 6 - jne .next_reloc -.dir_32: - mov eax, [edi+CRELOC.VirtualAddress] - add eax, [esi+CFS.VirtualAddress] - add [eax+edx], edx -.next_reloc: - add edi, 10 - dec ecx - jnz .reloc_loop -.next: - add esi, COFF_SECTION_SIZE - dec [n_sec] - jnz .fix_sec -.exit: + endl + + mov eax, [coff] + movzx ebx, [eax+COFF_HEADER.nSections] + mov [n_sec], ebx + lea esi, [eax+20] + mov edx, [delta] +.fix_sec: + mov edi, [esi+COFF_SECTION.PtrReloc] + add edi, [coff] + + movzx ecx, [esi+COFF_SECTION.NumReloc] + test ecx, ecx + jz .next +.reloc_loop: + cmp [edi+COFF_RELOC.Type], 6 + jne .next_reloc +.dir_32: + 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, sizeof.COFF_SECTION + dec [n_sec] + jnz .fix_sec +.exit: ret endp @@ -697,21 +697,21 @@ proc load_driver stdcall, driver_name:dword test eax, eax jz .exit - - mov [coff], eax - - movzx ecx, [eax+CFH.nSections] - xor ebx, ebx - - lea edx, [eax+20] -@@: - add ebx, [edx+CFS.SizeOfRawData] - add ebx, 15 - and ebx, not 15 - add edx, COFF_SECTION_SIZE - dec ecx - jnz @B - mov [img_size], ebx + + mov [coff], eax + + movzx ecx, [eax+COFF_HEADER.nSections] + xor ebx, ebx + + lea edx, [eax+20] +@@: + add ebx, [edx+COFF_SECTION.SizeOfRawData] + add ebx, 15 + and ebx, not 15 + add edx, sizeof.COFF_SECTION + dec ecx + jnz @B + mov [img_size], ebx stdcall kernel_alloc, ebx test eax, eax @@ -725,70 +725,70 @@ proc load_driver stdcall, driver_name:dword and ecx, not 4095 shr ecx, 2 cld - rep stosd - - mov edx, [coff] - movzx ebx, [edx+CFH.nSections] - mov edi, [img_base] - lea eax, [edx+20] -@@: - mov [eax+CFS.VirtualAddress], edi - mov esi, [eax+CFS.PtrRawData] - test esi, esi - jnz .copy - add edi, [eax+CFS.SizeOfRawData] - jmp .next -.copy: - add esi, edx - mov ecx, [eax+CFS.SizeOfRawData] - cld - rep movsb -.next: - add edi, 15 - and edi, not 15 - add eax, COFF_SECTION_SIZE - dec ebx - jnz @B - - mov ebx, [edx+CFH.pSymTable] - add ebx, edx - mov [sym], ebx - mov ecx, [edx+CFH.nSymbols] - add ecx, ecx - lea ecx, [ecx+ecx*8];ecx*=18 = nSymbols*CSYM_SIZE - add ecx, [sym] + rep stosd + + mov edx, [coff] + movzx ebx, [edx+COFF_HEADER.nSections] + mov edi, [img_base] + lea eax, [edx+20] +@@: + mov [eax+COFF_SECTION.VirtualAddress], edi + mov esi, [eax+COFF_SECTION.PtrRawData] + test esi, esi + jnz .copy + add edi, [eax+COFF_SECTION.SizeOfRawData] + jmp .next +.copy: + add esi, edx + mov ecx, [eax+COFF_SECTION.SizeOfRawData] + cld + rep movsb +.next: + add edi, 15 + and edi, not 15 + add eax, sizeof.COFF_SECTION + dec ebx + jnz @B + + mov ebx, [edx+COFF_HEADER.pSymTable] + add ebx, edx + mov [sym], ebx + mov ecx, [edx+COFF_HEADER.nSymbols] + add ecx, ecx + lea ecx, [ecx+ecx*8];ecx*=18 = nSymbols*CSYM_SIZE + add ecx, [sym] mov [strings], ecx lea ebx, [exports] mov dword [ebx], kernel_export - mov dword [ebx+4], 0 - lea eax, [edx+20] - - stdcall fix_coff_symbols, eax, [sym], [edx+CFH.nSymbols], \ - [strings], ebx - test eax, eax - jz .link_fail - - mov ebx, [coff] - stdcall fix_coff_relocs, ebx, [sym], 0 - - stdcall get_coff_sym, [sym], [ebx+CFH.nSymbols], szVersion - test eax, eax - jz .link_fail + mov dword [ebx+4], 0 + lea eax, [edx+20] + + stdcall fix_coff_symbols, eax, [sym], [edx+COFF_HEADER.nSymbols], \ + [strings], ebx + test eax, eax + jz .link_fail + mov ebx, [coff] + stdcall fix_coff_relocs, ebx, [sym], 0 + + stdcall get_coff_sym, [sym], [ebx+COFF_HEADER.nSymbols], szVersion + test eax, eax + jz .link_fail + mov eax, [eax] shr eax, 16 cmp eax, DRV_COMPAT jb .ver_fail cmp eax, DRV_CURRENT - ja .ver_fail - - mov ebx, [coff] - stdcall get_coff_sym, [sym], [ebx+CFH.nSymbols], szSTART - mov [start], eax - - stdcall kernel_free, [coff] + ja .ver_fail + + mov ebx, [coff] + stdcall get_coff_sym, [sym], [ebx+COFF_HEADER.nSymbols], szSTART + mov [start], eax + + stdcall kernel_free, [coff] mov ebx, [start] stdcall ebx, DRV_ENTRY @@ -848,13 +848,13 @@ endp coff_get_align: ; Rules: ; - if alignment is not given, use default = 4K; -; - 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 eax, 1 - shr cl, 4 - dec cl +; - 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+COFF_SECTION.Characteristics+2] + mov eax, 1 + shr cl, 4 + dec cl js .default cmp cl, 12 jbe @f @@ -952,13 +952,13 @@ proc load_library stdcall, file_name:dword ; allocate DLLDESCR struct; size is DLLDESCR.sizeof plus size of DLL name mov esi, edi mov ecx, -1 - xor eax, eax - repnz scasb - not ecx - lea eax, [ecx+DLLDESCR.sizeof] - push ecx - call malloc - pop ecx + xor eax, eax + repnz scasb + not ecx + lea eax, [ecx+sizeof.DLLDESCR] + push ecx + call malloc + pop ecx test eax, eax jz .fail_and_free_coff ; save timestamp @@ -976,23 +976,23 @@ proc load_library stdcall, file_name:dword mov [dll_list.bk], esi mov [esi+DLLDESCR.bk], eax mov [eax+DLLDESCR.fd], esi - -; calculate size of loaded DLL - mov edx, [coff] - movzx ecx, [edx+CFH.nSections] - xor ebx, ebx - - add edx, 20 + +; calculate size of loaded DLL + mov edx, [coff] + movzx ecx, [edx+COFF_HEADER.nSections] + xor ebx, ebx + + add edx, 20 @@: call coff_get_align - add ebx, eax - not eax - and ebx, eax - add ebx, [edx+CFS.SizeOfRawData] - add edx, COFF_SECTION_SIZE - dec ecx - jnz @B -; it must be nonzero and not too big + add ebx, eax + not eax + and ebx, eax + add ebx, [edx+COFF_SECTION.SizeOfRawData] + add edx, sizeof.COFF_SECTION + dec ecx + jnz @B +; it must be nonzero and not too big mov [esi+DLLDESCR.size], ebx test ebx, ebx jz .fail_and_free_dll @@ -1016,108 +1016,108 @@ proc load_library stdcall, file_name:dword mov [esi+DLLDESCR.defaultbase], ecx mov [dll_cur_addr], edx -; copy sections and set correct values for VirtualAddress'es in headers - push esi - mov edx, [coff] - movzx ebx, [edx+CFH.nSections] - mov edi, eax - add edx, 20 - cld +; copy sections and set correct values for VirtualAddress'es in headers + push esi + mov edx, [coff] + movzx ebx, [edx+COFF_HEADER.nSections] + mov edi, eax + add edx, 20 + cld @@: call coff_get_align add ecx, eax add edi, eax - not eax - and ecx, eax - and edi, eax - mov [edx+CFS.VirtualAddress], ecx - add ecx, [edx+CFS.SizeOfRawData] - mov esi, [edx+CFS.PtrRawData] - push ecx - mov ecx, [edx+CFS.SizeOfRawData] - test esi, esi - jnz .copy - xor eax, eax + not eax + and ecx, eax + and edi, eax + mov [edx+COFF_SECTION.VirtualAddress], ecx + add ecx, [edx+COFF_SECTION.SizeOfRawData] + mov esi, [edx+COFF_SECTION.PtrRawData] + push ecx + mov ecx, [edx+COFF_SECTION.SizeOfRawData] + test esi, esi + jnz .copy + xor eax, eax rep stosb jmp .next .copy: add esi, [coff] - rep movsb -.next: - pop ecx - add edx, COFF_SECTION_SIZE - dec ebx - jnz @B - pop esi + rep movsb +.next: + pop ecx + add edx, sizeof.COFF_SECTION + dec ebx + jnz @B + pop esi ; save some additional data from COFF file -; 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 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] - lea ecx, [ecx*5] - lea edi, [edi+ecx*8+20] - add edx, 20 -@@: - movzx eax, [edx+CFS.NumReloc] - lea eax, [eax*5] - lea edi, [edi+eax*2] - add edx, COFF_SECTION_SIZE - 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] - lea ecx, [ecx*5] - lea ecx, [ecx*2+5] - mov [esi+DLLDESCR.coff_hdr], eax +; 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+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+COFF_HEADER.nSections] + lea ecx, [ecx*5] + lea edi, [edi+ecx*8+20] + add edx, 20 +@@: + movzx eax, [edx+COFF_SECTION.NumReloc] + lea eax, [eax*5] + lea edi, [edi+eax*2] + 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+COFF_HEADER.nSections] + lea ecx, [ecx*5] + lea ecx, [ecx*2+5] + mov [esi+DLLDESCR.coff_hdr], eax push esi mov esi, edx mov edi, eax rep movsd - pop esi - mov [esi+DLLDESCR.symbols_ptr], edi - push esi - mov ecx, [edx+CFH.nSymbols] - mov [esi+DLLDESCR.symbols_num], ecx - mov ecx, [esi+DLLDESCR.symbols_lim] - mov esi, ebx + pop esi + mov [esi+DLLDESCR.symbols_ptr], edi + push esi + mov ecx, [edx+COFF_HEADER.nSymbols] + mov [esi+DLLDESCR.symbols_num], ecx + mov ecx, [esi+DLLDESCR.symbols_lim] + mov esi, ebx rep movsb - pop esi - mov ebx, [esi+DLLDESCR.coff_hdr] - push esi - movzx eax, [edx+CFH.nSections] - lea edx, [ebx+20] -@@: - movzx ecx, [edx+CFS.NumReloc] - lea ecx, [ecx*5] - mov esi, [edx+CFS.PtrReloc] - mov [edx+CFS.PtrReloc], edi - sub [edx+CFS.PtrReloc], ebx - add esi, [coff] - shr ecx, 1 - rep movsd - adc ecx, ecx - rep movsw - add edx, COFF_SECTION_SIZE - dec eax - jnz @b - pop esi - -; fixup symbols - mov edx, ebx - mov eax, [ebx+CFH.nSymbols] - add edx, 20 - mov ecx, [esi+DLLDESCR.symbols_num] - lea ecx, [ecx*9] + pop esi + mov ebx, [esi+DLLDESCR.coff_hdr] + push esi + movzx eax, [edx+COFF_HEADER.nSections] + lea edx, [ebx+20] +@@: + movzx ecx, [edx+COFF_SECTION.NumReloc] + lea ecx, [ecx*5] + 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, sizeof.COFF_SECTION + dec eax + jnz @b + pop esi + +; fixup symbols + mov edx, ebx + mov eax, [ebx+COFF_HEADER.nSymbols] + add edx, 20 + mov ecx, [esi+DLLDESCR.symbols_num] + lea ecx, [ecx*9] add ecx, ecx add ecx, [esi+DLLDESCR.symbols_ptr] @@ -1125,17 +1125,17 @@ proc load_library stdcall, file_name:dword ecx, 0 ; test eax, eax ; jnz @F -; -;@@: - - stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+CFH.nSymbols], szEXPORTS - test eax, eax - jnz @F - - stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+CFH.nSymbols], sz_EXPORTS -@@: - mov [esi+DLLDESCR.exports], eax - +; +;@@: + + 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+COFF_HEADER.nSymbols], sz_EXPORTS +@@: + mov [esi+DLLDESCR.exports], eax + ; fix relocs in the hidden copy in kernel memory to default address ; it is first fix; usually this will be enough, but second fix ; can be necessary if real load address will not equal assumption @@ -1157,13 +1157,13 @@ proc load_library stdcall, file_name:dword jnz @f stdcall user_alloc, edi test eax, eax - jz .fail_and_dereference -@@: - mov [img_base], eax - mov eax, HDLL.sizeof - call malloc - test eax, eax - jz .fail_and_free_user + jz .fail_and_dereference +@@: + mov [img_base], eax + mov eax, sizeof.HDLL + call malloc + test eax, eax + jz .fail_and_free_user mov ebx, [CURRENT_TASK] shl ebx, 5 mov edx, [CURRENT_TASK+ebx+TASKDATA.pid] @@ -1366,17 +1366,17 @@ destroy_all_hdlls: align 4 stop_all_services: - push ebp - mov edx, [srv.fd] -.next: - cmp edx, srv.fd-SRV_FD_OFFSET - je .done - cmp [edx+SRV.magic], ' SRV' - jne .next - cmp [edx+SRV.size], SRV.sizeof - jne .next - - mov ebx, [edx+SRV.entry] + push ebp + mov edx, [srv.fd] +.next: + cmp edx, srv.fd-SRV.fd + je .done + cmp [edx+SRV.magic], ' SRV' + jne .next + cmp [edx+SRV.size], sizeof.SRV + jne .next + + mov ebx, [edx+SRV.entry] mov edx, [edx+SRV.fd] test ebx, ebx jz .next diff --git a/kernel/branches/net/core/heap.inc b/kernel/branches/net/core/heap.inc index e96b8224c0..8f97e2a0bb 100644 --- a/kernel/branches/net/core/heap.inc +++ b/kernel/branches/net/core/heap.inc @@ -5,33 +5,27 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$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: -} - -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 -list_fd equ MEM_BLOCK.list.next +$Revision$ + + +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 + + +block_next equ MEM_BLOCK.next_block +block_prev equ MEM_BLOCK.prev_block +list_fd equ MEM_BLOCK.list.next list_bk equ MEM_BLOCK.list.prev block_base equ MEM_BLOCK.base block_size equ MEM_BLOCK.size @@ -143,60 +137,60 @@ proc init_kernel_heap add edi, 0x1000 add edx, 0x1000 dec ecx - 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 - - xor eax, eax - mov [edi+block_next], ebx + jnz .l1 + + mov edi, HEAP_BASE ;descriptors + 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 mov [edi+block_prev], eax - 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_flags], USED_BLOCK - - mov [ecx+block_next], eax + mov [edi+list_fd], eax + mov [edi+list_bk], eax + mov [edi+block_base], HEAP_BASE + mov [edi+block_size], 4096*sizeof.MEM_BLOCK + mov [edi+block_flags], USED_BLOCK + + mov [ecx+block_next], eax mov [ecx+block_prev], ebx mov [edi+list_fd], eax mov [edi+list_bk], eax mov [edi+block_base], eax mov [edi+block_size], eax mov [edi+block_flags], USED_BLOCK - - mov [ebx+block_next], ecx - mov [ebx+block_prev], edi - mov [ebx+block_base], HEAP_BASE+4096*MEM_BLOCK.sizeof - - mov ecx, [pg_data.kernel_pages] - shl ecx, 12 - sub ecx, HEAP_BASE-OS_BASE+4096*MEM_BLOCK.sizeof - mov [heap_size], ecx - mov [heap_free], ecx - mov [ebx+block_size], ecx + + mov [ebx+block_next], ecx + mov [ebx+block_prev], edi + 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*sizeof.MEM_BLOCK + mov [heap_size], ecx + mov [heap_free], ecx + mov [ebx+block_size], ecx mov [ebx+block_flags], FREE_BLOCK mov [mem_block_mask], eax mov [mem_block_mask+4], 0x80000000 mov ecx, mem_block_list+63*8 - list_add ebx, ecx - - mov ecx, 4096-3-1 - mov eax, HEAP_BASE+MEM_BLOCK.sizeof*4 - - mov [next_memblock], HEAP_BASE+MEM_BLOCK.sizeof*3 -@@: - mov [eax-MEM_BLOCK.sizeof], eax - add eax, MEM_BLOCK.sizeof - loop @B - - mov [eax-MEM_BLOCK.sizeof], dword 0 - - mov ecx, heap_mutex - call mutex_init + list_add ebx, ecx + + mov ecx, 4096-3-1 + mov eax, HEAP_BASE+sizeof.MEM_BLOCK*4 + + mov [next_memblock], HEAP_BASE+sizeof.MEM_BLOCK *3 +@@: + mov [eax-sizeof.MEM_BLOCK], eax + add eax, sizeof.MEM_BLOCK + loop @B + + mov [eax-sizeof.MEM_BLOCK], dword 0 + + mov ecx, heap_mutex + call mutex_init mov [heap_blocks], 4094 mov [free_blocks], 4093 ret @@ -1289,13 +1283,13 @@ align 4 jz .fail add ecx, 4095 - and ecx, -4096 - mov [size], ecx - - mov eax, SMEM.sizeof - call malloc - test eax, eax - mov esi, eax + and ecx, -4096 + mov [size], ecx + + mov eax, sizeof.SMEM + call malloc + test eax, eax + mov esi, eax mov edx, E_NOMEM jz .fail @@ -1351,13 +1345,13 @@ align 4 mov edx, E_ACCESS ja .fail - mov ebx, [CURRENT_TASK] - shl ebx, 5 - mov ebx, [CURRENT_TASK+ebx+4] - mov eax, SMAP.sizeof - - call create_kernel_object - test eax, eax + mov ebx, [CURRENT_TASK] + shl ebx, 5 + mov ebx, [CURRENT_TASK+ebx+4] + mov eax, sizeof.SMAP + + call create_kernel_object + test eax, eax mov edi, eax mov edx, E_NOMEM jz .fail diff --git a/kernel/branches/net/core/irq.inc b/kernel/branches/net/core/irq.inc index be6997cf90..86a3edb165 100644 --- a/kernel/branches/net/core/irq.inc +++ b/kernel/branches/net/core/irq.inc @@ -9,15 +9,15 @@ IRQ_RESERVED equ 24 IRQ_POOL_SIZE equ 48 -uglobal - -align 16 -irqh_tab rd LHEAD.sizeof * IRQ_RESERVED / 4 - -irqh_pool rd IRQH.sizeof * IRQ_POOL_SIZE /4 -next_irqh rd 1 - -irq_active_set rd 1 +uglobal + +align 16 +irqh_tab rd sizeof.LHEAD * IRQ_RESERVED / 4 + +irqh_pool rd sizeof.IRQH * IRQ_POOL_SIZE /4 +next_irqh rd 1 + +irq_active_set rd 1 irq_failed rd IRQ_RESERVED endg @@ -31,20 +31,20 @@ init_irqs: mov eax, edi stosd stosd - loop @B - - mov ecx, IRQ_POOL_SIZE-1 - mov eax, irqh_pool+IRQH.sizeof - mov [next_irqh], irqh_pool -@@: - mov [eax-IRQH.sizeof], eax - add eax, IRQH.sizeof - loop @B - - mov [eax-IRQH.sizeof], dword 0 - ret - - + loop @B + + mov ecx, IRQ_POOL_SIZE-1 + mov eax, irqh_pool+sizeof.IRQH + mov [next_irqh], irqh_pool +@@: + mov [eax-sizeof.IRQH], eax + add eax, sizeof.IRQH + loop @B + + mov [eax-sizeof.IRQH], dword 0 + ret + + align 4 proc attach_int_handler stdcall, irq:dword, handler:dword, user_data:dword locals diff --git a/kernel/branches/net/core/taskman.inc b/kernel/branches/net/core/taskman.inc index 86e4734025..7e0d0d7b79 100644 --- a/kernel/branches/net/core/taskman.inc +++ b/kernel/branches/net/core/taskman.inc @@ -7,40 +7,40 @@ $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 -} - -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 -} - - -struc APP_PARAMS -{ .app_cmdline ;0x00 - .app_path ;0x04 - .app_eip ;0x08 - .app_esp ;0x0C - .app_mem ;0x10 -} - -macro _clear_ op -{ mov ecx, op/4 + +GREEDY_KERNEL equ 0 + +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 + +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 + + +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 xor eax, eax cld rep stosd @@ -251,16 +251,16 @@ end if ret endp -align 4 -test_app_header: - virtual at eax - APP_HEADER_00 APP_HEADER_00 - end virtual - virtual at eax - APP_HEADER_01 APP_HEADER_01 - end virtual - - cmp dword [eax], 'MENU' +align 4 +test_app_header: + virtual at eax + APP_HEADER_00 APP_HEADER_00_ + end virtual + virtual at eax + APP_HEADER_01 APP_HEADER_01_ + end virtual + + cmp dword [eax], 'MENU' jne .fail cmp word [eax+4], 'ET' jne .fail diff --git a/kernel/branches/net/core/v86.inc b/kernel/branches/net/core/v86.inc index 7b0f72b35c..b05ce5a9c5 100644 --- a/kernel/branches/net/core/v86.inc +++ b/kernel/branches/net/core/v86.inc @@ -9,36 +9,31 @@ $Revision$ ; Virtual-8086 mode manager ; diamond, 2007, 2008 - -DEBUG_SHOW_IO = 0 - -struc V86_machine -{ -; page directory - .pagedir dd ? -; translation table: V86 address -> flat linear address - .pages dd ? -; mutex to protect all data from writing by multiple threads at one time - .mutex dd ? -; i/o permission map - .iopm dd ? -.size = $ -} -virtual at 0 -V86_machine V86_machine -end virtual - -; Create V86 machine -; in: nothing + +DEBUG_SHOW_IO = 0 + +struct V86_machine +; page directory + pagedir dd ? +; translation table: V86 address -> flat linear address + pages dd ? +; mutex to protect all data from writing by multiple threads at one time + mutex dd ? +; i/o permission map + iopm dd ? +ends + +; Create V86 machine +; in: nothing ; out: eax = handle (pointer to struc V86_machine) ; eax = NULL => failure -; destroys: ebx, ecx, edx (due to malloc) -v86_create: -; allocate V86_machine structure - mov eax, V86_machine.size - call malloc - test eax, eax - jz .fail +; destroys: ebx, ecx, edx (due to malloc) +v86_create: +; allocate V86_machine structure + mov eax, sizeof.V86_machine + call malloc + test eax, eax + jz .fail ; initialize mutex and dword [eax+V86_machine.mutex], 0 ; allocate tables @@ -242,37 +237,32 @@ if ~DEBUG_SHOW_IO mov ecx, 10000h/8/4 rep stosd end if -.ret: - ret - -struc 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 - -; Run V86 machine -; in: ebx -> registers for V86 (two structures: in and out) +.ret: + ret + +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 ? +ends + +; Run V86 machine +; in: ebx -> registers for V86 (two structures: in and out) ; esi = handle ; ecx = expected end address (CS:IP) ; edx = IRQ to hook or -1 if not required @@ -316,16 +306,16 @@ v86_start: ; We do not enable interrupts, because V86 IRQ redirector assumes that ; machine is running ; They will be enabled by IRET. -; sti - - mov eax, esi - sub esp, v86_regs.size - mov esi, ebx - mov edi, esp - mov ecx, v86_regs.size/4 - rep movsd - - cmp edx, -1 +; sti + + mov eax, esi + sub esp, sizeof.v86_regs + mov esi, ebx + mov edi, esp + mov ecx, sizeof.v86_regs/4 + rep movsd + + cmp edx, -1 jz .noirqhook uglobal v86_irqhooks rd IRQ_RESERVED * 2 @@ -369,13 +359,13 @@ v86_exc_c: ; Did we all that we have wanted to do? cmp bl, 1 jne @f - xor eax, eax - mov dr6, eax - @@: - mov eax, [esp+v86_regs.size+10h+18h] - cmp word [esp+v86_regs.eip], ax - jnz @f - shr eax, 16 + xor eax, eax + mov dr6, eax + @@: + mov eax, [esp+sizeof.v86_regs+10h+18h] + cmp word [esp+v86_regs.eip], ax + jnz @f + shr eax, 16 cmp word [esp+v86_regs.cs], ax jz .done @@: @@ -441,13 +431,13 @@ v86_exc_c: shl edx, 4 push eax movzx eax, word [esp+4+v86_regs.esp] - sub eax, 6 - add edx, eax - mov eax, edx - mov esi, [esp+4+v86_regs.size+10h+4] - call v86_get_lin_addr - cmp eax, 0x1000 - jae @f + sub eax, 6 + add edx, eax + mov eax, edx + mov esi, [esp+4+sizeof.v86_regs+10h+4] + call v86_get_lin_addr + cmp eax, 0x1000 + jae @f mov bl, 14 ; #PF exception jmp .nogp @@: @@ -489,13 +479,13 @@ v86_exc_c: @@: movzx edx, word [esp+v86_regs.ss] shl edx, 4 - movzx eax, word [esp+v86_regs.esp] - add edx, eax - mov eax, edx - mov esi, [esp+v86_regs.size+10h+4] - call v86_get_lin_addr - cmp eax, 0x1000 - jae @f + movzx eax, word [esp+v86_regs.esp] + add edx, eax + mov eax, edx + mov esi, [esp+sizeof.v86_regs+10h+4] + call v86_get_lin_addr + cmp eax, 0x1000 + jae @f mov bl, 14 jmp .nogp @@: @@ -525,13 +515,13 @@ v86_exc_c: shl edx, 4 mov eax, [esp+v86_regs.esp] sub eax, 2 - movzx eax, ax - add edx, eax - mov eax, edx - mov esi, [esp+v86_regs.size+10h+4] - call v86_get_lin_addr - cmp eax, 0x1000 - jae @f + movzx eax, ax + add edx, eax + mov eax, edx + mov esi, [esp+sizeof.v86_regs+10h+4] + call v86_get_lin_addr + cmp eax, 0x1000 + jae @f mov bl, 14 ; #PF exception jmp .nogp @@: @@ -557,13 +547,13 @@ v86_exc_c: movzx edx, word [esp+v86_regs.ss] shl edx, 4 movzx eax, word [esp+v86_regs.esp] - sub eax, 4 - add edx, eax - mov eax, edx - mov esi, [esp+v86_regs.size+10h+4] - call v86_get_lin_addr - cmp eax, 0x1000 - jae @f + sub eax, 4 + add edx, eax + mov eax, edx + mov esi, [esp+sizeof.v86_regs+10h+4] + call v86_get_lin_addr + cmp eax, 0x1000 + jae @f mov bl, 14 ; #PF exception jmp .nogp @@: @@ -588,13 +578,13 @@ v86_exc_c: @@: movzx edx, word [esp+v86_regs.ss] shl edx, 4 - movzx eax, word [esp+v86_regs.esp] - add edx, eax - mov eax, edx - mov esi, [esp+v86_regs.size+10h+4] - call v86_get_lin_addr - cmp eax, 0x1000 - jae @f + movzx eax, word [esp+v86_regs.esp] + add edx, eax + mov eax, edx + mov esi, [esp+sizeof.v86_regs+10h+4] + call v86_get_lin_addr + cmp eax, 0x1000 + jae @f mov bl, 14 ; #PF exception jmp .nogp @@: @@ -619,13 +609,13 @@ v86_exc_c: @@: movzx edx, word [esp+v86_regs.ss] shl edx, 4 - movzx eax, word [esp+v86_regs.esp] - add edx, eax - mov eax, edx - mov esi, [esp+v86_regs.size+10h+4] - call v86_get_lin_addr - cmp eax, 0x1000 - jae @f + movzx eax, word [esp+v86_regs.esp] + add edx, eax + mov eax, edx + mov esi, [esp+sizeof.v86_regs+10h+4] + call v86_get_lin_addr + cmp eax, 0x1000 + jae @f mov bl, 14 jmp .nogp @@: @@ -745,13 +735,13 @@ end if call sys_msg_board_str mov ecx, 8 movzx edx, word [esp+32+4] - shl edx, 4 - add edx, [esp+32] -@@: - mov esi, [esp+v86_regs.size+10h+4] - mov eax, edx - call v86_get_lin_addr - cmp eax, 0x1000 + shl edx, 4 + add edx, [esp+32] +@@: + mov esi, [esp+sizeof.v86_regs+10h+4] + mov eax, edx + call v86_get_lin_addr + cmp eax, 0x1000 jb .nopage mov esi, v86_exc_str3-2 call sys_msg_board_str @@ -770,27 +760,27 @@ end if jmp .exit .done: - xor eax, eax - -.exit: - mov [esp+v86_regs.size+10h+1Ch], eax - mov [esp+v86_regs.size+10h+18h], ebx - - mov edx, [esp+v86_regs.size+10h+14h] - cmp edx, -1 - jz @f - dec [v86_irqhooks+edx*8+4] + xor eax, eax + +.exit: + mov [esp+sizeof.v86_regs+10h+1Ch], eax + mov [esp+sizeof.v86_regs+10h+18h], ebx + + mov edx, [esp+sizeof.v86_regs+10h+14h] + cmp edx, -1 + jz @f + dec [v86_irqhooks+edx*8+4] jnz @f and [v86_irqhooks+edx*8], 0 -@@: - - mov esi, esp - mov edi, [esi+v86_regs.size+10h+10h] - add edi, v86_regs.size - mov ecx, v86_regs.size/4 - rep movsd - mov esp, esi - +@@: + + mov esi, esp + mov edi, [esi+sizeof.v86_regs+10h+10h] + add edi, sizeof.v86_regs + mov ecx, sizeof.v86_regs/4 + rep movsd + mov esp, esi + cli mov ecx, [CURRENT_TASK] shl ecx, 8 @@ -871,18 +861,18 @@ v86_irq2: mov ecx, [TASK_COUNT] .scan: cmp [ebx+APPDATA.dir_table], eax - jnz .cont - push ecx - mov ecx, [ebx+APPDATA.saved_esp0] - cmp word [ecx-v86_regs.size+v86_regs.esp], 6 - jb .cont2 - movzx edx, word [ecx-v86_regs.size+v86_regs.ss] - shl edx, 4 - push eax - movzx eax, word [ecx-v86_regs.size+v86_regs.esp] - sub eax, 6 - add edx, eax - mov eax, edx + jnz .cont + push ecx + mov ecx, [ebx+APPDATA.saved_esp0] + cmp word [ecx-sizeof.v86_regs+v86_regs.esp], 6 + jb .cont2 + movzx edx, word [ecx-sizeof.v86_regs+v86_regs.ss] + shl edx, 4 + push eax + movzx eax, word [ecx-sizeof.v86_regs+v86_regs.esp] + sub eax, 6 + add edx, eax + mov eax, edx call v86_get_lin_addr cmp eax, 0x1000 jb .cont3 @@ -902,29 +892,29 @@ v86_irq2: mov ecx, edi call irq_eoi popad - iretd -.found: - mov cr3, eax - sub word [esi-v86_regs.size+v86_regs.esp], 6 - mov ecx, [esi-v86_regs.size+v86_regs.eip] - mov word [edx], cx - mov ecx, [esi-v86_regs.size+v86_regs.cs] - mov word [edx+2], cx - mov ecx, [esi-v86_regs.size+v86_regs.eflags] - mov word [edx+4], cx - lea eax, [edi+8] - cmp al, 10h + iretd +.found: + mov cr3, eax + 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-sizeof.v86_regs+v86_regs.cs] + mov word [edx+2], cx + mov ecx, [esi-sizeof.v86_regs+v86_regs.eflags] + mov word [edx+4], cx + lea eax, [edi+8] + cmp al, 10h jb @f - add al, 60h -@@: - mov cx, [eax*4] - mov word [esi-v86_regs.size+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 - call update_counters - lea edi, [ebx + 0x100000000 - SLOT_BASE] - shr edi, 3 + add al, 60h +@@: + mov cx, [eax*4] + mov word [esi-sizeof.v86_regs+v86_regs.eip], cx + mov cx, [eax*4+2] + 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 add edi, TASK_DATA call find_next_task.found call do_change_task diff --git a/kernel/branches/net/data32.inc b/kernel/branches/net/data32.inc index 04905c5411..c995c04693 100644 --- a/kernel/branches/net/data32.inc +++ b/kernel/branches/net/data32.inc @@ -272,13 +272,13 @@ graph_data_l: dw 0x7ff dw 0x0000 db 0x00 - dw 11010000b *256 +11110010b - db 0x00 -tss0_l: - dw TSS_SIZE-1 - dw tss and 0xFFFF - db (tss shr 16) and 0xFF - db 10001001b + dw 11010000b *256 +11110010b + db 0x00 +tss0_l: + dw sizeof.TSS-1 + dw tss and 0xFFFF + db (tss shr 16) and 0xFF + db 10001001b dw (tss shr 16) and 0xFF00 tls_data_l: diff --git a/kernel/branches/net/gui/button.inc b/kernel/branches/net/gui/button.inc index 243179dc29..b1db263aef 100644 --- a/kernel/branches/net/gui/button.inc +++ b/kernel/branches/net/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/branches/net/gui/event.inc b/kernel/branches/net/gui/event.inc index 664ad82872..ddd75d4cd4 100644 --- a/kernel/branches/net/gui/event.inc +++ b/kernel/branches/net/gui/event.inc @@ -22,24 +22,24 @@ align 4 endg EV_SPACE = 512 FreeEvents = event_start-EVENT.fd ; "виртуальный" event, используются только поля: - ; FreeEvents.fd=event_start и FreeEvents.bk=event_end -align 4 -init_events: ;; used from kernel.asm - stdcall kernel_alloc, EV_SPACE*EVENT.size - or eax, eax - jz .fail - ; eax - current event, ebx - previos event below + ; FreeEvents.fd=event_start и FreeEvents.bk=event_end +align 4 +init_events: ;; used from kernel.asm + stdcall kernel_alloc, EV_SPACE*sizeof.EVENT + or eax, eax + jz .fail + ; eax - current event, ebx - previos event below mov ecx, EV_SPACE ; current - in allocated space mov ebx, FreeEvents ; previos - начало списка push ebx ; оно же и конец потом будет @@: - mov [ebx+EVENT.fd], eax - mov [eax+EVENT.bk], ebx - mov ebx, eax ; previos <- current - add eax, EVENT.size ; new current - loop @b - pop eax ; вот оно концом и стало - mov [ebx+EVENT.fd], eax + mov [ebx+EVENT.fd], eax + mov [eax+EVENT.bk], ebx + mov ebx, eax ; previos <- current + add eax, sizeof.EVENT ; new current + loop @b + pop eax ; вот оно концом и стало + mov [ebx+EVENT.fd], eax mov [eax+EVENT.bk], ebx .fail: ret @@ -97,13 +97,13 @@ set_event: ;; INTERNAL use !!! don't use mov [eax+EVENT.pid], edx inc [event_uid] Mov [eax+EVENT.id],edx,[event_uid] - or esi, esi - jz RemoveEventTo - lea edi, [eax+EVENT.code] - mov ecx, EVENT.codesize/4 - cld - rep movsd - + or esi, esi + jz RemoveEventTo + lea edi, [eax+EVENT.code] + mov ecx, (sizeof.EVENT -EVENT.code)/4 + cld + rep movsd + RemoveEventTo: ;; INTERNAL use !!! don't use for Call ;param: ; eax - указатель на event, КОТОРЫЙ вставляем @@ -152,13 +152,13 @@ raise_event: ;; EXPORT use ; esi - event data (=0 => skip) ;scratched: ebx,ecx,esi,edi call NotDummyTest ; not returned for fail !!! - or esi, esi - jz @f - lea edi, [ebx+EVENT.code] - mov ecx, EVENT.codesize/4 - cld - rep movsd - @@: + or esi, esi + jz @f + lea edi, [ebx+EVENT.code] + mov ecx, (sizeof.EVENT -EVENT.code)/4 + cld + rep movsd + @@: test byte[ebx+EVENT.state+3], EVENT_SIGNALED shr 24 jnz RemoveEventTo.break ; POPF+RET bt edx, 28 ;EVENT_WATCHED @@ -296,16 +296,16 @@ get_event_ex: ;; f68:14 ;retval: ; eax - собственно EVENT (будем называть это его хэндлом) ;scratched: ebx,ecx,edx,esi,edi - mov edx, get_event_queue ; wait_test - call Wait_events ; timeout ignored - lea esi, [eax+EVENT.code] - mov ecx, EVENT.codesize/4 - cld - rep movsd - mov [edi-EVENT.codesize+2], cl;clear priority field -wait_finish: - test byte[eax+EVENT.state+3], MANUAL_RESET shr 24 - jnz get_event_queue.ret ; RET + mov edx, get_event_queue ; wait_test + call Wait_events ; timeout ignored + lea esi, [eax+EVENT.code] + mov ecx, (sizeof.EVENT-EVENT.code)/4 + cld + rep movsd + 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 and byte[eax+EVENT.state+3], not((EVENT_SIGNALED+EVENT_WATCHED)shr 24) test byte[eax+EVENT.state+3], MANUAL_DESTROY shr 24 jz destroy_event.internal diff --git a/kernel/branches/net/gui/mouse.inc b/kernel/branches/net/gui/mouse.inc index 97aa60ecc0..009c40d102 100644 --- a/kernel/branches/net/gui/mouse.inc +++ b/kernel/branches/net/gui/mouse.inc @@ -565,22 +565,22 @@ mouse._.find_sys_button_under_cursor: ;//////////////////////////////////////// call mouse._.find_sys_window_under_cursor mov edx, esi - ; check if any process button contains cursor - mov eax, [BTN_ADDR] - mov ecx, [eax] - imul esi, ecx, SYS_BUTTON.sizeof - add esi, eax - inc ecx - add esi, SYS_BUTTON.sizeof - - .next_button: - dec ecx - jz .not_found - - add esi, -SYS_BUTTON.sizeof - - ; does it belong to our process? - cmp dx, [esi + SYS_BUTTON.pslot] + ; check if any process button contains cursor + mov eax, [BTN_ADDR] + mov ecx, [eax] + imul esi, ecx, sizeof.SYS_BUTTON + add esi, eax + inc ecx + add esi, sizeof.SYS_BUTTON + + .next_button: + dec ecx + jz .not_found + + add esi, -sizeof.SYS_BUTTON + + ; does it belong to our process? + cmp dx, [esi + SYS_BUTTON.pslot] jne .next_button ; does it contain cursor coordinates? diff --git a/kernel/branches/net/kernel.asm b/kernel/branches/net/kernel.asm index 9b918e2225..7eaa2b4bb9 100644 --- a/kernel/branches/net/kernel.asm +++ b/kernel/branches/net/kernel.asm @@ -563,13 +563,13 @@ high_code: stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \ (unpack.lc+unpack.lp)))*4 - mov [unpack.p], eax - - call init_events - mov eax, srv.fd-SRV_FD_OFFSET - mov [srv.fd], eax - mov [srv.bk], eax - + mov [unpack.p], eax + + call init_events + mov eax, srv.fd-SRV.fd + mov [srv.fd], eax + mov [srv.bk], eax + ;Set base of graphic segment to linear address of LFB mov eax, [LFBAddress] ; set for gs mov [graph_data_l+2], ax diff --git a/kernel/branches/net/kernel32.inc b/kernel/branches/net/kernel32.inc index 1e3d23b085..185b078eef 100644 --- a/kernel/branches/net/kernel32.inc +++ b/kernel/branches/net/kernel32.inc @@ -145,22 +145,12 @@ struct APPDATA wnd_caption dd ? wnd_clientbox BOX -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 +ends + + +; Core functions +include "core/sync.inc" ; macros for synhronization objects +include "core/sys32.inc" ; process management include "core/sched.inc" ; process scheduling include "core/syscall.inc" ; system call include "core/fpu.inc" ; all fpu/sse support diff --git a/kernel/branches/net/network/udp.inc b/kernel/branches/net/network/udp.inc index 9f79f6a96c..726ede8415 100644 --- a/kernel/branches/net/network/udp.inc +++ b/kernel/branches/net/network/udp.inc @@ -124,10 +124,8 @@ UDP_input: jz .no_checksum ; if checksum is zero, it is considered valid and we continue processing ; otherwise, we will re-calculate the checksum and add it to this value, thus creating 0 when it is correct - push esi UDP_checksum (edi), (edi+4) - pop esi - jnz .checksum_mismatch + ;;; jnz .checksum_mismatch .no_checksum: DEBUGF 1,"UDP Checksum is correct\n" diff --git a/kernel/branches/net/video/blitter.inc b/kernel/branches/net/video/blitter.inc index 36d743f151..7dd7303ad4 100644 --- a/kernel/branches/net/video/blitter.inc +++ b/kernel/branches/net/video/blitter.inc @@ -1,39 +1,30 @@ - - - -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 - - -align 4 - -__L1OutCode: + +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 + + bitmap dd ? ; 56 + stride dd ? ; 60 +ends + + +align 4 + +__L1OutCode: push ebx mov ebx, 8 cmp edx, [eax] diff --git a/kernel/branches/net/video/cursors.inc b/kernel/branches/net/video/cursors.inc index a91c174b4a..7581ab4102 100644 --- a/kernel/branches/net/video/cursors.inc +++ b/kernel/branches/net/video/cursors.inc @@ -10,30 +10,26 @@ $Revision$ LOAD_FROM_FILE equ 0 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 - -align 4 -proc init_cursor stdcall, dst:dword, src:dword - locals +LOAD_INDIRECT equ 2 +LOAD_SYSTEM equ 3 + +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 + locals rBase dd ? pQuad dd ? pBits dd ? @@ -44,17 +40,17 @@ proc init_cursor stdcall, dst:dword, src:dword endl mov esi, [src] - add esi, [esi+18] - mov eax, esi - - cmp [esi+BI.biBitCount], 24 - je .img_24 - cmp [esi+BI.biBitCount], 8 - je .img_8 - cmp [esi+BI.biBitCount], 4 - je .img_4 - -.img_2: + add esi, [esi+18] + mov eax, esi + + cmp [esi+BITMAPINFOHEADER.BitCount], 24 + je .img_24 + cmp [esi+BITMAPINFOHEADER.BitCount], 8 + je .img_8 + cmp [esi+BITMAPINFOHEADER.BitCount], 4 + je .img_4 + +.img_2: add eax, [esi] mov [pQuad], eax add eax, 8 @@ -223,15 +219,15 @@ proc init_cursor stdcall, dst:dword, src:dword ret .img_24: add eax, [esi] - mov [pQuad], eax - add eax, 0xC00 - mov [pAnd], eax - mov eax, [esi+BI.biWidth] - mov [width], eax - mov ebx, [esi+BI.biHeight] - shr ebx, 1 - mov [height], ebx - + mov [pQuad], eax + add eax, 0xC00 + mov [pAnd], eax + mov eax, [esi+BITMAPINFOHEADER.Width] + mov [width], eax + mov ebx, [esi+BITMAPINFOHEADER.Height] + shr ebx, 1 + mov [height], ebx + mov edi, [dst] add edi, 32*31*4 mov [rBase], edi @@ -297,13 +293,13 @@ create_cursor: sub esp, 4 ;space for .hcursor push ecx - push ebx - - mov ebx, eax - mov eax, CURSOR.sizeof - call create_kernel_object - test eax, eax - jz .fail + push ebx + + mov ebx, eax + mov eax, sizeof.CURSOR + call create_kernel_object + test eax, eax + jz .fail mov [.hcursor], eax