Invalidate Data Cache from User Space
Jonathan.Haws at sdl.usu.edu
Tue Nov 10 05:10:42 EST 2009
I have a routine to invalidate the data cache from user space (since I do not believe there is a standard routine I can use outside of kernel space??).
Here is the code:
* r3 = Data cache
* r4 = address
* r5 = number of bytes
cmpwi r5,0 /* make sure number of bytes is > 0 */
rlwinm r6,r6,0,0,26 /* end addr to start of next cache line */
rlwinm r7,r4,0,0,26 /* start address back to start of line */
srawi r6,r6,5 /* divide by 32 to get number of lines */
dcbi r0,r4 /* THIS INSTRUCTION FAILS! */
.size cacheInvalidate405, . - cacheInvalidate405
What is happening is the dcbi instruction will fail. I get an Illegal Instruction message on the console and my program exits.
Is there a reason I cannot call dbci from a user space application, or is there something wrong in my code? Even better, is there a working and tested function that I can call from user space to invalidate a portion of the data cache?
More information about the Linuxppc-dev