Blame view

kernel/linux-rt-4.4.41/arch/m32r/include/asm/switch_to.h 1.48 KB
5113f6f70   김현기   kernel add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
  /*
   * This file is subject to the terms and conditions of the GNU General Public
   * License.  See the file "COPYING" in the main directory of this archive
   * for more details.
   *
   * Copyright (C) 2001  Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto
   * Copyright (C) 2004, 2006  Hirokazu Takata <takata at linux-m32r.org>
   */
  #ifndef _ASM_M32R_SWITCH_TO_H
  #define _ASM_M32R_SWITCH_TO_H
  
  /*
   * switch_to(prev, next) should switch from task `prev' to `next'
   * `prev' will never be the same as `next'.
   *
   * `next' and `prev' should be struct task_struct, but it isn't always defined
   */
  
  #if defined(CONFIG_FRAME_POINTER) || \
  	!defined(CONFIG_SCHED_OMIT_FRAME_POINTER)
  #define M32R_PUSH_FP "	push fp
  "
  #define M32R_POP_FP  "	pop  fp
  "
  #else
  #define M32R_PUSH_FP ""
  #define M32R_POP_FP  ""
  #endif
  
  #define switch_to(prev, next, last)  do { \
  	__asm__ __volatile__ ( \
  		"	seth	lr, #high(1f)				
  " \
  		"	or3	lr, lr, #low(1f)			
  " \
  		"	st	lr, @%4  ; store old LR			
  " \
  		"	ld	lr, @%5  ; load new LR			
  " \
  			M32R_PUSH_FP \
  		"	st	sp, @%2  ; store old SP			
  " \
  		"	ld	sp, @%3  ; load new SP			
  " \
  		"	push	%1  ; store `prev' on new stack		
  " \
  		"	jmp	lr					
  " \
  		"	.fillinsn					
  " \
  		"1:							
  " \
  		"	pop	%0  ; restore `__last' from new stack	
  " \
  			M32R_POP_FP \
  		: "=r" (last) \
  		: "0" (prev), \
  		  "r" (&(prev->thread.sp)), "r" (&(next->thread.sp)), \
  		  "r" (&(prev->thread.lr)), "r" (&(next->thread.lr)) \
  		: "memory", "lr" \
  	); \
  } while(0)
  
  #endif /* _ASM_M32R_SWITCH_TO_H */