Rev 1519 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1519 | Rev 1529 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | ;; GNU GENERAL PUBLIC LICENSE ;; |
15 | ;; GNU GENERAL PUBLIC LICENSE ;; |
16 | ;; Version 2, June 1991 ;; |
16 | ;; Version 2, June 1991 ;; |
17 | ;; ;; |
17 | ;; ;; |
18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 19... | Line 19... | ||
19 | 19 | ||
Line 20... | Line 20... | ||
20 | $Revision: 1519 $ |
20 | $Revision: 1529 $ |
21 | 21 | ||
Line 22... | Line 22... | ||
22 | __DEBUG_LEVEL_OLD__ equ __DEBUG_LEVEL__ |
22 | __DEBUG_LEVEL_OLD__ equ __DEBUG_LEVEL__ |
Line 66... | Line 66... | ||
66 | SOCK_RAW equ 3 |
66 | SOCK_RAW equ 3 |
Line 67... | Line 67... | ||
67 | 67 | ||
68 | ; Socket options |
68 | ; Socket options |
Line 69... | Line 69... | ||
69 | SO_ACCEPTCON equ 1 |
69 | SO_ACCEPTCON equ 1 |
Line 70... | Line 70... | ||
70 | 70 | ||
71 | SOCKET_MAXDATA equ 4096 |
71 | SOCKET_MAXDATA equ 4096*32 ; must be 4096*(power of 2) where 'power of 2' is at least 8 |
72 | 72 | ||
Line -... | Line 73... | ||
- | 73 | ; Network driver types |
|
- | 74 | NET_TYPE_ETH equ 1 |
|
Line 73... | Line 75... | ||
73 | ; Network driver types |
75 | NET_TYPE_SLIP equ 2 |
Line 74... | Line 76... | ||
74 | NET_TYPE_ETH equ 1 |
76 | |
Line 90... | Line 92... | ||
90 | .bytes_tx dq ? ; Statistics, updated by the driver |
92 | .bytes_tx dq ? ; Statistics, updated by the driver |
91 | .bytes_rx dq ? ; |
93 | .bytes_rx dq ? ; |
92 | .packets_tx dd ? ; |
94 | .packets_tx dd ? ; |
93 | .packets_rx dd ? ; |
95 | .packets_rx dd ? ; |
Line -... | Line 96... | ||
- | 96 | ||
- | 97 | ; .chksum dd ? ; bitmask stating available checksum routines on hardware |
|
94 | 98 | ||
Line 95... | Line 99... | ||
95 | .end: |
99 | .end: |
Line 96... | Line 100... | ||
96 | 100 | ||
97 | end virtual |
101 | end virtual |
98 | 102 | ||
99 | 103 | ||
100 | ; Exactly as it says.. |
104 | ; Exactly as it says.. |
- | 105 | macro pseudo_random reg { |
|
101 | macro pseudo_random reg { |
106 | add reg, [esp] |
102 | add reg, [esp] |
107 | rol reg, 5 |
103 | rol reg, 5 |
108 | xor reg, [timer_ticks] |
104 | xor reg, [timer_ticks] |
109 | add reg, [CPU_FREQ] |
Line 120... | Line 125... | ||
120 | rol word reg, 8 |
125 | rol word reg, 8 |
Line 121... | Line 126... | ||
121 | 126 | ||
Line -... | Line 127... | ||
- | 127 | } |
|
- | 128 | ||
- | 129 | ||
- | 130 | macro packet_to_debug { ; set esi to packet you want to print, ecx to number of bytes |
|
- | 131 | ||
- | 132 | local .loop |
|
- | 133 | ||
- | 134 | .loop: |
|
- | 135 | lodsb |
|
- | 136 | DEBUGF 1,"%x ", eax:2 |
|
- | 137 | loop @r |
|
- | 138 | ||
122 | } |
139 | } |
Line 123... | Line 140... | ||
123 | 140 | ||
124 | 141 | ||
Line 159... | Line 176... | ||
159 | ;----------------------------------------------------------------- |
176 | ;----------------------------------------------------------------- |
160 | align 4 |
177 | align 4 |
161 | stack_init: |
178 | stack_init: |
Line 162... | Line 179... | ||
162 | 179 | ||
163 | ; Init the network drivers list |
- | |
164 | 180 | ; Init the network drivers list |
|
165 | xor eax, eax |
181 | xor eax, eax |
166 | mov edi, NET_RUNNING |
182 | mov edi, NET_RUNNING |
167 | mov ecx, MAX_NET_DEVICES + 1 |
183 | mov ecx, MAX_NET_DEVICES + 1 |
Line -... | Line 184... | ||
- | 184 | rep stosd |
|
168 | rep stosd |
185 | |
- | 186 | ETH_init |
|
169 | 187 | ; SLIP_init |
|
170 | ; Call other init procedures |
188 | ; PPPOE_init |
171 | 189 | ||
172 | call ETH_init |
190 | IPv4_init |
- | 191 | ICMP_init |
|
173 | ; call SLIP_init |
192 | |
174 | 193 | ARP_init |
|
Line 175... | Line -... | ||
175 | call IPv4_init |
- | |
176 | call ICMP_init |
- | |
177 | 194 | UDP_init |
|
178 | call ARP_init |
- | |
179 | call UDP_init |
- | |
Line 180... | Line 195... | ||
180 | call TCP_init |
195 | TCP_init |
Line 181... | Line 196... | ||
181 | 196 | ||
Line 209... | Line 224... | ||
209 | mov [net_10ms], eax |
224 | mov [net_10ms], eax |
Line 210... | Line 225... | ||
210 | 225 | ||
211 | test [net_10ms], 0x0f ; 160ms |
226 | test [net_10ms], 0x0f ; 160ms |
Line 212... | Line 227... | ||
212 | jnz .exit |
227 | jnz .exit |
Line 213... | Line 228... | ||
213 | 228 | ||
214 | ; call TCP_timer_160ms |
229 | TCP_timer_160ms |
Line 215... | Line 230... | ||
215 | 230 | ||
216 | test [net_10ms], 0x3f ; 640ms |
231 | test [net_10ms], 0x3f ; 640ms |
217 | jnz .exit |
232 | jnz .exit |
Line 218... | Line 233... | ||
218 | 233 | ||
219 | ; call TCP_timer_640ms |
234 | TCP_timer_640ms |
Line 273... | Line 288... | ||
273 | 288 | ||
274 | DEBUGF 1,"Unknown network device type: %u\n", [ebx + NET_DEVICE.type] |
289 | DEBUGF 1,"Unknown network device type: %u\n", [ebx + NET_DEVICE.type] |
Line 275... | Line 290... | ||
275 | jmp .error |
290 | jmp .error |
276 | 291 | ||
Line 277... | Line 292... | ||
277 | .ethernet: |
292 | .ethernet: |
278 | DEBUGF 1,"Trying to add an ethernet driver\n" |
293 | DEBUGF 1,"Trying to add an ethernet device\n" |
Line 279... | Line 294... | ||
279 | 294 | ||
280 | inc [ETH_RUNNING] ; Indicate that one more ethernet device is up and running |
295 | inc [ETH_RUNNING] ; Indicate that one more ethernet device is up and running |
281 | jmp .add_it |
296 | jmp .add_it |
282 | 297 | ||
Line 283... | Line 298... | ||
283 | .slip: |
298 | .slip: |
Line 488... | Line 503... | ||
488 | and edx, 0xffff |
503 | and edx, 0xffff |
489 | add edx, ecx |
504 | add edx, ecx |
Line 490... | Line 505... | ||
490 | 505 | ||
491 | mov ecx, edx |
506 | mov ecx, edx |
492 | shr ecx, 16 |
507 | shr ecx, 16 |
493 | add edx, ecx |
- | |
- | 508 | add dx, cx |
|
494 | 509 | test dx, dx ; it seems that ZF is not set when CF is set :( |
|
495 | not dx |
510 | not dx |
496 | jnz .not_zero |
511 | jnz .not_zero |
497 | dec dx |
512 | dec dx |
498 | .not_zero: |
513 | .not_zero: |