lkml.org 
[lkml]   [2008]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC patch 23/27] Immediate Values - Powerpc Optimization NMI MCE support
    Mathieu Desnoyers writes:

    > * Paul Mackerras (paulus@samba.org) wrote:
    > > Mathieu Desnoyers writes:
    > >
    > > > Use an atomic update for immediate values.
    > >
    > > What is meant by an "atomic" update in this context? AFAICS you are
    > > using memcpy, which is not in any way guaranteed to be atomic.
    > >
    > > Paul.
    >
    > I expect memcpy to perform the copy in one memory access, given I put a
    >
    > .align 2
    >
    > before the 2 bytes instruction. It makes sure the instruction modified
    > fits in a single, aligned, memory write.

    My original question was in the context of the powerpc architecture,
    where instructions are always 4 bytes long and aligned. So that's not
    an issue.

    > Or maybe am I expecting too much from memcpy ?

    I don't think memcpy gives you any such guarantees. It would be quite
    within its rights to say "it's only a few bytes, I'll do it byte by
    byte".

    If you really want it to be atomic (which I agree is probably a good
    idea), I think the best way to do it is to use an asm to generate a
    sth (store halfword) instruction to the immediate field (instruction
    address + 2). That's on powerpc of course; I don't know what you
    would do on other architectures.

    Paul.


    \
     
     \ /
      Last update: 2008-04-17 02:37    [W:0.023 / U:0.448 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site