stm25p: fix seek error
Ensure correct computation of m_log_info[ id ].read_addr when client code
requests seek() to a cookie whose value is below the current virtual
address range by a distance, in address value, greater than 255 sectors.
The sector component of a virtual address is 16 bits, given
STM25P_SECTOR_SIZE_LOG2 is 16 and sizeof(storage_cookie_t) is 32.
However, in ClientResource.granted[]() in the S_SEEK case, the client's
read_addr value can have its upper bits silently discarded because
sector value are handled in uint8_t variables.
The symptom of upper bit discards is that client code receives the
contents of a full log many times until the client read_addr value
finally increments to the point that allows satisfaction of the end of
log condition,
read_addr >= m_log_info[ client ].write_addr
Example case exhibiting this behavior:
read_addr = 0x59f0000
write_addr =
5a6dbf8
LogRead.seek(0x2a71400)
The resulting address handling in ClientResource.granted[]() in the
S_SEEK request case, around Stm25pLogP.nc:229:
readSector = 0xa7; // from incoming cookie value, should be 0x2a7
writeSector = 0xa7; // should be 0x5a7
if (writeSector - readSector > numSectors): FALSE, should be TRUE
Had the if expression above been TRUE, the read address would
still be computed incorrectly due to 8-bit match in the if's
'then' clause.
m_log_state[ id ].read_addr = 0x2a7000; // should be 0x59f000