Can you explain why you need to invalidate all d-cache entries for you TIFF loader ? I dunno if you TIFF loader uses stack overflow but what you need in fact is to WRITEBACK d-cache (overflow stack being in d-cache) then to INVALIDATE i-cache so you can run instructions poked in the stack.
If you only invalidate (that is without writeback) some data modified in d-cache would not be written back to real memory and arises some incoherencies when trying to run them.
On the contrary, if you only need to be sure that d-cache contents are written back to real memory simple d-cache writebacks can be done instead of invalidating them too. the code is : "cache 0x1A, 0($t0)", if i'm not wrong.
Maybe what you want to do is :
Code: Select all
void asmKernelSyncICacheAndDcache(void)
{
asm(
".set push\n"
".set noreorder\n"
"move $t0, $0\n"
"addiu $t1, $0, 0x4000\n"
"0:\n" // avoid to name loop if you plan to inline this function
"cache 0x1a, 0($t0)\n" // D-cache writeback
"addiu $t0, $t0, 0x40\n"
"bne $t0, $t1, 0b\n"
"cache 0x08, -0x40($t0)\n" // I-cache invalidate
"sync\n" // reason to do so ?
".set pop"
);
}