norflash: fix handling of boundaries
This was slightly off since my introduction of hidden sectors^^^^^ blocks in the norflash driver.
This commit is contained in:
@@ -63,6 +63,9 @@ nor_init_device(void *_info, void **_cookie)
|
|||||||
if (info->id < 0)
|
if (info->id < 0)
|
||||||
return info->id;
|
return info->id;
|
||||||
|
|
||||||
|
info->mapped += HIDDEN_BLOCKS * info->blocksize;
|
||||||
|
|
||||||
|
|
||||||
*_cookie = info;
|
*_cookie = info;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -142,8 +145,6 @@ nor_read(void *_cookie, off_t position, void *data, size_t *numbytes)
|
|||||||
nor_driver_info *info = (nor_driver_info*)_cookie;
|
nor_driver_info *info = (nor_driver_info*)_cookie;
|
||||||
TRACE("read(%Ld,%lu)\n", position, *numbytes);
|
TRACE("read(%Ld,%lu)\n", position, *numbytes);
|
||||||
|
|
||||||
position += HIDDEN_BLOCKS * info->blocksize;
|
|
||||||
|
|
||||||
if (position + *numbytes > info->totalsize)
|
if (position + *numbytes > info->totalsize)
|
||||||
*numbytes = info->totalsize - (position + *numbytes);
|
*numbytes = info->totalsize - (position + *numbytes);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user