linux-2.6.20/drivers/kvm/kvm_main.c_2
■デバイス操作
□デバイスのオープン
次に示すkvm構造体の初期化を行う。
※kvm.hにて定義
#define KVM_MAX_VCPUS 1
#define KVM_MEMORY_SLOTS 4
#define KVM_NUM_MMU_PAGES 256
struct kvm {
spinlock_t lock; /* protects everything except vcpus */
int nmemslots;
struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS];
* Hash table of struct kvm_mmu_page.
*/
struct list_head active_mmu_pages;
int n_free_mmu_pages;
struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES];
struct kvm_vcpu vcpus[KVM_MAX_VCPUS];
int busy;
unsigned long rmap_overflow;
};
関数ツリーを示す。
kvm_dev_open [kvm_main.c]
(引数)
struct inode *inode:inodeポインタ
struct file *filp:ファイルポインタ
├kzalloc
├INIT_LIST_HEAD
デバイスリリース処理へ
□デバイスのオープン
次に示すkvm構造体の初期化を行う。
※kvm.hにて定義
#define KVM_MAX_VCPUS 1
#define KVM_MEMORY_SLOTS 4
#define KVM_NUM_MMU_PAGES 256
struct kvm {
spinlock_t lock; /* protects everything except vcpus */
int nmemslots;
struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS];
- VMのメモリスロット毎の情報(現在は4)
* Hash table of struct kvm_mmu_page.
*/
struct list_head active_mmu_pages;
int n_free_mmu_pages;
struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES];
struct kvm_vcpu vcpus[KVM_MAX_VCPUS];
- VMのVCPU毎の情報(現在は1)
int busy;
unsigned long rmap_overflow;
};
関数ツリーを示す。
kvm_dev_open [kvm_main.c]
(引数)
struct inode *inode:inodeポインタ
struct file *filp:ファイルポインタ
├kzalloc
- kvm構造体領域の獲得
├INIT_LIST_HEAD
- kvm構造体のリスト(active_mmu_pages)の初期化
- kvm_vcpu構造体の初期化
- 初期化したkvm構造体のポインタはファイルポインタのprivate_data領域へ設定
デバイスリリース処理へ
2007年03月04日(日) 18:28:31 Modified by deku_nobo