Is it possible to store data in the processor cache directly?

I was wondering if there is a way to store data in the processor data cache directly, and not in main memory. I understand that the way caches work is to store the most frequently used data, but it makes sense to have a build directive to tell the processor that this will be frequently used data. I use IA-32 assembly language.

Thanks!

+4
source share
2 answers

Depending on the architecture, there are biased hints for moving data directly to the cache. For ia32, this is a prefetch statement that can move data to L1, L2.

On the other hand, there are instructions that tell the processor to avoid using a cache like moventdq , which moves data directly from / to memory.

Edit: In addition, there are instructions for setting memory ranges for certain types of caching algorithms, such as write, write, write, or combine. See http://en.wikipedia.org/wiki/Memory_type_range_register .

+2
source

No, you cannot access the cache directly at the assembly level. Since the cache is "hidden" (L1 and L2) in the processor and, possibly, there is no cache at all.

+2
source

Source: https://habr.com/ru/post/1386156/


All Articles