When getting the memory map, ask only for 2046 bytes instead of
2048 bytes. This should fix bugs #993 and #997. On BeOS R5 asking for 2 bytes too much wasn't a problem, as we only need the first page_entry, and it didn't return any Error. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19992 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -127,7 +127,11 @@ static inline unsigned long vtophys(unsigned long virtual_addr)
|
||||
{
|
||||
physical_entry pe;
|
||||
status_t err;
|
||||
err = get_memory_map((void *)virtual_addr, 2048, &pe, 1);
|
||||
// vtophys is called for the start of any page aligned contiguous large buffer,
|
||||
// and also with offset 2 into 2048 byte aligned (non-contiguous) rx/tx buffer.
|
||||
// Thus we only ask for 2046 bytes to get exactly one physical_entry. If the
|
||||
// next physical page is non-contiguous, using 2048 may return B_BUFFER_OVERFLOW.
|
||||
err = get_memory_map((void *)virtual_addr, 2046, &pe, 1);
|
||||
if (err < 0)
|
||||
panic("ipro1000: get_memory_map failed for %p, error %08lx\n", (void *)virtual_addr, err);
|
||||
return (unsigned long) pe.address;
|
||||
|
||||
Reference in New Issue
Block a user