From: "Uros Bizjak" <ubizjak@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH, x86]: Implement change_bit with immediate operand as "lock xorb"
Date: Fri, 24 Oct 2008 16:53:33 +0200 [thread overview]
Message-ID: <5787cf470810240753wdf1fd9co14dbd25ae6ff439c@mail.gmail.com> (raw)
In-Reply-To: <5787cf470810240501j3522e8c8ld9a8498ff1bfef21@mail.gmail.com>
[-- 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));
+ }
}
/**
next prev parent reply other threads:[~2008-10-24 14:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-24 12:01 Uros Bizjak
2008-10-24 14:53 ` Uros Bizjak [this message]
2008-10-25 9:26 ` Uros Bizjak
2008-10-24 19:11 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5787cf470810240753wdf1fd9co14dbd25ae6ff439c@mail.gmail.com \
--to=ubizjak@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®