mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 15:16:14 +00:00
Kernel/NE2000: Correct receive ring buffer wrap-around
next_packet_page points to a page, but was being compared to a byte offset rather than a page offset when adjusting the BOUNDARY register when the ring buffer wraps around. Fixes #8327.
This commit is contained in:
committed by
Andreas Kling
parent
a1d0ad61a6
commit
de2d5d6a7e
@@ -116,7 +116,7 @@ static constexpr int NE2K_RAM_END = 32768;
|
||||
static constexpr int NE2K_RAM_SIZE = NE2K_RAM_END - NE2K_RAM_BEGIN;
|
||||
|
||||
static constexpr int NE2K_RAM_SEND_BEGIN = 16384;
|
||||
static constexpr int NE2K_RAM_SEND_END = 16384 + 6 * 256;
|
||||
static constexpr int NE2K_RAM_SEND_END = 16384 + 6 * NE2K_PAGE_SIZE;
|
||||
static constexpr int NE2K_RAM_SEND_SIZE = NE2K_RAM_SEND_END - NE2K_RAM_SEND_BEGIN;
|
||||
|
||||
static constexpr int NE2K_RAM_RECV_BEGIN = NE2K_RAM_SEND_END;
|
||||
@@ -426,7 +426,7 @@ void NE2000NetworkAdapter::receive()
|
||||
did_receive(packet.span().slice(sizeof(received_packet_header)));
|
||||
}
|
||||
|
||||
if (header.next_packet_page == NE2K_RAM_RECV_BEGIN)
|
||||
if (header.next_packet_page == (NE2K_RAM_RECV_BEGIN >> 8))
|
||||
out8(REG_RW_BOUNDARY, (NE2K_RAM_RECV_END >> 8) - 1);
|
||||
else
|
||||
out8(REG_RW_BOUNDARY, header.next_packet_page - 1);
|
||||
|
||||
Reference in New Issue
Block a user