lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 6 Dec 2006 11:24:58 -0800 (PST)
From:	Christoph Lameter <clameter@....com>
To:	David Howells <dhowells@...hat.com>
cc:	torvalds@...l.org, akpm@...l.org,
	linux-arm-kernel@...ts.arm.linux.org.uk,
	linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Subject: Re: [PATCH] WorkStruct: Implement generic UP cmpxchg() where an arch
 doesn't support it [try #2]

Have a look at arch/i386/kernel/cpu/intel.c. You can probably replace my 
code that simulates cmpxchg for 386s

arch/i386/kernel/cpu/intel.c:

#ifndef CONFIG_X86_CMPXCHG
unsigned long cmpxchg_386_u8(volatile void *ptr, u8 old, u8 new)
{
        u8 prev;
        unsigned long flags;

        /* Poor man's cmpxchg for 386. Unsuitable for SMP */
        local_irq_save(flags);
        prev = *(u8 *)ptr;
        if (prev == old)
                *(u8 *)ptr = new;
        local_irq_restore(flags);
        return prev;
}
EXPORT_SYMBOL(cmpxchg_386_u8);

unsigned long cmpxchg_386_u16(volatile void *ptr, u16 old, u16 new)
{
        u16 prev;
        unsigned long flags;

        /* Poor man's cmpxchg for 386. Unsuitable for SMP */
        local_irq_save(flags);
        prev = *(u16 *)ptr;
        if (prev == old)
                *(u16 *)ptr = new;
        local_irq_restore(flags);
        return prev;
}
EXPORT_SYMBOL(cmpxchg_386_u16);

unsigned long cmpxchg_386_u32(volatile void *ptr, u32 old, u32 new)
{
        u32 prev;
        unsigned long flags;

        /* Poor man's cmpxchg for 386. Unsuitable for SMP */
        local_irq_save(flags);
        prev = *(u32 *)ptr;
        if (prev == old)
                *(u32 *)ptr = new;
        local_irq_restore(flags);
        return prev;
}
EXPORT_SYMBOL(cmpxchg_386_u32);
#endif


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ