Hello,
More than one, I have been trapped by calling cacheBufferInvalidate or cacheBufferFlush with an unproperly aligned address. Is it possible to add an chDbgAssert in these 2 functions, that check that the 5 LSB of address are clear ?
The effects of passing unaligned address can go from subtle bug to hard hardware fault with smashed stack where debugger is of no help.
Alexandre -
add checks for DMA cache synchronisation function
Re: add checks for DMA cache synchronisation function
Not used the cacheBufferInvalidate or cacheBufferFlush functions yet, I don't think. But the earlier dmaBufferFlush() would accept and apparently work OK with any address. (I had a situation where a 3rd-party-created buffer was definitely not 32-byte aligned; I had to flush one more cache line than the minimum, to make sure the whole buffer was flushed).
So enforcing 32-byte boundaries could cause a different set of problems!
So enforcing 32-byte boundaries could cause a different set of problems!
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: add checks for DMA cache synchronisation function
Invalidating non aligned objects (address AND size) is a very bad idea, this would mean corrupting adjacent data. Flushing is not a problem.
Giovanni
Giovanni
Return to “Small Change Requests”
Who is online
Users browsing this forum: No registered users and 14 guests