tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Revamping optimised in_cksum/in4_cksum/in6_cksum support

Joerg Sonnenberger wrote:

> On Sun, Jan 27, 2008 at 10:23:31PM +1100, Simon Burge wrote:
> >                 while (mlen >= 32) {
> >                         __builtin_prefetch(data + 32);
> > 
> > On at least some MIPS and PowerPC implementations (and possibly others)
> > a prefetch on an address that isn't mapped can cause a bus error or
> > similar exception.
> __builtin_prefetch is not supposed to generate traps. If you can
> actually trigger that, it is a GCC bug.

At least MIPS and PowerPC will generate "pref" and "dcbt" instructions
respectively that point to potentially invalid addresses with the code
as it currently is.

I had a look at the gcc description of __builtin_prefetch() and I'm
curious as to how "Data prefetch does not generate faults if ADDR
is invalid" can be guaranteed if it just blindly issues the raw
cache/prefetch instructions with the addresses you pass it when those
instructions can fault on at least some CPUs of both the architectures
I've looked at so far...


Home | Main Index | Thread Index | Old Index