Blame view

kernel/linux-rt-4.4.41/arch/xtensa/include/asm/traps.h 1.43 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  /*
   * arch/xtensa/include/asm/traps.h
   *
   * 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) 2012 Tensilica Inc.
   */
  #ifndef _XTENSA_TRAPS_H
  #define _XTENSA_TRAPS_H
  
  #include <asm/ptrace.h>
  
  /*
   * handler must be either of the following:
   *  void (*)(struct pt_regs *regs);
   *  void (*)(struct pt_regs *regs, unsigned long exccause);
   */
  extern void * __init trap_set_handler(int cause, void *handler);
  extern void do_unhandled(struct pt_regs *regs, unsigned long exccause);
  void secondary_trap_init(void);
  
  static inline void spill_registers(void)
  {
  #if XCHAL_NUM_AREGS > 16
  	__asm__ __volatile__ (
  		"	call8	1f
  "
  		"	_j	2f
  "
  		"	retw
  "
  		"	.align	4
  "
  		"1:
  "
  #if XCHAL_NUM_AREGS == 32
  		"	_entry	a1, 32
  "
  		"	addi	a8, a0, 3
  "
  		"	_entry	a1, 16
  "
  		"	mov	a12, a12
  "
  		"	retw
  "
  #else
  		"	_entry	a1, 48
  "
  		"	call12	1f
  "
  		"	retw
  "
  		"	.align	4
  "
  		"1:
  "
  		"	.rept	(" __stringify(XCHAL_NUM_AREGS) " - 16) / 12
  "
  		"	_entry	a1, 48
  "
  		"	mov	a12, a0
  "
  		"	.endr
  "
  		"	_entry	a1, 16
  "
  #if XCHAL_NUM_AREGS % 12 == 0
  		"	mov	a12, a12
  "
  #elif XCHAL_NUM_AREGS % 12 == 4
  		"	mov	a4, a4
  "
  #elif XCHAL_NUM_AREGS % 12 == 8
  		"	mov	a8, a8
  "
  #endif
  		"	retw
  "
  #endif
  		"2:
  "
  		: : : "a8", "a9", "memory");
  #else
  	__asm__ __volatile__ (
  		"	mov	a12, a12
  "
  		: : : "memory");
  #endif
  }
  
  #endif /* _XTENSA_TRAPS_H */