
Linux Kernel Development (Developer's Library)
- 作者: Robert Love
- 出版社/メーカー: Addison-Wesley Professional
- 発売日: 2010/06/22
- メディア: ペーパーバック
- 購入: 3人 クリック: 62回
- この商品を含むブログ (9件) を見る
Parameter Passing
In addition to the systemcall number, most syscalls require that one or more parameters be passed to them. Somehow, user-space must relay the parameters to the kernel during the trap. The easiest way to do this is via the same means that the syscall number is passed: The parameters are stored in registers. On x86-32, the registers ebx, ecx, edx, esi, and edi contain in order, the first five arguments. In the unlikely case of six or more arguments, a single register is used to hold a pointer to user-space where all the parameters are stored.
The return value is sent to user-space also via register. On x86, it is written into the eax register.
やはり、システムコールの際のユーザ空間とカーネル空間のパラメータの受け渡しにはレジスタが使われるのか。
追記(2011/09/14):

- 作者: 高橋浩和,小田逸郎,山幡為佐久
- 出版社/メーカー: ソフトバンククリエイティブ
- 発売日: 2006/11/18
- メディア: 単行本
- 購入: 14人 クリック: 197回
- この商品を含むブログ (118件) を見る
あたりを読んでいて気付いたこと。
システムコールを発行すると、コンテキストスイッチが発生してカーネルスレッドが処理するのかと思っていたけど、CPU が特権モードに移行し、使用するスタックが切り替わるみたい。