Hello great kernel hackers!
I humbly set before you my meager questions:
1) What does spin_lock_string do in 2.2 (for SMP kernels)? It's:
#define spin_lock_string \
"\n1:\t" \
"lock ; btsl $0,%0\n\t" \
"jc 2f\n" \
".section .text.lock,\"ax\"\n" \
"2:\t" \
"testb $1,%0\n\t" \
"jne 2b\n\t" \
"jmp 1b\n" \
".previous"
I've stared at it for at least an hour, and I am apparently unable to
make coherent sense out of it.. It *looks* like an infinite loop, but it
can't be? I'm so stupid, though, I'm not sure what btsl does, and the as
info page doesn't talk about arch-specific instructions, eep.
2) Okay, this is an even sillier question.
#define spin_lock_init(x) do { (x)->lock = 0; } while(0)
How come a do-while loop (or, erm, in this case, a
non-loop?) used? My professor thinks that it's to prevent spin_lock_init
from being used in expressions in which order of operations could mess
things up, but if so, wouldn't { (x)->lock = 0; } also do the trick?
Thanks so much!
-Brett
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:27 EST