Hi,
I have a beginner problem, but I can not answer and can not find it :roll:
I want to use a kernel function, one of its values is the memory address As a result, I wrote an in the user-mode program to print a variable's address. Something like this:
I have a beginner problem, but I can not answer and can not find it :roll:
I want to use a kernel function, one of its values is the memory address As a result, I wrote an in the user-mode program to print a variable's address. Something like this:
Code: Select all
And I used the kernel function this way:
int main()
{
while(1)
{
printf("%x", &a);
}
return 0;
}
Code: Select all
Now how does the output of the user-mode application that contains the variable address is entered as a parameter(addr) to the access_ok function like this?#include <linux/module.h>
#include <linux/kernel.h>
int hello_init (void)
{
int result = access_ok( VERIFY_WRITE, [color=#FF0000]addr[/color], 10);
printk ("Hello, result = %d\n", result );
return 0;
}
void hello_exit (void)
{
printk ("Goodbye");
}
module_init(hello_init);
module_exit(hello_exit);