#ifndef _I386_CURRENT_H
#define _I386_CURRENT_H
struct task_struct;
static inline struct task_struct * get_current(void)
{
struct task_struct *current;
__asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
return current;
}
#define current get_current()
#endif /* !(_I386_CURRENT_H) */
|
8192UL=2^13 0000 0000 0000 0000 0010 0000 0000 0000
8191UL 0000 0000 0000 0000 0001 1111 1111 1111
~8191UL(
反码
) 1111 1111 1111 1111 1110 0000 0000 0000
0xc2343ffe 1100 0010 0011 0100 0011 1111 1111 1110
andl
结果:
1100 0010 0011 0100 0010 0000 0000 0000
|| (
对照着看
)
0xc 2 3 4 2 0 0 0
|
#define GET_CURRENT /
"movl %esp, %ebx/n/t" /
"andl $-8192, %ebx/n/t"
|