Rev 5363 | Rev 5523 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5363 | Rev 5522 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
13 | ;; Version 2, June 1991 ;; |
13 | ;; Version 2, June 1991 ;; |
14 | ;; ;; |
14 | ;; ;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 16... | Line 16... | ||
16 | 16 | ||
Line 17... | Line 17... | ||
17 | $Revision: 5363 $ |
17 | $Revision: 5522 $ |
18 | 18 | ||
Line 19... | Line 19... | ||
19 | iglobal |
19 | iglobal |
Line 64... | Line 64... | ||
64 | ;----------------------------------------------------------------- |
64 | ;----------------------------------------------------------------- |
65 | ; |
65 | ; |
66 | ; LOOP_input |
66 | ; LOOP_input |
67 | ; |
67 | ; |
68 | ; IN: [esp+4] = Pointer to buffer |
68 | ; IN: [esp+4] = Pointer to buffer |
69 | ; [esp+8] = size of buffer |
- | |
70 | ; |
69 | ; |
71 | ; OUT: / |
70 | ; OUT: / |
72 | ; |
71 | ; |
73 | ;----------------------------------------------------------------- |
72 | ;----------------------------------------------------------------- |
74 | align 4 |
73 | align 4 |
75 | LOOP_input: |
74 | LOOP_input: |
76 | pop ebx |
- | |
77 | pop eax |
- | |
78 | pop ecx |
- | |
Line 79... | Line -... | ||
79 | - | ||
80 | push ebx |
- | |
81 | push ecx |
75 | |
Line -... | Line 76... | ||
- | 76 | mov eax, [esp+4] |
|
82 | push eax |
77 | |
- | 78 | ; Update stats |
|
- | 79 | inc [LOOPBACK_DEVICE.packets_rx] |
|
83 | 80 | ||
84 | inc [LOOPBACK_DEVICE.packets_rx] |
81 | mov ecx, [eax + NET_BUFF.length] |
Line 85... | Line 82... | ||
85 | add dword[LOOPBACK_DEVICE.bytes_rx], ecx |
82 | add dword[LOOPBACK_DEVICE.bytes_rx], ecx |
86 | adc dword[LOOPBACK_DEVICE.bytes_rx + 4], 0 |
- | |
87 | - | ||
88 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: size=%u\n", ecx |
- | |
Line -... | Line 83... | ||
- | 83 | adc dword[LOOPBACK_DEVICE.bytes_rx + 4], 0 |
|
- | 84 | ||
- | 85 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: ptr=%x size=%u\n", eax, ecx |
|
- | 86 | ||
- | 87 | ; Reverse buffptr and returnaddr on stack |
|
- | 88 | pop edx edi |
|
- | 89 | push edx edi |
|
- | 90 | ||
- | 91 | ; Set registers for protocol handlers |
|
- | 92 | lea edx, [eax + NET_BUFF.data] |
|
89 | lea edx, [eax + 4] |
93 | mov ebx, [eax + NET_BUFF.device] |
90 | mov eax, dword[eax] |
94 | mov eax, [eax + NET_BUFF.type] |
Line 91... | Line 95... | ||
91 | mov ebx, LOOPBACK_DEVICE |
95 | |
Line 92... | Line 96... | ||
92 | 96 | ; Place protocol handlers here |
|
93 | cmp eax, AF_INET4 |
97 | cmp eax, AF_INET4 |
94 | je IPv4_input |
98 | je IPv4_input |
95 | - | ||
96 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: Unknown packet type=%x\n", ax |
99 | |
Line -... | Line 100... | ||
- | 100 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: Unknown packet type=%x\n", eax |
|
97 | 101 | ||
98 | .dump: |
102 | .dump: |
99 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: dumping\n" |
103 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: dumping\n" |
100 | call NET_packet_free |
104 | call NET_BUFF_free |
101 | add esp, 4 |
- | |
102 | ret |
105 | ret |
103 | 106 | ||
104 | ;----------------------------------------------------------------- |
107 | |
105 | ; |
108 | ;----------------------------------------------------------------- |
106 | ; LOOP_output |
- | |
107 | ; |
109 | ; |
108 | ; IN: |
110 | ; LOOP_output |
109 | ; ecx = packet size |
111 | ; |
110 | ; edi = address family |
112 | ; IN: ecx = packet size |
111 | ; |
113 | ; edi = address family |
112 | ; OUT: edi = 0 on error, pointer to buffer otherwise |
114 | ; |
113 | ; eax = buffer start |
115 | ; OUT: eax = start of net frame / 0 on error |
Line 114... | Line 116... | ||
114 | ; ebx = to device structure |
116 | ; ebx = to device structure |
Line 115... | Line -... | ||
115 | ; ecx = unchanged (packet size of embedded data) |
- | |
116 | ; edx = size of complete buffer |
- | |
117 | ; |
- | |
118 | ;----------------------------------------------------------------- |
- | |
119 | align 4 |
117 | ; ecx = unchanged (packet size of embedded data) |
120 | LOOP_output: |
118 | ; edi = start of payload |
- | 119 | ; |
|
- | 120 | ;----------------------------------------------------------------- |
|
121 | 121 | align 4 |
|
122 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_output\n" |
122 | LOOP_output: |
123 | 123 | ||
124 | push ecx |
- | |
125 | push edi |
- | |
126 | - | ||
Line 127... | Line -... | ||
127 | add ecx, 4 |
- | |
128 | cmp ecx, [LOOPBACK_DEVICE.mtu] |
124 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_output\n" |
129 | ja .out_of_ram |
125 | |
130 | stdcall kernel_alloc, ecx |
126 | cmp ecx, [LOOPBACK_DEVICE.mtu] |
- | 127 | ja .too_large |
|
- | 128 | ||
- | 129 | push ecx edi |
|
- | 130 | stdcall NET_BUFF_alloc, ecx |
|
Line 131... | Line 131... | ||
131 | test eax, eax |
131 | test eax, eax |
132 | jz .out_of_ram |
132 | jz .out_of_ram |
133 | mov edi, eax |
133 | |
Line 134... | Line 134... | ||
134 | pop eax |
134 | pop edi |
- | 135 | mov [eax + NET_BUFF.type], edi |
|
- | 136 | mov ebx, LOOPBACK_DEVICE |
|
- | 137 | mov [eax + NET_BUFF.device], ebx |
|
- | 138 | pop ecx |
|
- | 139 | mov [eax + NET_BUFF.length], ecx |
|
135 | stosd |
140 | lea edi, [eax + NET_BUFF.data] |
Line 136... | Line 141... | ||
136 | 141 | ||
137 | lea eax, [edi - 4] ; Set eax to buffer start |
142 | inc [LOOPBACK_DEVICE.packets_tx] |
138 | pop ecx |
143 | add dword[LOOPBACK_DEVICE.bytes_tx], ecx |
139 | lea edx, [ecx + 4] ; Set edx to complete buffer size |
144 | adc dword[LOOPBACK_DEVICE.bytes_tx + 4], 0 |
140 | mov ebx, LOOPBACK_DEVICE |
145 |