I'm running a 220.127.116.11-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 calculated
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:
which doesn't compute...Thanks Gerard4143
Found the answer
Found the answer at this web page:
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
struct thread_info *myti = 0;
"movl %esp, %eax\n\t"
"andl $0xfffff000, %eax\n\t"
"movl %eax, myti\n\t"