Skip to content

Commit

Permalink
nios2: fix cache coherency issue when debug with gdb
Browse files Browse the repository at this point in the history
Remove the end address checking for flushda function. We need to flush
each address line for flushda instruction, from start to end address.
This is because flushda instruction only flush the cache if tag and line
fields are matched.

Change to use ldwio instruction (bypass cache) to load the instruction
that causing trap. Our interest is the actual instruction that executed
by the processor, this should be uncached.
Note, EA address might be an userspace cached address.


Signed-off-by: Ley Foon Tan <lftan@altera.com>
  • Loading branch information
Ley Foon Tan committed Apr 10, 2015
1 parent e3e29f9 commit 4a89c30
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion arch/nios2/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ ENTRY(inthandler)
***********************************************************************
*/
ENTRY(handle_trap)
ldw r24, -4(ea) /* instruction that caused the exception */
ldwio r24, -4(ea) /* instruction that caused the exception */
srli r24, r24, 4
andi r24, r24, 0x7c
movia r9,trap_table
Expand Down
3 changes: 0 additions & 3 deletions arch/nios2/mm/cacheflush.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ static void __flush_dcache(unsigned long start, unsigned long end)
end += (cpuinfo.dcache_line_size - 1);
end &= ~(cpuinfo.dcache_line_size - 1);

if (end > start + cpuinfo.dcache_size)
end = start + cpuinfo.dcache_size;

for (addr = start; addr < end; addr += cpuinfo.dcache_line_size) {
__asm__ __volatile__ (" flushda 0(%0)\n"
: /* Outputs */
Expand Down

0 comments on commit 4a89c30

Please sign in to comment.