スタックポインタが 0x87650987 で、
THREAD_INFO = 8192 の場合
0x00000000 ----> |----------|
|**********|
====(略)====
|**********|
0x87650000 ----> |----------| <- カーネルスタックの末尾
| thread_ |
| info |
|----------|
| |
| |
stack_pointer -> |----------| <- カーネルスタックは↑に成長する
| 使用中 |
| カーネル |
| スタック |
| 領域 |
| |
0x87651fff ----> |----------| <- カーネルスタックの先頭
|**********|
====(略)====
|**********|
0xffffffff ----> |----------|/* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void)
{
return (struct thread_info *)
(current_stack_pointer & ~(THREAD_SIZE - 1));
THREAD_SIZE : 8192 = 0000 0000 0000 0000 0010 0000 0000 0000 THREAD_SIZE - 1 : 8191 = 0000 0000 0000 0000 0001 1111 1111 1111 ~(THREAD_SIZE - 1): = 1111 1111 1111 1111 1110 0000 0000 0000
}