lkml.org 
[lkml]   [2003]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    SubjectRe: [PATCH] Fix do_div() for all architectures
    Date
    On Thursday 10 July 2003 17:40, Richard Henderson wrote:
    > On Tue, Jul 08, 2003 at 08:27:26PM +0200, Bernardo Innocenti wrote:
    > > +extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor)
    > > __attribute_pure__;
    >
    > ...
    >
    > > + __rem = __div64_32(&(n), __base); \
    >
    > The pure declaration is very incorrect. You're writing to N.

    Here comes the obvious fix. Mea culpa, mea culpa, mea maxima culpa!

    NOTE: I've intentionally left the __attribute_pure__ definition in
    linux/compiler.h since it might apply to many other functions.


    Linus, please apply and forgive me for getting this simple patch wrong
    so many times in a row.

    -------------------------------------------------------------------------

    - remove incorrect __attribute_pure__ from __div64_32() since it obviously
    clobbers memory through &(n);


    diff -Nru linux-2.5.74-bk4.orig/include/asm-generic/div64.h linux-2.5.74-bk4/include/asm-generic/div64.h
    --- linux-2.5.74-bk4.orig/include/asm-generic/div64.h 2003-07-11 01:00:44.000000000 +0200
    +++ linux-2.5.74-bk4/include/asm-generic/div64.h 2003-07-11 00:59:52.000000000 +0200
    @@ -32,7 +32,7 @@

    #elif BITS_PER_LONG == 32

    -extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor) __attribute_pure__;
    +extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);

    # define do_div(n,base) ({ \
    uint32_t __base = (base); \
    --
    // Bernardo Innocenti - Develer S.r.l., R&D dept.
    \X/ http://www.develer.com/
    Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html


    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:46    [W:0.021 / U:26.912 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site