Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/jtag2rw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,12 @@ uchar *jtag2::jtagRead(unsigned long addr, unsigned int numBytes)
unsigned int chunksize = numBytes;
unsigned int targetOffset = 0;

if (addr + chunksize >= pageAddr + pageSize)
offset = addr & mask;
if (chunksize > pageSize - offset) {
// Chunk would cross a page boundary, reduce it
// appropriately.
chunksize -= (addr + numBytes - (pageAddr + pageSize));
offset = addr - pageAddr;
chunksize = pageSize - offset;
}

while (numBytes > 0)
{
Expand Down
7 changes: 4 additions & 3 deletions src/jtag3rw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,12 @@ uchar *jtag3::jtagRead(unsigned long addr, unsigned int numBytes)
unsigned int chunksize = numBytes;
unsigned int targetOffset = 0;

if (addr + numBytes >= pageAddr + pageSize)
offset = addr & mask;
if (chunksize > pageSize - offset) {
// Chunk would cross a page boundary, reduce it
// appropriately.
chunksize -= (addr + numBytes - (pageAddr + pageSize));
offset = addr - pageAddr;
chunksize = pageSize - offset;
}

while (numBytes > 0)
{
Expand Down