aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers
diff options
context:
space:
mode:
authorMarvin Borner2020-09-26 16:29:49 +0200
committerMarvin Borner2020-09-26 16:29:49 +0200
commitcac7c352a1ece2744de42128a9c69df16f05d26a (patch)
tree667d9b817f77df30468c63af735de0790f59acac /kernel/drivers
parent038722e045684a1a04f0fd6a51da2a6ea9dc9bb5 (diff)
Very simple icmp ping handling
Diffstat (limited to 'kernel/drivers')
-rw-r--r--kernel/drivers/rtl8139.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/drivers/rtl8139.c b/kernel/drivers/rtl8139.c
index 6487eca..2fc8f07 100644
--- a/kernel/drivers/rtl8139.c
+++ b/kernel/drivers/rtl8139.c
@@ -25,6 +25,7 @@ u8 *rtl8139_get_mac()
void rtl8139_receive_packet()
{
+ printf("%x\n", current_packet_ptr);
u16 *t = (u16 *)(rx_buffer + current_packet_ptr);
u16 length = *(t + 1);
t += 2;
@@ -35,7 +36,7 @@ void rtl8139_receive_packet()
current_packet_ptr = (current_packet_ptr + length + 4 + 3) & (~3);
- if (current_packet_ptr > RX_BUF_SIZE)
+ if (current_packet_ptr >= RX_BUF_SIZE)
current_packet_ptr -= RX_BUF_SIZE;
outw(rtl_iobase + RTL_PORT_RXPTR, current_packet_ptr - 0x10);
@@ -46,6 +47,7 @@ static u8 tsd_array[4] = { 0x10, 0x14, 0x18, 0x1C };
static u8 tx_current = 0;
void rtl8139_send_packet(void *data, u32 len)
{
+ printf("Sending packet %d\n", len);
outl(rtl_iobase + tsad_array[tx_current], (u32)data);
outl(rtl_iobase + tsd_array[tx_current++], len);
if (tx_current > 3)