Subversion Repositories Kolibri OS

Rev

Rev 5984 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5984 Rev 6078
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: 5976 $
17
$Revision: 6011 $
18
 
18
 
Line 19... Line 19...
19
iglobal
19
iglobal
Line 25... Line 25...
25
        .mtu            dd 4096
25
        .mtu            dd 4096
26
        .name           dd .namestr
26
        .name           dd .namestr
Line 27... Line 27...
27
 
27
 
28
        .unload         dd .dummy_fn
28
        .unload         dd .dummy_fn
29
        .reset          dd .dummy_fn
29
        .reset          dd .dummy_fn
Line 30... Line 30...
30
        .transmit       dd LOOP_input
30
        .transmit       dd loop_input
31
 
31
 
32
        .bytes_tx       dq 0
32
        .bytes_tx       dq 0
33
        .bytes_rx       dq 0
33
        .bytes_rx       dq 0
Line 43... Line 43...
43
        ret
43
        ret
Line 44... Line 44...
44
 
44
 
Line 45... Line 45...
45
endg
45
endg
46
 
46
 
Line 47... Line 47...
47
 
47
 
48
macro   LOOP_init {
48
macro   loop_init {
Line 49... Line 49...
49
local   .fail
49
local   .fail
50
 
50
 
Line 51... Line 51...
51
        mov     ebx, LOOPBACK_DEVICE
51
        mov     ebx, LOOPBACK_DEVICE
Line 61... Line 61...
61
  .fail:
61
  .fail:
62
}
62
}
Line 63... Line 63...
63
 
63
 
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
;                                                                 ;
69
;                                                                 ;
70
;  OUT: /                                                         ;
70
;  OUT: /                                                         ;
71
;                                                                 ;
71
;                                                                 ;
72
;-----------------------------------------------------------------;
72
;-----------------------------------------------------------------;
73
align 4
73
align 4
Line 74... Line 74...
74
LOOP_input:
74
loop_input:
Line 75... Line 75...
75
 
75
 
76
        mov     eax, [esp+4]
76
        mov     eax, [esp+4]
Line 93... Line 93...
93
        mov     ebx, [eax + NET_BUFF.device]
93
        mov     ebx, [eax + NET_BUFF.device]
94
        mov     eax, [eax + NET_BUFF.type]
94
        mov     eax, [eax + NET_BUFF.type]
Line 95... Line 95...
95
 
95
 
96
; Place protocol handlers here
96
; Place protocol handlers here
97
        cmp     eax, AF_INET4
97
        cmp     eax, AF_INET4
Line 98... Line 98...
98
        je      IPv4_input
98
        je      ipv4_input
Line 99... Line 99...
99
 
99
 
100
        DEBUGF  DEBUG_NETWORK_VERBOSE, "LOOP_input: Unknown packet type=%x\n", eax
100
        DEBUGF  DEBUG_NETWORK_VERBOSE, "LOOP_input: Unknown packet type=%x\n", eax
101
 
101
 
102
  .dump:
102
  .dump:
Line 103... Line 103...
103
        DEBUGF  DEBUG_NETWORK_VERBOSE, "LOOP_input: dumping\n"
103
        DEBUGF  DEBUG_NETWORK_VERBOSE, "LOOP_input: dumping\n"
104
        call    NET_BUFF_free
104
        call    net_buff_free
105
        ret
105
        ret
106
 
106
 
107
 
107
 
108
;-----------------------------------------------------------------;
108
;-----------------------------------------------------------------;
109
;                                                                 ;
109
;                                                                 ;
110
; LOOP_output                                                     ;
110
; loop_output                                                     ;
Line 117... Line 117...
117
;       ecx = unchanged (packet size of embedded data)            ;
117
;       ecx = unchanged (packet size of embedded data)            ;
118
;       edi = start of payload                                    ;
118
;       edi = start of payload                                    ;
119
;                                                                 ;
119
;                                                                 ;
120
;-----------------------------------------------------------------;
120
;-----------------------------------------------------------------;
121
align 4
121
align 4
122
LOOP_output:
122
loop_output:
Line 123... Line 123...
123
 
123
 
Line 124... Line 124...
124
        DEBUGF  DEBUG_NETWORK_VERBOSE, "LOOP_output\n"
124
        DEBUGF  DEBUG_NETWORK_VERBOSE, "LOOP_output\n"
125
 
125
 
Line 126... Line 126...
126
        cmp     ecx, [LOOPBACK_DEVICE.mtu]
126
        cmp     ecx, [LOOPBACK_DEVICE.mtu]
127
        ja      .too_large
127
        ja      .too_large
128
 
128
 
129
        push    ecx edi
129
        push    ecx edi
130
        add     ecx, NET_BUFF.data
130
        add     ecx, NET_BUFF.data
Line 131... Line 131...
131
        stdcall NET_BUFF_alloc, ecx
131
        stdcall net_buff_alloc, ecx
132
        test    eax, eax
132
        test    eax, eax