Может кто-нибудь, пожалуйста, объясните мне этот фрагмент кода здесь, взятый из ядра linux?
/*
* how to get the thread information struct from C
*/
static inline struct thread_info *current_thread_info(void) __attribute_const__;
static inline struct thread_info *current_thread_info(void)
{
register unsigned long sp asm ("sp");
return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
}
Вопросы:
- что такое
__attribute_const__
? - что это делает
register unsigned long sp asm ("sp");
- почему
(struct thread_info *)(sp & ~(THREAD_SIZE - 1));
возвращает указатель на структуру?