assembly to flush I | D caches

Additional operating system/hardware discussion (Windows, Linux, *BSD and others)
Forum rules
Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.
Posts: 73
Joined: Tue Apr 28, 2015 7:54 pm

Re: assembly to flush I | D caches

Unread postby nyef » Mon Dec 21, 2015 5:10 pm

See MIPS Run (first edition) says that the R10k has an R4000-style cache, and gives example code. I have no idea at this point if it really is an R4000-style cache or if there's some special trick to it. Presumably the Linux kernel source could be a resource, although if you're looking for code to compare that with for debug purposes then that's just sending you back to your starting point.

User avatar
Posts: 235
Joined: Mon May 24, 2004 12:14 am
Location: Byzantine Secundus

Re: assembly to flush I | D caches

Unread postby Kumba » Thu Jan 07, 2016 3:16 am

ivelegacy wrote:
nyef wrote:See MIPS Run (first edition) says that the R10k has an R4000-style cache

I do not have a copy on hand, I have an hardcover (paper) copy but it's not on hand (250 Km far from where I am) so I am going to buy an ebook for my kindle, this way you always have a copy on hand when you need a lecture, example, or MIPSfun :D

R10K family is an R4K-style cache. In fact, a *lot* of MIPS processors, including many modern-day ones, still have this R4K-style cache layout. If it ain't broke, don't fix it.

ivelegacy wrote:Linux is too bloated, up to 60 Mbyte of sources, I find myself drowning in all their clutter and a bit tired of having to dig through a lot of sources with a lot of #IFDEF to find the article of good source I need!

In the old days, it apparently wasn't too difficult to write assembler that was better than what a compiler can generate. But nowadays, gcc is really, really difficult to beat. So, a lot of the old assembler code that used to power the critical bits of Linux/MIPS code have been replaced by C-equivalents for better readability and maintainability.

That said, yes, certain parts of the Linux tree can be quite a mess (like, why is sound/ at the root instead of under drivers/ ?), but the arch/mips/* folder is pretty well organized:

R4K-cache core code: ... mm/c-r4k.c

The generic cache interface definitions are here: ... mm/cache.c

And the relevant header files: ... sm/cache.h ... cheflush.h ... cacheops.h ... r4kcache.h (this one has templated asm for R4K caches)

Most cache-related and TLB-related code is under the 'mm' directory in the MIPS' arch folder, if you want to look at what other CPUs do. Maybe you'll have better luck than me in reading and understanding it!
:Onyx2: 4x R14000 :Tezro: 4x R16000 :Fuel: 1x R16000 :Octane: 2x R14000 :O2+: RM7000 :O2: R10000 :O2: RM5200 :Indigo: R4400 :Indigo2IMP: R10000 :Indigo2: R8000 :O3x0: 4x R14000 :Indy: R5000

"The past tempts us, the present confuses us, the future frightens us. And our lives slip away, moment by moment, lost in that vast, terrible in-between."
--Emperor Turhan, Centauri Republic

Return to “Miscellaneous Operating Systems/Hardware”

Who is online

Users browsing this forum: No registered users and 1 guest