aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/syscall.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-10-13 21:40:04 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-22 10:56:24 -0400
commit746e7cef1b3de5516e07f16a448f0d2a092e3d36 (patch)
treebc995074f9c359351bbf0b1707727a0b76f2f0f4 /include/asm-x86/syscall.h
parentaef8f5b8c2da706cb3efe701e2a35e11221ea5bd (diff)
x86 syscall.h: fix argument order
Petr Tesarik noticed that I'd bungled the syscall_get_arguments code for 64-bit kernels, so it inverted the order of the syscall argument registers. Petr wrote a patch to fix that, and I've amended it to fix the same braino in the syscall_set_arguments code. Original-by: Petr Tesarik <ptesarik@suse.cz> Signed-off-by: Roland McGrath <roland@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86/syscall.h')
-rw-r--r--include/asm-x86/syscall.h106
1 files changed, 54 insertions, 52 deletions
diff --git a/include/asm-x86/syscall.h b/include/asm-x86/syscall.h
index 04c47dc5597c..ec2a95e68e42 100644
--- a/include/asm-x86/syscall.h
+++ b/include/asm-x86/syscall.h
@@ -93,26 +93,26 @@ static inline void syscall_get_arguments(struct task_struct *task,
93{ 93{
94# ifdef CONFIG_IA32_EMULATION 94# ifdef CONFIG_IA32_EMULATION
95 if (task_thread_info(task)->status & TS_COMPAT) 95 if (task_thread_info(task)->status & TS_COMPAT)
96 switch (i + n) { 96 switch (i) {
97 case 6: 97 case 0:
98 if (!n--) break; 98 if (!n--) break;
99 *args++ = regs->bp; 99 *args++ = regs->bx;
100 case 5: 100 case 1:
101 if (!n--) break; 101 if (!n--) break;
102 *args++ = regs->di; 102 *args++ = regs->cx;
103 case 4: 103 case 2:
104 if (!n--) break; 104 if (!n--) break;
105 *args++ = regs->si; 105 *args++ = regs->dx;
106 case 3: 106 case 3:
107 if (!n--) break; 107 if (!n--) break;
108 *args++ = regs->dx; 108 *args++ = regs->si;
109 case 2: 109 case 4:
110 if (!n--) break; 110 if (!n--) break;
111 *args++ = regs->cx; 111 *args++ = regs->di;
112 case 1: 112 case 5:
113 if (!n--) break; 113 if (!n--) break;
114 *args++ = regs->bx; 114 *args++ = regs->bp;
115 case 0: 115 case 6:
116 if (!n--) break; 116 if (!n--) break;
117 default: 117 default:
118 BUG(); 118 BUG();
@@ -120,26 +120,26 @@ static inline void syscall_get_arguments(struct task_struct *task,
120 } 120 }
121 else 121 else
122# endif 122# endif
123 switch (i + n) { 123 switch (i) {
124 case 6: 124 case 0:
125 if (!n--) break; 125 if (!n--) break;
126 *args++ = regs->r9; 126 *args++ = regs->di;
127 case 5: 127 case 1:
128 if (!n--) break; 128 if (!n--) break;
129 *args++ = regs->r8; 129 *args++ = regs->si;
130 case 4: 130 case 2:
131 if (!n--) break; 131 if (!n--) break;
132 *args++ = regs->r10; 132 *args++ = regs->dx;
133 case 3: 133 case 3:
134 if (!n--) break; 134 if (!n--) break;
135 *args++ = regs->dx; 135 *args++ = regs->r10;
136 case 2: 136 case 4:
137 if (!n--) break; 137 if (!n--) break;
138 *args++ = regs->si; 138 *args++ = regs->r8;
139 case 1: 139 case 5:
140 if (!n--) break; 140 if (!n--) break;
141 *args++ = regs->di; 141 *args++ = regs->r9;
142 case 0: 142 case 6:
143 if (!n--) break; 143 if (!n--) break;
144 default: 144 default:
145 BUG(); 145 BUG();
@@ -154,55 +154,57 @@ static inline void syscall_set_arguments(struct task_struct *task,
154{ 154{
155# ifdef CONFIG_IA32_EMULATION 155# ifdef CONFIG_IA32_EMULATION
156 if (task_thread_info(task)->status & TS_COMPAT) 156 if (task_thread_info(task)->status & TS_COMPAT)
157 switch (i + n) { 157 switch (i) {
158 case 6: 158 case 0:
159 if (!n--) break; 159 if (!n--) break;
160 regs->bp = *args++; 160 regs->bx = *args++;
161 case 5: 161 case 1:
162 if (!n--) break; 162 if (!n--) break;
163 regs->di = *args++; 163 regs->cx = *args++;
164 case 4: 164 case 2:
165 if (!n--) break; 165 if (!n--) break;
166 regs->si = *args++; 166 regs->dx = *args++;
167 case 3: 167 case 3:
168 if (!n--) break; 168 if (!n--) break;
169 regs->dx = *args++; 169 regs->si = *args++;
170 case 2: 170 case 4:
171 if (!n--) break; 171 if (!n--) break;
172 regs->cx = *args++; 172 regs->di = *args++;
173 case 1: 173 case 5:
174 if (!n--) break; 174 if (!n--) break;
175 regs->bx = *args++; 175 regs->bp = *args++;
176 case 0: 176 case 6:
177 if (!n--) break; 177 if (!n--) break;
178 default: 178 default:
179 BUG(); 179 BUG();
180 break;
180 } 181 }
181 else 182 else
182# endif 183# endif
183 switch (i + n) { 184 switch (i) {
184 case 6: 185 case 0:
185 if (!n--) break; 186 if (!n--) break;
186 regs->r9 = *args++; 187 regs->di = *args++;
187 case 5: 188 case 1:
188 if (!n--) break; 189 if (!n--) break;
189 regs->r8 = *args++; 190 regs->si = *args++;
190 case 4: 191 case 2:
191 if (!n--) break; 192 if (!n--) break;
192 regs->r10 = *args++; 193 regs->dx = *args++;
193 case 3: 194 case 3:
194 if (!n--) break; 195 if (!n--) break;
195 regs->dx = *args++; 196 regs->r10 = *args++;
196 case 2: 197 case 4:
197 if (!n--) break; 198 if (!n--) break;
198 regs->si = *args++; 199 regs->r8 = *args++;
199 case 1: 200 case 5:
200 if (!n--) break; 201 if (!n--) break;
201 regs->di = *args++; 202 regs->r9 = *args++;
202 case 0: 203 case 6:
203 if (!n--) break; 204 if (!n--) break;
204 default: 205 default:
205 BUG(); 206 BUG();
207 break;
206 } 208 }
207} 209}
208 210