为什么我在内核中无法调用数学函数
总是提示无法找到该函数(sin,sqrt...都不行)
system:debianlinux
下面是我的makefile文件linux makefilelinux基础教程,和源代码
//
/*********Makefile**********/
obj-m:=helloworld.o
KDIR:=/lib/modules/$(shelluname-r)/build
PWD:=$(shellpwd)
EXTRA_CFLAGS:=-I/usr/include/-ffast-math-mhard-float-lm
default:
$(MAKE)-C$(KDIR)SUBDIRS=$(PWD)modules
clean:
rm-rf.*.cmd*.o*.mod.c*.ko.tmp_version
/*********hello.c**********/
#include
#include
#include
#include
MODULE_LICENSE("GPL");
staticinthello_init(void){
unsignedintcr3;
doubles=3;
__asm__("movl%%cr3,%0":"=a"(cr3));
printk(KERN_ALERT"Hello,worldn");
printk(KERN_ALERT"Theprocessis"%s"(pid%i)n",current->comm,current->pid);
printk(KERN_ALERT"Thecr3registeris"X"n",cr3);
//testmathfunction
s=sin(s);
return0;
}
staticvoidhello_exit(void){
printk(KERN_ALERT"Goodbye,cruelworldn");
}
module_init(hello_init);
module_exit(hello_exit);
|
seechapter3.3.4ofULK3
|
你的math.h是C库提供的,它在用户空间linux 调用内核函数linux 调用内核函数,而不在内核空间。
|
understandlinuxkernel3rdedition
|
sourcecodestaticlinkwhenuarecompling