mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-17 04:12:34 +03:00
602924a5b5
fixed bug in netcfg created in last revision netcfg gives error msg when driver is not loaded zeroconfig now works with latest version of libini also fixed use of static and link-local ip in zeroconfig initial IPv4 variables are now 0.0.0.0 instead of 255.255.255.255 created kernel function that shows number of active network devices fixed the use of temp mac variable in IPV4.inc (variable is now in stack) rewrite of ARP code, needs full testing/debugging (new application needed: ARP manager) port numbers are now in INET byte order, as is in posix standards git-svn-id: svn://kolibrios.org@1196 a494cfbc-eb01-0410-851d-a64ba20cac60
103 lines
2.2 KiB
PHP
103 lines
2.2 KiB
PHP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; ;;
|
|
;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
;; ;;
|
|
;; queue.inc ;;
|
|
;; ;;
|
|
;; Written by hidnplayr@kolibrios.org ;;
|
|
;; ;;
|
|
;; GNU GENERAL PUBLIC LICENSE ;;
|
|
;; Version 2, June 1991 ;;
|
|
;; ;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
$Revision: 983 $
|
|
|
|
struct queue
|
|
.size dd ?
|
|
.w_ptr dd ?
|
|
.r_ptr dd ?
|
|
.data:
|
|
ends
|
|
|
|
struct queue_entry
|
|
.owner dd ?
|
|
.data_ptr dd ?
|
|
.data_size dd ?
|
|
.size:
|
|
ends
|
|
|
|
|
|
macro add_to_queue ptr, size, returnaddr {
|
|
|
|
cmp dword [ptr + queue.size], size ; Check if queue isnt full
|
|
jge .fail
|
|
|
|
DEBUGF 1,"Queuing packet for device %x\n",ebx
|
|
|
|
inc dword [ptr + queue.size]
|
|
|
|
mov edi, dword [ptr + queue.w_ptr] ; Current write pointer (FIFO!)
|
|
|
|
mov eax, ebx
|
|
stosd
|
|
pop eax
|
|
stosd
|
|
pop eax
|
|
stosd
|
|
|
|
cmp edi, size*queue_entry.size+ptr+queue.data ; entry size
|
|
jl .no_wrap
|
|
|
|
sub edi, size*queue_entry.size
|
|
|
|
.no_wrap:
|
|
mov dword [ptr + queue.w_ptr], edi
|
|
jmp returnaddr
|
|
|
|
.fail:
|
|
DEBUGF 1,"queuing failed\n"
|
|
|
|
call kernel_free
|
|
add esp, 4
|
|
ret
|
|
|
|
}
|
|
|
|
|
|
macro get_from_queue ptr, size, returnaddr {
|
|
|
|
.start_of_code:
|
|
cmp dword [ptr + queue.size], 0 ; any packets queued?
|
|
je returnaddr
|
|
|
|
DEBUGF 1,"Dequeuing packet"
|
|
|
|
dec dword [ptr + queue.size]
|
|
|
|
push dword .start_of_code ; return address for call's
|
|
|
|
mov esi, [ptr + queue.r_ptr]
|
|
lodsd
|
|
mov ebx, eax
|
|
lodsd
|
|
mov ecx, eax
|
|
lodsd
|
|
push eax
|
|
push ecx
|
|
xchg eax, ecx
|
|
|
|
DEBUGF 1," for device %x\n", ebx
|
|
|
|
cmp esi, size*queue_entry.size+ptr+queue.data ; entry size
|
|
jl .no_wrap
|
|
|
|
sub esi, size*queue_entry.size
|
|
|
|
.no_wrap:
|
|
mov dword [ptr + queue.r_ptr], esi
|
|
|
|
}
|
|
|