Results 1 to 2 of 2
Hi,
I'm running a 2.6.2.14-72.fc6 i586 kernel and I'm tring to figure out how it calculates the the current value in a kernel module. I took a objdump of a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-12-2009 #1
current macro
Hi,
I'm running a 2.6.2.14-72.fc6 i586 kernel and I'm tring to figure out how it calculates the the current value in a kernel module. I took a objdump of a kernel module with the current marco and it produced this:
and checking the %eax register I found it contained the current value but this is no help since I don't know what or how 0x0 (from %fs:0x0) is calculatedCode:mov %fs:0x0, %eax mov %eax, 0xc
The only info I have on the current macro is from an old book and it states that the current value is arrived at by masking the %esp register with 0xffffe000 but an example of the values I get from my kernel module are:
current->0xc3608600
esp------>0xc2ef2e94
which doesn't compute...Thanks Gerard4143
- 02-13-2009 #2
Found the answer
Found the answer at this web page:
http://kernelnewbis.org/faq/current
essentially the struct task_struct is now included in a struct thread_info that resides at the bottom of the user kernel stack and my code for accessing it
Code:struct thread_info *myti = 0; void somefunc(void) { __asm__ __volatile__ ( "pushl %eax\n\t" "movl %esp, %eax\n\t" "andl $0xfffff000, %eax\n\t" "movl %eax, myti\n\t" "popl %eax\n\t" ) printk("myti->task->pid->%d\n", myti->task->pid); }


Reply With Quote
