aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-m68knommu/entry.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-m68knommu/entry.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-m68knommu/entry.h')
-rw-r--r--include/asm-m68knommu/entry.h183
1 files changed, 183 insertions, 0 deletions
diff --git a/include/asm-m68knommu/entry.h b/include/asm-m68knommu/entry.h
new file mode 100644
index 000000000000..06f5aa70b0b5
--- /dev/null
+++ b/include/asm-m68knommu/entry.h
@@ -0,0 +1,183 @@
1#ifndef __M68KNOMMU_ENTRY_H
2#define __M68KNOMMU_ENTRY_H
3
4#include <linux/config.h>
5#include <asm/setup.h>
6#include <asm/page.h>
7
8/*
9 * Stack layout in 'ret_from_exception':
10 *
11 * This allows access to the syscall arguments in registers d1-d5
12 *
13 * 0(sp) - d1
14 * 4(sp) - d2
15 * 8(sp) - d3
16 * C(sp) - d4
17 * 10(sp) - d5
18 * 14(sp) - a0
19 * 18(sp) - a1
20 * 1C(sp) - a2
21 * 20(sp) - d0
22 * 24(sp) - orig_d0
23 * 28(sp) - stack adjustment
24 * 2C(sp) - [ sr ] [ format & vector ]
25 * 2E(sp) - [ pc-hiword ] [ sr ]
26 * 30(sp) - [ pc-loword ] [ pc-hiword ]
27 * 32(sp) - [ format & vector ] [ pc-loword ]
28 * ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
29 * M68K COLDFIRE
30 */
31
32#define ALLOWINT 0xf8ff
33
34#ifdef __ASSEMBLY__
35
36/* process bits for task_struct.flags */
37PF_TRACESYS_OFF = 3
38PF_TRACESYS_BIT = 5
39PF_PTRACED_OFF = 3
40PF_PTRACED_BIT = 4
41PF_DTRACE_OFF = 1
42PF_DTRACE_BIT = 5
43
44LENOSYS = 38
45
46#define SWITCH_STACK_SIZE (6*4+4) /* Includes return address */
47
48/*
49 * This defines the normal kernel pt-regs layout.
50 *
51 * regs are a2-a6 and d6-d7 preserved by C code
52 * the kernel doesn't mess with usp unless it needs to
53 */
54
55#ifdef CONFIG_COLDFIRE
56/*
57 * This is made a little more tricky on the ColdFire. There is no
58 * separate kernel and user stack pointers. Need to artificially
59 * construct a usp in software... When doing this we need to disable
60 * interrupts, otherwise bad things could happen.
61 */
62.macro SAVE_ALL
63 move #0x2700,%sr /* disable intrs */
64 btst #5,%sp@(2) /* from user? */
65 bnes 6f /* no, skip */
66 movel %sp,sw_usp /* save user sp */
67 addql #8,sw_usp /* remove exception */
68 movel sw_ksp,%sp /* kernel sp */
69 subql #8,%sp /* room for exception */
70 clrl %sp@- /* stkadj */
71 movel %d0,%sp@- /* orig d0 */
72 movel %d0,%sp@- /* d0 */
73 lea %sp@(-32),%sp /* space for 8 regs */
74 moveml %d1-%d5/%a0-%a2,%sp@
75 movel sw_usp,%a0 /* get usp */
76 movel %a0@-,%sp@(PT_PC) /* copy exception program counter */
77 movel %a0@-,%sp@(PT_FORMATVEC)/* copy exception format/vector/sr */
78 bra 7f
79 6:
80 clrl %sp@- /* stkadj */
81 movel %d0,%sp@- /* orig d0 */
82 movel %d0,%sp@- /* d0 */
83 lea %sp@(-32),%sp /* space for 8 regs */
84 moveml %d1-%d5/%a0-%a2,%sp@
85 7:
86.endm
87
88.macro RESTORE_ALL
89 btst #5,%sp@(PT_SR) /* going user? */
90 bnes 8f /* no, skip */
91 move #0x2700,%sr /* disable intrs */
92 movel sw_usp,%a0 /* get usp */
93 movel %sp@(PT_PC),%a0@- /* copy exception program counter */
94 movel %sp@(PT_FORMATVEC),%a0@-/* copy exception format/vector/sr */
95 moveml %sp@,%d1-%d5/%a0-%a2
96 lea %sp@(32),%sp /* space for 8 regs */
97 movel %sp@+,%d0
98 addql #4,%sp /* orig d0 */
99 addl %sp@+,%sp /* stkadj */
100 addql #8,%sp /* remove exception */
101 movel %sp,sw_ksp /* save ksp */
102 subql #8,sw_usp /* set exception */
103 movel sw_usp,%sp /* restore usp */
104 rte
105 8:
106 moveml %sp@,%d1-%d5/%a0-%a2
107 lea %sp@(32),%sp /* space for 8 regs */
108 movel %sp@+,%d0
109 addql #4,%sp /* orig d0 */
110 addl %sp@+,%sp /* stkadj */
111 rte
112.endm
113
114/*
115 * Quick exception save, use current stack only.
116 */
117.macro SAVE_LOCAL
118 move #0x2700,%sr /* disable intrs */
119 clrl %sp@- /* stkadj */
120 movel %d0,%sp@- /* orig d0 */
121 movel %d0,%sp@- /* d0 */
122 lea %sp@(-32),%sp /* space for 8 regs */
123 moveml %d1-%d5/%a0-%a2,%sp@
124.endm
125
126.macro RESTORE_LOCAL
127 moveml %sp@,%d1-%d5/%a0-%a2
128 lea %sp@(32),%sp /* space for 8 regs */
129 movel %sp@+,%d0
130 addql #4,%sp /* orig d0 */
131 addl %sp@+,%sp /* stkadj */
132 rte
133.endm
134
135.macro SAVE_SWITCH_STACK
136 lea %sp@(-24),%sp /* 6 regs */
137 moveml %a3-%a6/%d6-%d7,%sp@
138.endm
139
140.macro RESTORE_SWITCH_STACK
141 moveml %sp@,%a3-%a6/%d6-%d7
142 lea %sp@(24),%sp /* 6 regs */
143.endm
144
145/*
146 * Software copy of the user and kernel stack pointers... Ugh...
147 * Need these to get around ColdFire not having separate kernel
148 * and user stack pointers.
149 */
150.globl sw_usp
151.globl sw_ksp
152
153#else /* !CONFIG_COLDFIRE */
154
155/*
156 * Standard 68k interrupt entry and exit macros.
157 */
158.macro SAVE_ALL
159 clrl %sp@- /* stkadj */
160 movel %d0,%sp@- /* orig d0 */
161 movel %d0,%sp@- /* d0 */
162 moveml %d1-%d5/%a0-%a2,%sp@-
163.endm
164
165.macro RESTORE_ALL
166 moveml %sp@+,%a0-%a2/%d1-%d5
167 movel %sp@+,%d0
168 addql #4,%sp /* orig d0 */
169 addl %sp@+,%sp /* stkadj */
170 rte
171.endm
172
173.macro SAVE_SWITCH_STACK
174 moveml %a3-%a6/%d6-%d7,%sp@-
175.endm
176
177.macro RESTORE_SWITCH_STACK
178 moveml %sp@+,%a3-%a6/%d6-%d7
179.endm
180
181#endif /* !CONFIG_COLDFIRE */
182#endif /* __ASSEMBLY__ */
183#endif /* __M68KNOMMU_ENTRY_H */