c - Using Kernel Modules Functions in a Custom System Call - Undefined Reference Error -


i'm beginner c , linux developer i'm sorry if sounds confusing.

i managed create simple system call updating syscall_64.tbl, adding asmlinkage method definition syscalls.h, adding folder main makefile , creating makefile has 1 line:

obj-y := syscall.o 

no problems until this, compiled linux source code , worked. want build more advanced system call. added function vmx.c(which in arch/x86/kvm):

void myfunction(void){ //some code } export_symbol(myfunction); 

and defined in vmx.h(it in arch/x86/include/asm):

void myfunction(void); 

now problem begins. included vmx.h syscall.c file , called function. i'm getting "undefined reference myfunction" when try compile linux source code. doing wrong? syscall.c:

#include <linux/kernel.h> #include <linux/syscalls.h> #include <asm/vmx.h>  asmlinkage long sys_customsyscall(const char *test) {    printk(kern_alert "test: %s,\n", test);    myfunction();    return 0; } 

after things had done, next thing need considered if using function in vmx.c, in linux/arch/x86/kvm/makefile can see this

kvm-intel-y             += vmx.o pmu_intel.o 

so while compiling make sure, using intel's configuration , not amd, otherwise not compile along source! if amd can define inside svm.c.

with that, make sure virtualization enabled, in make menuconfig virtualization

also function prototype, definition/ declaration should not falling under #ifdef or similar, until sure block.

and check in vmx.h, added extern keyword, while defining.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -