linux-mips
[Top] [All Lists]

Re: using mprotect to write to .text

To: David Daney <david.daney@cavium.com>
Subject: Re: using mprotect to write to .text
From: Joe Buehler <aspam@cox.net>
Date: Tue, 11 Oct 2011 13:31:54 -0400
Authentication-results: cox.net; none
Cc: linux-mips@linux-mips.org
In-reply-to: <4E9470A1.8020309@cavium.com>
References: <loom.20111010T215444-70@post.gmane.org> <4E9470A1.8020309@cavium.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 1.5.0.12 (X11/20090114)
David Daney wrote:

> No, it does nothing of the sort.  You need cacheflush() for that.

OK, I looked at cacheflush and it can be used to flush the icache on all
CPUs, which is what I want.  My current code sequence is more than that
however.  Something like this:

        CVMX_ICACHE_INVALIDATE;
        CVMX_SYNC;
        uint64_t tmp;
        asm volatile ("    la %0,10f\n"
                  "    jr.hb %0\n"
                  "    nop\n"
                  "    10:\n" : "=r" (tmp) : : "memory");

I can certainly modify cacheflush for my application so the extra hazard
clearing is done when icache is flushed.  Is there any way to avoid that
and use existing kernel functionality?

Joe Buehler

<Prev in Thread] Current Thread [Next in Thread>