lkml.org 
[lkml]   [2008]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH, x86]: Implement change_bit with immediate operand as "lock xorb"
On Fri, Oct 24, 2008 at 2:01 PM, Uros Bizjak <ubizjak@gmail.com> wrote:

> Implement change_bit with immediate bit count as "lock xorb". This is
> similar to "lock orb" and "lock andb" for set_bit and clear_bit
> functions.

Forgot Signed-off-by line.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>

Uros.
--- bitops.h~ 2008-10-22 23:38:01.000000000 +0200
+++ bitops.h 2008-10-24 12:57:14.000000000 +0200
@@ -168,7 +168,15 @@
*/
static inline void change_bit(int nr, volatile unsigned long *addr)
{
- asm volatile(LOCK_PREFIX "btc %1,%0" : ADDR : "Ir" (nr));
+ if (IS_IMMEDIATE(nr)) {
+ asm volatile(LOCK_PREFIX "xorb %1,%0"
+ : CONST_MASK_ADDR(nr, addr)
+ : "iq" ((u8)CONST_MASK(nr)));
+ } else {
+ asm volatile(LOCK_PREFIX "btc %1,%0"
+ : BITOP_ADDR(addr)
+ : "Ir" (nr));
+ }
}

/**
\
 
 \ /
  Last update: 2008-10-24 16:55    [W:0.040 / U:0.840 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site