Question about assembly in set bit function for x86 architecture
Alexander Kuleshov
kuleshovmail at gmail.com
Mon Apr 20 04:05:47 EDT 2015
2015-04-20 5:11 GMT+06:00 Anuz Pratap Singh Tomar <chambilkethakur at gmail.com>:
>
>
> On Mon, Apr 20, 2015 at 12:08 AM, Nicholas Krause <xerofoify at gmail.com>
> wrote:
>>
>>
>>
>> On April 19, 2015 5:13:20 PM EDT, Anuz Pratap Singh Tomar
>> <chambilkethakur at gmail.com> wrote:
>> >On Sun, Apr 19, 2015 at 9:51 PM, nick <xerofoify at gmail.com> wrote:
>> >
>> >> Greetings All,
>> >> I am wondering what the below code in the asm modifier does:
>> >> static inline void set_bit(int nr, void *addr)
>> >> {
>> >> asm("btsl %1,%0" : "+m" (*(u32 *)addr) : "Ir" (nr));
>> >> }
>> >> This would be very helpful as I am new to x86 assembly and don't
>> >> even known what register(s)/instruction(s) this touches and therefore
>> >this
>> >> is impossible for me to look up in the Intel Manuals. If someone
>> >either
>> >> tells me the registers/instructions this uses or explains the code
>> >that
>> >> would be very helpful.
>> >> Nick
What's the problem to read it in the intel manual or just to use
google [https://www.google.com/search?channel=fs&q=btsl+instruction&ie=utf-8&oe=utf-8]
which will give you answer with first link instead of spend time of
community for such questions?
>> 95 percent of the kernel is written in C
This is true. But kernel is big, and are you really sure that somebody
will want to expain you rest of 5% of the
kernel? I am not sure about it.
Yes kernel is big and complex. It contains many tricks which even hard
to find explanation in the interntet. But,
if you want to read/develop kernel, you need learning to learn, but
not just ask. It's important.
Heed the advice of Anuz, he gave the perfect advice.
More information about the Kernelnewbies
mailing list