* [PATCH, x86]: Implement change_bit with immediate operand as "lock xorb"
@ 2008-10-24 12:01 Uros Bizjak
2008-10-24 14:53 ` Uros Bizjak
2008-10-24 19:11 ` H. Peter Anvin
0 siblings, 2 replies; 4+ messages in thread
From: Uros Bizjak @ 2008-10-24 12:01 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 162 bytes --]
Hello!
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.
Uros.
[-- Attachment #2: bitops.diff.txt --]
[-- Type: text/plain, Size: 496 bytes --]
--- 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));
+ }
}
/**
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH, x86]: Implement change_bit with immediate operand as "lock xorb"
2008-10-24 12:01 [PATCH, x86]: Implement change_bit with immediate operand as "lock xorb" Uros Bizjak
@ 2008-10-24 14:53 ` Uros Bizjak
2008-10-25 9:26 ` Uros Bizjak
2008-10-24 19:11 ` H. Peter Anvin
1 sibling, 1 reply; 4+ messages in thread
From: Uros Bizjak @ 2008-10-24 14:53 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 309 bytes --]
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.
[-- Attachment #2: bitops.diff.txt --]
[-- Type: text/plain, Size: 496 bytes --]
--- 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));
+ }
}
/**
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH, x86]: Implement change_bit with immediate operand as "lock xorb"
2008-10-24 12:01 [PATCH, x86]: Implement change_bit with immediate operand as "lock xorb" Uros Bizjak
2008-10-24 14:53 ` Uros Bizjak
@ 2008-10-24 19:11 ` H. Peter Anvin
1 sibling, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2008-10-24 19:11 UTC (permalink / raw)
To: Uros Bizjak; +Cc: Linux Kernel Mailing List
Uros Bizjak wrote:
> Hello!
>
> 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.
>
Looks good, but please resubmit your patch with a Signed-off-by: line
and Cc: x86@kernel.org on the submission.
Thanks!
-hpa
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH, x86]: Implement change_bit with immediate operand as "lock xorb"
2008-10-24 14:53 ` Uros Bizjak
@ 2008-10-25 9:26 ` Uros Bizjak
0 siblings, 0 replies; 4+ messages in thread
From: Uros Bizjak @ 2008-10-25 9:26 UTC (permalink / raw)
To: linux-kernel; +Cc: x86, H. Peter Anvin
[-- Attachment #1: Type: text/plain, Size: 322 bytes --]
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 and added CC.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Uros.
[-- Attachment #2: bitops.diff.txt --]
[-- Type: text/plain, Size: 496 bytes --]
--- 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));
+ }
}
/**
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-10-25 9:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-24 12:01 [PATCH, x86]: Implement change_bit with immediate operand as "lock xorb" Uros Bizjak
2008-10-24 14:53 ` Uros Bizjak
2008-10-25 9:26 ` Uros Bizjak
2008-10-24 19:11 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).