Cleanup in Net Branch + stub for PPPoE I wrote some months ago

git-svn-id: svn://kolibrios.org@2614 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr
2012-04-14 21:15:00 +00:00
parent ac28d0fed6
commit ba80d953e5
9 changed files with 577 additions and 311 deletions

View File

@@ -24,7 +24,7 @@ struct ETH_header
ends
ETH_FRAME_MINIMUM equ 60
ETH_FRAME_MINIMUM = 60
struct ETH_DEVICE NET_DEVICE
@@ -78,7 +78,7 @@ ETH_input:
je ARP_input
; cmp ax, ETHER_PPP_DISCOVERY
; je PPPOE_discovery
; je PPPoE_discovery_input
DEBUGF 2,"Unknown ethernet packet type %x\n", ax
@@ -173,64 +173,63 @@ ETH_output:
;
;-----------------------------------------------------------------
align 4
ETH_API:
ETH_api:
cmp bh, MAX_NET_DEVICES
ja .error
movzx eax, bh
shl eax, 2
mov eax, dword [NET_DRV_LIST + eax]
mov eax, dword [NET_DRV_LIST + 4*eax]
cmp [eax + NET_DEVICE.type], NET_TYPE_ETH
jne .error
test bl, bl
jz .packets_tx ; 0
dec bl
jz .packets_rx ; 1
dec bl
jz .bytes_tx ; 2
dec bl
jz .bytes_rx ; 3
dec bl
jz .read_mac ; 4
dec bl
jz .write_mac ; 5
and ebx, 0xff
cmp ebx, .number
ja .error
jmp dword [.table + 4*ebx]
.table:
dd .packets_tx ; 0
dd .packets_rx ; 1
dd .bytes_tx ; 2
dd .bytes_rx ; 3
dd .read_mac ; 4
dd .write_mac ; 5
.number = ($ - .table) / 4 - 1
.error:
DEBUGF 2,"Device is not ethernet type\n"
or eax, -1
ret
.packets_tx:
.packets_tx:
mov eax, [eax + NET_DEVICE.packets_tx]
ret
.packets_rx:
.packets_rx:
mov eax, [eax + NET_DEVICE.packets_rx]
ret
.bytes_tx:
.bytes_tx:
mov ebx, dword [eax + NET_DEVICE.bytes_tx + 4]
mov eax, dword [eax + NET_DEVICE.bytes_tx]
mov [esp+20+4], ebx ; TODO: fix this ugly code
ret
.bytes_rx:
.bytes_rx:
mov ebx, dword [eax + NET_DEVICE.bytes_rx + 4]
mov eax, dword [eax + NET_DEVICE.bytes_rx]
mov [esp+20+4], ebx ; TODO: fix this ugly code
ret
.read_mac:
.read_mac:
movzx ebx, word [eax + ETH_DEVICE.mac]
mov eax, dword [eax + ETH_DEVICE.mac + 2]
mov [esp+20+4], ebx ; TODO: fix this ugly code
ret
.write_mac:
.write_mac:
push ecx
push dx
call [eax + ETH_DEVICE.set_MAC]