Studying!!/공부를하자

CPU 정보를 보여주는 모듈만들기

ashch 2008. 9. 26. 15:16

cpuinfo_x86 구조체를 c라는 포인터 변수로 선언하고 cpu_data라는 전역변수로 선언되어 있어서

 

struct cpuinfo_x86 *c=cpu_data;

 

라는 명령으로 구조체를 데이터를 넘긴다.

그리고 module_init에 이 구조체중 Vender id, Model id, Cache size가 저장되어 있는 구조체의 변수 x86_vender_id, x86_model_id, x86_cache_size를 화면에 출력할 수 있는 간단한 출력함수를 만든다.

 

printk(KERN_ALERT "[APP Message] Vendor id : %s \n" "[APP Message] Model id : %s \n"

        "[APP Message] Cache size : %d \n"

        , c->x86_vendor_id,  c->x86_model_id, c->x86_cache_size);