diff --git a/kernel/branches/net/applications/macros.inc b/kernel/branches/net/applications/macros.inc index 435f2ddfb2..9165974ad2 100644 --- a/kernel/branches/net/applications/macros.inc +++ b/kernel/branches/net/applications/macros.inc @@ -57,7 +57,7 @@ macro uglobal { UGlobals equ UGlobals, macro __UGlobalBlock { } -endg fix } ; Use endg for ending iglobal and uglobal blocks. +endg fix } ; Use endg for ending iglobal and uglobal blocks. macro IncludeIGlobals{ @@ -176,13 +176,13 @@ struc mls [sstring] db ssize db sstring common - db -1 ; mod + db -1 ; mod } ; strings -macro sz name,[data] { ; from MFAR [mike.dld] +macro sz name,[data] { ; from MFAR [mike.dld] common if used name name db data @@ -203,7 +203,7 @@ macro lsz name,[lng,data] { ; from MFAR [mike.dld] end if } -macro szc name,elsz,[data] { ; from MFAR [mike.dld] +macro szc name,elsz,[data] { ; from MFAR [mike.dld] common local s,m m = 0 @@ -270,7 +270,7 @@ macro mpack dest, hsrc, lsrc end if } -macro __mov reg,a,b { ; mike.dld +macro __mov reg,a,b { ; mike.dld if (~a eq)&(~b eq) mpack reg,a,b else if (~a eq)&(b eq) @@ -281,10 +281,10 @@ macro __mov reg,a,b { ; mike.dld include 'config.inc' ;__CPU_type equ p5 -SYSENTER_VAR equ 0 +SYSENTER_VAR equ 0 macro mcall a,b,c,d,e,f { ; mike.dld, updated by Ghost for Fast System Calls - local ..ret_point + local ..ret_point __mov eax,a __mov ebx,b __mov ecx,c @@ -293,26 +293,26 @@ macro mcall a,b,c,d,e,f { ; mike.dld, updated by Ghost for Fast System Calls __mov edi,f if __CPU_type eq p5 - int 0x40 + int 0x40 else if __CPU_type eq p6 - push ebp - mov ebp, esp - push ..ret_point ; it may be 2 or 5 byte - sysenter + push ebp + mov ebp, esp + push ..ret_point ; it may be 2 or 5 byte + sysenter ..ret_point: - pop edx - pop ecx + pop edx + pop ecx else if __CPU_type eq k6 - push ecx - syscall - pop ecx + push ecx + syscall + pop ecx else - display 'ERROR : unknown CPU type (set to p5)', 10, 13 - __CPU_type equ p5 - int 0x40 + display 'ERROR : unknown CPU type (set to p5)', 10, 13 + __CPU_type equ p5 + int 0x40 end if end if end if @@ -393,9 +393,9 @@ macro add arg1,arg2 { if (arg2 eqtype 0) if (arg2) = 1 - inc arg1 + inc arg1 else - add arg1,arg2 + add arg1,arg2 end if else add arg1,arg2 @@ -406,9 +406,9 @@ macro sub arg1,arg2 { if (arg2 eqtype 0) if (arg2) = 1 - dec arg1 + dec arg1 else - sub arg1,arg2 + sub arg1,arg2 end if else sub arg1,arg2 @@ -419,17 +419,17 @@ macro mov arg1,arg2 { if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) if (arg2) = 0 - xor arg1,arg1 + xor arg1,arg1 else if (arg2) = 1 - xor arg1,arg1 - inc arg1 + xor arg1,arg1 + inc arg1 else if (arg2) = -1 - or arg1,-1 + or arg1,-1 else if (arg2) > -128 & (arg2) < 128 - push arg2 - pop arg1 + push arg2 + pop arg1 else - mov arg1,arg2 + mov arg1,arg2 end if else mov arg1,arg2 @@ -454,108 +454,108 @@ struc POINT _t,_dx,_dy { include 'struct.inc' struct RECT - left dd ? - top dd ? + left dd ? + top dd ? right dd ? bottom dd ? ends struct BOX - left dd ? - top dd ? + left dd ? + top dd ? width dd ? height dd ? ends ; structures used in MeOS struct process_information - cpu_usage dd ? ; +0 - window_stack_position dw ? ; +4 - window_stack_value dw ? ; +6 - dw ? ; +8 - process_name rb 12 ; +10 - memory_start dd ? ; +22 - used_memory dd ? ; +26 - PID dd ? ; +30 - box BOX ; +34 - slot_state dw ? ; +50 - dw ? ; +52 - client_box BOX ; +54 - wnd_state db ? ; +70 + cpu_usage dd ? ; +0 + window_stack_position dw ? ; +4 + window_stack_value dw ? ; +6 + dw ? ; +8 + process_name rb 12 ; +10 + memory_start dd ? ; +22 + used_memory dd ? ; +26 + PID dd ? ; +30 + box BOX ; +34 + slot_state dw ? ; +50 + dw ? ; +52 + client_box BOX ; +54 + wnd_state db ? ; +70 rb (1024-71) ends struct system_colors - frame dd ? - grab dd ? - grab_button dd ? + frame dd ? + grab dd ? + grab_button dd ? grab_button_text dd ? - grab_text dd ? - work dd ? - work_button dd ? + grab_text dd ? + work dd ? + work_button dd ? work_button_text dd ? - work_text dd ? - work_graph dd ? + work_text dd ? + work_graph dd ? ends struct FILEDATE Second db ? Minute db ? - Hour db ? - db ? - Day db ? + Hour db ? + db ? + Day db ? Month db ? - Year dw ? + Year dw ? ends struct FILEINFO Attributes dd ? IsUnicode db ? - db 3 dup(?) + db 3 dup(?) DateCreate FILEDATE DateAccess FILEDATE DateModify FILEDATE - Size dq ? + Size dq ? ends -if __CPU_type eq p5 ; CMOVcc isnt supported on the P5 +if __CPU_type eq p5 ; CMOVcc isnt supported on the P5 -cmove fix cmovz +cmove fix cmovz macro cmovz reg1, reg2 { -local .jumpaddr +local .jumpaddr - jnz .jumpaddr - mov reg1, reg2 + jnz .jumpaddr + mov reg1, reg2 .jumpaddr: } -cmovne fix cmovnz +cmovne fix cmovnz macro cmovnz reg1, reg2 { -local .jumpaddr +local .jumpaddr - jz .jumpaddr - mov reg1, reg2 + jz .jumpaddr + mov reg1, reg2 .jumpaddr: } macro cmovg reg1, reg2 { -local .jumpaddr +local .jumpaddr - jle .jumpaddr - mov reg1, reg2 + jle .jumpaddr + mov reg1, reg2 .jumpaddr: } macro cmovl reg1, reg2 { -local .jumpaddr +local .jumpaddr - jge .jumpaddr - mov reg1, reg2 + jge .jumpaddr + mov reg1, reg2 .jumpaddr: } @@ -567,16 +567,16 @@ end if EV_IDLE = 0 EV_TIMER = 0 EV_REDRAW = 1 -EV_KEY = 2 +EV_KEY = 2 EV_BUTTON = 3 EV_EXIT = 4 EV_BACKGROUND = 5 EV_MOUSE = 6 -EV_IPC = 7 +EV_IPC = 7 EV_STACK = 8 ; event mask bits for function 40 -EVM_REDRAW = 1b +EVM_REDRAW = 1b EVM_KEY = 10b EVM_BUTTON = 100b EVM_EXIT = 1000b @@ -584,3 +584,4 @@ EVM_BACKGROUND = 10000b EVM_MOUSE = 100000b EVM_IPC = 1000000b EVM_STACK = 10000000b +EVM_STACK2 = 0x400 diff --git a/kernel/branches/net/applications/zeroconf/zeroconf.asm b/kernel/branches/net/applications/zeroconf/zeroconf.asm index 5a6ee9329e..24cd04238f 100644 --- a/kernel/branches/net/applications/zeroconf/zeroconf.asm +++ b/kernel/branches/net/applications/zeroconf/zeroconf.asm @@ -136,15 +136,20 @@ no_IP: START: - - mcall 40, EVM_STACK ; network event + mcall 40, EVM_STACK2 DEBUGF 1,">Zero-config service loaded\n" + .wait: mcall 76, API_ETH + 4 ; get MAC of ethernet interface 0 cmp eax, -1 - je exit + jne .start + mcall 10 + jmp .wait + + .start: + mcall 40, EVM_STACK mov word[MAC], bx mov dword[MAC+2], eax diff --git a/kernel/branches/net/const.inc b/kernel/branches/net/const.inc index a93a9911db..8a2a886ed3 100644 --- a/kernel/branches/net/const.inc +++ b/kernel/branches/net/const.inc @@ -260,12 +260,12 @@ BANK_RW equ (OS_BASE+0x000FFF2) MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4) DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5) DONT_SWITCH equ (OS_BASE+0x000FFFF) - -TMP_STACK_TOP equ 0x006CC00 - -sys_pgdir equ (OS_BASE+0x006F000) - -DRIVE_DATA equ (OS_BASE+0x0070000) + +TMP_STACK_TOP equ 0x006CC00 + +sys_pgdir equ (OS_BASE+0x006F000) + +DRIVE_DATA equ (OS_BASE+0x0070000) SLOT_BASE equ (OS_BASE+0x0080000) @@ -401,6 +401,7 @@ EVENT_IPC equ 0x00000040 EVENT_NETWORK equ 0x00000080 EVENT_DEBUG equ 0x00000100 EVENT_EXTENDED equ 0x00000200 +EVENT_NETWORK2 equ 0x00000400 EV_INTR equ 1 diff --git a/kernel/branches/net/core/exports.inc b/kernel/branches/net/core/exports.inc index 07400ebe99..09772ee47d 100644 --- a/kernel/branches/net/core/exports.inc +++ b/kernel/branches/net/core/exports.inc @@ -98,7 +98,7 @@ iglobal szNetRegDev db 'NetRegDev',0 szNetUnRegDev db 'NetUnRegDev',0 szNetPtrToNum db 'NetPtrToNum',0 - szEthReceiver db 'EthReceiver',0 ; To be removed ! + szNetLinkChanged db 'NetLinkChanged',0 szEth_input db 'Eth_input',0 szIPv4_input db 'IPv4_input',0 @@ -190,6 +190,7 @@ kernel_export: dd szNetRegDev , NET_add_device dd szNetUnRegDev , NET_remove_device dd szNetPtrToNum , NET_ptr_to_num + dd szNetLinkChanged , NET_link_changed dd szEth_input , ETH_input dd szIPv4_input , IPv4_input diff --git a/kernel/branches/net/network/stack.inc b/kernel/branches/net/network/stack.inc index 75f277066f..9fd3354df4 100644 --- a/kernel/branches/net/network/stack.inc +++ b/kernel/branches/net/network/stack.inc @@ -287,6 +287,28 @@ stack_handler: +align 4 +NET_link_changed: + +align 4 +NET_send_event: + +; Send event to all applications + push edi ecx + mov edi, SLOT_BASE + mov ecx, [TASK_COUNT] + .loop: + add edi, 256 + or [edi + APPDATA.event_mask], EVENT_NETWORK2 + loop .loop + pop ecx edi + +; call change_task + + ret + + + ;----------------------------------------------------------------- ; ; NET_add_device: @@ -344,6 +366,8 @@ NET_add_device: pop eax @@: + call NET_send_event + DEBUGF 1,"Device number: %u\n", eax ret @@ -435,6 +459,8 @@ NET_remove_device: xor eax, eax mov dword [edi-4], eax + call NET_send_event + dec [NET_RUNNING] ret