Hi,
I've been trying to open /dev/mem with a kernel function.
I followed this
link, and here is how my code looks like:
Code:
voide test(void)
{
struct file *fp;
fp = filp_open("/dev/mem", O_RDONLY, 0);
filp_close(fp, 0);
}
This test() function is put into linux/init/main.c
I can build bzImage without a problem, however, everytime I tried to do
in gdb, I get the following error:
Code:
sleeping function called from invalid context at include/asm/semaphore.h:119
in_atomic():1, irqs_disabled():1
[<c01081aa>] dump_stack+0x1e/0x22
[<c0121d64>] __might_slep+0xb2/0xd3
...
kernel BUG at fs/buffer.c:1436!
invalid operand: 0000 [#1]
PREEMPT SMP DEBUG_PAGEALLOC
Did I do anything wrong or missing something?
Any help would be greatly appreciatd,
James