Now Zeroconfig waits for driver to be initialised.

git-svn-id: svn://kolibrios.org@3340 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-03-06 11:15:28 +00:00
parent 2a78c97192
commit 8f48436569
5 changed files with 124 additions and 90 deletions

View File

@ -57,7 +57,7 @@ macro uglobal {
UGlobals equ UGlobals, UGlobals equ UGlobals,
macro __UGlobalBlock { } macro __UGlobalBlock { }
endg fix } ; Use endg for ending iglobal and uglobal blocks. endg fix } ; Use endg for ending iglobal and uglobal blocks.
macro IncludeIGlobals{ macro IncludeIGlobals{
@ -176,13 +176,13 @@ struc mls [sstring]
db ssize db ssize
db sstring db sstring
common common
db -1 ; mod db -1 ; mod
} }
; strings ; strings
macro sz name,[data] { ; from MFAR [mike.dld] macro sz name,[data] { ; from MFAR [mike.dld]
common common
if used name if used name
name db data name db data
@ -203,7 +203,7 @@ macro lsz name,[lng,data] { ; from MFAR [mike.dld]
end if end if
} }
macro szc name,elsz,[data] { ; from MFAR [mike.dld] macro szc name,elsz,[data] { ; from MFAR [mike.dld]
common common
local s,m local s,m
m = 0 m = 0
@ -270,7 +270,7 @@ macro mpack dest, hsrc, lsrc
end if end if
} }
macro __mov reg,a,b { ; mike.dld macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq) if (~a eq)&(~b eq)
mpack reg,a,b mpack reg,a,b
else if (~a eq)&(b eq) else if (~a eq)&(b eq)
@ -281,10 +281,10 @@ macro __mov reg,a,b { ; mike.dld
include 'config.inc' include 'config.inc'
;__CPU_type equ p5 ;__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 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 eax,a
__mov ebx,b __mov ebx,b
__mov ecx,c __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 __mov edi,f
if __CPU_type eq p5 if __CPU_type eq p5
int 0x40 int 0x40
else else
if __CPU_type eq p6 if __CPU_type eq p6
push ebp push ebp
mov ebp, esp mov ebp, esp
push ..ret_point ; it may be 2 or 5 byte push ..ret_point ; it may be 2 or 5 byte
sysenter sysenter
..ret_point: ..ret_point:
pop edx pop edx
pop ecx pop ecx
else else
if __CPU_type eq k6 if __CPU_type eq k6
push ecx push ecx
syscall syscall
pop ecx pop ecx
else else
display 'ERROR : unknown CPU type (set to p5)', 10, 13 display 'ERROR : unknown CPU type (set to p5)', 10, 13
__CPU_type equ p5 __CPU_type equ p5
int 0x40 int 0x40
end if end if
end if end if
end if end if
@ -393,9 +393,9 @@ macro add arg1,arg2
{ {
if (arg2 eqtype 0) if (arg2 eqtype 0)
if (arg2) = 1 if (arg2) = 1
inc arg1 inc arg1
else else
add arg1,arg2 add arg1,arg2
end if end if
else else
add arg1,arg2 add arg1,arg2
@ -406,9 +406,9 @@ macro sub arg1,arg2
{ {
if (arg2 eqtype 0) if (arg2 eqtype 0)
if (arg2) = 1 if (arg2) = 1
dec arg1 dec arg1
else else
sub arg1,arg2 sub arg1,arg2
end if end if
else else
sub arg1,arg2 sub arg1,arg2
@ -419,17 +419,17 @@ macro mov arg1,arg2
{ {
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0 if (arg2) = 0
xor arg1,arg1 xor arg1,arg1
else if (arg2) = 1 else if (arg2) = 1
xor arg1,arg1 xor arg1,arg1
inc arg1 inc arg1
else if (arg2) = -1 else if (arg2) = -1
or arg1,-1 or arg1,-1
else if (arg2) > -128 & (arg2) < 128 else if (arg2) > -128 & (arg2) < 128
push arg2 push arg2
pop arg1 pop arg1
else else
mov arg1,arg2 mov arg1,arg2
end if end if
else else
mov arg1,arg2 mov arg1,arg2
@ -454,108 +454,108 @@ struc POINT _t,_dx,_dy {
include 'struct.inc' include 'struct.inc'
struct RECT struct RECT
left dd ? left dd ?
top dd ? top dd ?
right dd ? right dd ?
bottom dd ? bottom dd ?
ends ends
struct BOX struct BOX
left dd ? left dd ?
top dd ? top dd ?
width dd ? width dd ?
height dd ? height dd ?
ends ends
; structures used in MeOS ; structures used in MeOS
struct process_information struct process_information
cpu_usage dd ? ; +0 cpu_usage dd ? ; +0
window_stack_position dw ? ; +4 window_stack_position dw ? ; +4
window_stack_value dw ? ; +6 window_stack_value dw ? ; +6
dw ? ; +8 dw ? ; +8
process_name rb 12 ; +10 process_name rb 12 ; +10
memory_start dd ? ; +22 memory_start dd ? ; +22
used_memory dd ? ; +26 used_memory dd ? ; +26
PID dd ? ; +30 PID dd ? ; +30
box BOX ; +34 box BOX ; +34
slot_state dw ? ; +50 slot_state dw ? ; +50
dw ? ; +52 dw ? ; +52
client_box BOX ; +54 client_box BOX ; +54
wnd_state db ? ; +70 wnd_state db ? ; +70
rb (1024-71) rb (1024-71)
ends ends
struct system_colors struct system_colors
frame dd ? frame dd ?
grab dd ? grab dd ?
grab_button dd ? grab_button dd ?
grab_button_text dd ? grab_button_text dd ?
grab_text dd ? grab_text dd ?
work dd ? work dd ?
work_button dd ? work_button dd ?
work_button_text dd ? work_button_text dd ?
work_text dd ? work_text dd ?
work_graph dd ? work_graph dd ?
ends ends
struct FILEDATE struct FILEDATE
Second db ? Second db ?
Minute db ? Minute db ?
Hour db ? Hour db ?
db ? db ?
Day db ? Day db ?
Month db ? Month db ?
Year dw ? Year dw ?
ends ends
struct FILEINFO struct FILEINFO
Attributes dd ? Attributes dd ?
IsUnicode db ? IsUnicode db ?
db 3 dup(?) db 3 dup(?)
DateCreate FILEDATE DateCreate FILEDATE
DateAccess FILEDATE DateAccess FILEDATE
DateModify FILEDATE DateModify FILEDATE
Size dq ? Size dq ?
ends 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 { macro cmovz reg1, reg2 {
local .jumpaddr local .jumpaddr
jnz .jumpaddr jnz .jumpaddr
mov reg1, reg2 mov reg1, reg2
.jumpaddr: .jumpaddr:
} }
cmovne fix cmovnz cmovne fix cmovnz
macro cmovnz reg1, reg2 { macro cmovnz reg1, reg2 {
local .jumpaddr local .jumpaddr
jz .jumpaddr jz .jumpaddr
mov reg1, reg2 mov reg1, reg2
.jumpaddr: .jumpaddr:
} }
macro cmovg reg1, reg2 { macro cmovg reg1, reg2 {
local .jumpaddr local .jumpaddr
jle .jumpaddr jle .jumpaddr
mov reg1, reg2 mov reg1, reg2
.jumpaddr: .jumpaddr:
} }
macro cmovl reg1, reg2 { macro cmovl reg1, reg2 {
local .jumpaddr local .jumpaddr
jge .jumpaddr jge .jumpaddr
mov reg1, reg2 mov reg1, reg2
.jumpaddr: .jumpaddr:
} }
@ -567,16 +567,16 @@ end if
EV_IDLE = 0 EV_IDLE = 0
EV_TIMER = 0 EV_TIMER = 0
EV_REDRAW = 1 EV_REDRAW = 1
EV_KEY = 2 EV_KEY = 2
EV_BUTTON = 3 EV_BUTTON = 3
EV_EXIT = 4 EV_EXIT = 4
EV_BACKGROUND = 5 EV_BACKGROUND = 5
EV_MOUSE = 6 EV_MOUSE = 6
EV_IPC = 7 EV_IPC = 7
EV_STACK = 8 EV_STACK = 8
; event mask bits for function 40 ; event mask bits for function 40
EVM_REDRAW = 1b EVM_REDRAW = 1b
EVM_KEY = 10b EVM_KEY = 10b
EVM_BUTTON = 100b EVM_BUTTON = 100b
EVM_EXIT = 1000b EVM_EXIT = 1000b
@ -584,3 +584,4 @@ EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b EVM_MOUSE = 100000b
EVM_IPC = 1000000b EVM_IPC = 1000000b
EVM_STACK = 10000000b EVM_STACK = 10000000b
EVM_STACK2 = 0x400

View File

@ -136,15 +136,20 @@ no_IP:
START: START:
mcall 40, EVM_STACK2
mcall 40, EVM_STACK ; network event
DEBUGF 1,">Zero-config service loaded\n" DEBUGF 1,">Zero-config service loaded\n"
.wait:
mcall 76, API_ETH + 4 ; get MAC of ethernet interface 0 mcall 76, API_ETH + 4 ; get MAC of ethernet interface 0
cmp eax, -1 cmp eax, -1
je exit jne .start
mcall 10
jmp .wait
.start:
mcall 40, EVM_STACK
mov word[MAC], bx mov word[MAC], bx
mov dword[MAC+2], eax mov dword[MAC+2], eax

View File

@ -260,12 +260,12 @@ BANK_RW equ (OS_BASE+0x000FFF2)
MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4) MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4)
DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5) DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5)
DONT_SWITCH equ (OS_BASE+0x000FFFF) DONT_SWITCH equ (OS_BASE+0x000FFFF)
TMP_STACK_TOP equ 0x006CC00 TMP_STACK_TOP equ 0x006CC00
sys_pgdir equ (OS_BASE+0x006F000) sys_pgdir equ (OS_BASE+0x006F000)
DRIVE_DATA equ (OS_BASE+0x0070000) DRIVE_DATA equ (OS_BASE+0x0070000)
SLOT_BASE equ (OS_BASE+0x0080000) SLOT_BASE equ (OS_BASE+0x0080000)
@ -401,6 +401,7 @@ EVENT_IPC equ 0x00000040
EVENT_NETWORK equ 0x00000080 EVENT_NETWORK equ 0x00000080
EVENT_DEBUG equ 0x00000100 EVENT_DEBUG equ 0x00000100
EVENT_EXTENDED equ 0x00000200 EVENT_EXTENDED equ 0x00000200
EVENT_NETWORK2 equ 0x00000400
EV_INTR equ 1 EV_INTR equ 1

View File

@ -98,7 +98,7 @@ iglobal
szNetRegDev db 'NetRegDev',0 szNetRegDev db 'NetRegDev',0
szNetUnRegDev db 'NetUnRegDev',0 szNetUnRegDev db 'NetUnRegDev',0
szNetPtrToNum db 'NetPtrToNum',0 szNetPtrToNum db 'NetPtrToNum',0
szEthReceiver db 'EthReceiver',0 ; To be removed ! szNetLinkChanged db 'NetLinkChanged',0
szEth_input db 'Eth_input',0 szEth_input db 'Eth_input',0
szIPv4_input db 'IPv4_input',0 szIPv4_input db 'IPv4_input',0
@ -190,6 +190,7 @@ kernel_export:
dd szNetRegDev , NET_add_device dd szNetRegDev , NET_add_device
dd szNetUnRegDev , NET_remove_device dd szNetUnRegDev , NET_remove_device
dd szNetPtrToNum , NET_ptr_to_num dd szNetPtrToNum , NET_ptr_to_num
dd szNetLinkChanged , NET_link_changed
dd szEth_input , ETH_input dd szEth_input , ETH_input
dd szIPv4_input , IPv4_input dd szIPv4_input , IPv4_input

View File

@ -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: ; NET_add_device:
@ -344,6 +366,8 @@ NET_add_device:
pop eax pop eax
@@: @@:
call NET_send_event
DEBUGF 1,"Device number: %u\n", eax DEBUGF 1,"Device number: %u\n", eax
ret ret
@ -435,6 +459,8 @@ NET_remove_device:
xor eax, eax xor eax, eax
mov dword [edi-4], eax mov dword [edi-4], eax
call NET_send_event
dec [NET_RUNNING] dec [NET_RUNNING]
ret ret