Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
switch_to.h File Reference

Go to the source code of this file.

Macros

#define SAVE_CONTEXT   "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t"
 
#define RESTORE_CONTEXT   "movq %%rbp,%%rsi ; popq %%rbp ; popf\t"
 
#define __EXTRA_CLOBBER
 
#define __switch_canary
 
#define __switch_canary_oparam
 
#define __switch_canary_iparam
 
#define switch_to(prev, next, last)
 

Functions

struct task_struct__switch_to (struct task_struct *prev, struct task_struct *next)
 
void __switch_to_xtra (struct task_struct *prev_p, struct task_struct *next_p, struct tss_struct *tss)
 

Macro Definition Documentation

#define __EXTRA_CLOBBER
Value:
, "rcx", "rbx", "rdx", "r8", "r9", "r10", "r11", \
"r12", "r13", "r14", "r15"

Definition at line 85 of file switch_to.h.

#define __switch_canary

Definition at line 98 of file switch_to.h.

#define __switch_canary_iparam

Definition at line 100 of file switch_to.h.

#define __switch_canary_oparam

Definition at line 99 of file switch_to.h.

#define RESTORE_CONTEXT   "movq %%rbp,%%rsi ; popq %%rbp ; popf\t"

Definition at line 83 of file switch_to.h.

#define SAVE_CONTEXT   "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t"

Definition at line 82 of file switch_to.h.

#define switch_to (   prev,
  next,
  last 
)
Value:
asm volatile(SAVE_CONTEXT \
"movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \
"movq %P[threadrsp](%[next]),%%rsp\n\t" /* restore RSP */ \
"call __switch_to\n\t" \
"movq "__percpu_arg([current_task])",%%rsi\n\t" \
__switch_canary \
"movq %P[thread_info](%%rsi),%%r8\n\t" \
"movq %%rax,%%rdi\n\t" \
"testl %[_tif_fork],%P[ti_flags](%%r8)\n\t" \
"jnz ret_from_fork\n\t" \
RESTORE_CONTEXT \
: "=a" (last) \
: [next] "S" (next), [prev] "D" (prev), \
[threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \
[ti_flags] "i" (offsetof(struct thread_info, flags)), \
[_tif_fork] "i" (_TIF_FORK), \
[thread_info] "i" (offsetof(struct task_struct, stack)), \
[current_task] "m" (current_task) \
__switch_canary_iparam \
: "memory", "cc" __EXTRA_CLOBBER)

Definition at line 104 of file switch_to.h.

Function Documentation

struct task_struct* __switch_to ( struct task_struct prev,
struct task_struct next 
)
read

Definition at line 297 of file process.c.

void __switch_to_xtra ( struct task_struct prev_p,
struct task_struct next_p,
struct tss_struct tss 
)

Definition at line 221 of file process.c.