参照元†
- 現在実行中のタスクの情報を返す。
- ARM アーキテクチャではスーパバイザモード専用のレジスタバンクを使用し、
モード切り替え時に自動的にレジスタバンクが切り替わるため、
このため、ユーザモード(ユーザプロセス内コード実行時)と、
スーパバイザモード(カーネル内コード実行時)のスタックは独立している。
- スイッチされるのは sp, lr レジスタのみ。他は共通。
返り値†
- struct thread_info を配置する場所と、
カーネルスタックとの関連は下記を参照のこと。
/*
* 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");
- sp レジスタを unsigned long の変数として扱う
return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
- スタックポインタの現在値を、
カーネルスタックサイズ以下のビットを 0 でクリアした値を返す。
}
コメント†