linux_Freax 2015-11-14 08:03 采纳率: 0%
浏览 1511

how current marco works in IA32

When I brose the code in Linux kernel 2.6.24, I find this.

 static __always_inline struct task_struct *get_current(void)
{
        return x86_read_percpu(current_task);
}

When I am looking for x86_read_percpue, It looks like this.

 #define x86_read_percpu(var) percpu_from_op("mov", per_cpu__##var)

But it seems like this.

 #define percpu_from_op(op,var)                                  \
        ({                                                      \
                typeof(var) ret__;                              \
                switch (sizeof(var)) {                          \
                case 1:                                         \
                        asm(op "b "__percpu_seg"%1,%0"          \
                            : "=r" (ret__)                      \
                            : "m" (var));                       \
                        break;                                  \
                case 2:                                         \
                        asm(op "w "__percpu_seg"%1,%0"          \
                            : "=r" (ret__)                      \
                            : "m" (var));                       \
                        break;                                  \
                case 4:                                         \
                        asm(op "l "__percpu_seg"%1,%0"          \
                            : "=r" (ret__)                      \
                            : "m" (var));                       \
                        break;                                  \
                default: __bad_percpu_size();                   \
                }                                               \
                ret__; })

I can't find per_cpu_current_task in source code!!!!!!!

  • 写回答

1条回答 默认 最新

  • Robot-C 2015-11-14 08:11
    关注

    This had me beating my head against the wall for days. Now as you know, It is fairly straightforward to open an SDL surface in a window:
    SDL_Surface *screen = SDL_SetVideoMode(width, height, 24, SDL_......
    答案就在这里:How to make an SDL window the child of another window in Win32
    ----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。

    评论

报告相同问题?