본문 바로가기

Studying!!/공부를하자

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


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);

'Studying!! > 공부를하자' 카테고리의 다른 글

Linux Scheduler 분석  (0) 2008.11.17
어셈블리 strcmp_length strcmp_byte 구현  (0) 2008.10.17
Code Optimizing  (0) 2008.10.15
어셈블리 GCD  (0) 2008.10.07
VI 명령어 모음  (0) 2007.03.17