Skip to content

Commit

Permalink
fixed bug in the flush and invalidate cache function
Browse files Browse the repository at this point in the history
  • Loading branch information
dimok789 committed Apr 25, 2016
1 parent 9eb118d commit 74ab489
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/utils/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
void FlushRange(unsigned int startAddr, unsigned int size)
{
register unsigned int addr = startAddr & ~0x1F;
register unsigned int len = ((startAddr & 0x1F) + size) >> 5;
register unsigned int end_addr = startAddr + size;

while(len)
while(addr < end_addr)
{
asm volatile("dcbf 0, %0" : : "r"(addr));
addr += 0x20;
--len;
}
asm volatile("sync; eieio");
}
Expand All @@ -18,12 +17,11 @@ void FlushRange(unsigned int startAddr, unsigned int size)
void InvalidateRange(unsigned int startAddr, unsigned int size)
{
register unsigned int addr = startAddr & ~0x1F;
register unsigned int len = ((startAddr & 0x1F) + size) >> 5;
register unsigned int end_addr = startAddr + size;

while(len)
while(addr < end_addr)
{
asm volatile("dcbi 0, %0" : : "r"(addr));
addr += 0x20;
--len;
}
}

0 comments on commit 74ab489

Please sign in to comment.