I have a couple of functions in my DKM Project (Kernel Space) which needs to be called from RTP (User Space). How do I do that?
I have implemented custom system calls to call the kernel only APIs from RTP, but here I am not able to implement custom system calls for those functions in DKM because it is not part of Source build Project.
How do I go about this problem? Any help is highly appreciated. Thanks!!
Custom system calls is the answer. I know you said you can't use that, but just hold on.
There are two methods for adding system calls. The first, which it sounds like you have already used before, is to statically add them, as part of the VxWorks Source Build. These allow you to access functions in exactly the same way as any other part of the user libraries, eg, in your RTP:
#include <customSysCallHeader.h>
void foo()
{
customSysCall();
}
As you say however, this does require modification to the source build. Having said that, this is less an issue in VxWorks 7 than previously.
The second option, which is more useful if you do not want to add to the source build, is to use dynamic system calls. These are dynamically registered at runtime, by some kernel code. They are not as easy to use from the application however, as all dynamic system calls must be called via syscall()
:
#include <syscall.h> //This may not be correct
void foo()
{
syscall(CUSTOM_SYSCALL_NUM,1,2,3,4,5,6);
}
I have found it useful to place calls to these dynamic system calls in a separate library, and wrap with useful function names.