From c563502b12aee22e09f565928124d21b5e2f01c3 Mon Sep 17 00:00:00 2001 From: gatieme Date: Tue, 31 May 2016 12:05:02 +0800 Subject: [PATCH] ... --- study/driver/hello/hello.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/study/driver/hello/hello.c b/study/driver/hello/hello.c index c15ffee..2dcb60c 100644 --- a/study/driver/hello/hello.c +++ b/study/driver/hello/hello.c @@ -1,12 +1,13 @@ #include - +#include MODULE_LICENSE("Dual BSD/GPL"); - -static int hello_init(void) +/* + * print the module information + */ +static void print_module(void) { - unsigned int cpu = get_cpu(); struct module *mod; printk(KERN_ALERT "this module: %p==%p\n", &__this_module, THIS_MODULE); @@ -15,14 +16,26 @@ static int hello_init(void) list_for_each_entry(mod, *(&THIS_MODULE->list.prev), list); printk(KERN_ALERT "module name: %s\n", mod->name); + printk(KERN_ALERT "module state: %d\n", THIS_MODULE->state); +} + + +static int hello_init(void) +{ + print_module( ); + + printk(KERN_ALERT "run in cpu %d\n", get_cpu()); + + printk(KERN_ALERT "PAGE_OFFSET : 0x%lx, TASK_SIZE : 0x%lx", PAGE_OFFSET, TASK_SIZE); + return 0; } + static void hello_exit(void) { - printk(KERN_ALERT "module state: %d\n", THIS_MODULE->state); }