Commit 746e7cef authored by Roland McGrath's avatar Roland McGrath Committed by Ingo Molnar

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: default avatarPetr Tesarik <ptesarik@suse.cz>
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent aef8f5b8
...@@ -93,26 +93,26 @@ static inline void syscall_get_arguments(struct task_struct *task, ...@@ -93,26 +93,26 @@ static inline void syscall_get_arguments(struct task_struct *task,
{ {
# ifdef CONFIG_IA32_EMULATION # ifdef CONFIG_IA32_EMULATION
if (task_thread_info(task)->status & TS_COMPAT) if (task_thread_info(task)->status & TS_COMPAT)
switch (i + n) { switch (i) {
case 6: case 0:
if (!n--) break; if (!n--) break;
*args++ = regs->bp; *args++ = regs->bx;
case 5: case 1:
if (!n--) break; if (!n--) break;
*args++ = regs->di; *args++ = regs->cx;
case 4: case 2:
if (!n--) break; if (!n--) break;
*args++ = regs->si; *args++ = regs->dx;
case 3: case 3:
if (!n--) break; if (!n--) break;
*args++ = regs->dx; *args++ = regs->si;
case 2: case 4:
if (!n--) break; if (!n--) break;
*args++ = regs->cx; *args++ = regs->di;
case 1: case 5:
if (!n--) break; if (!n--) break;
*args++ = regs->bx; *args++ = regs->bp;
case 0: case 6:
if (!n--) break; if (!n--) break;
default: default:
BUG(); BUG();
...@@ -120,26 +120,26 @@ static inline void syscall_get_arguments(struct task_struct *task, ...@@ -120,26 +120,26 @@ static inline void syscall_get_arguments(struct task_struct *task,
} }
else else
# endif # endif
switch (i + n) { switch (i) {
case 6: case 0:
if (!n--) break; if (!n--) break;
*args++ = regs->r9; *args++ = regs->di;
case 5: case 1:
if (!n--) break; if (!n--) break;
*args++ = regs->r8; *args++ = regs->si;
case 4: case 2:
if (!n--) break; if (!n--) break;
*args++ = regs->r10; *args++ = regs->dx;
case 3: case 3:
if (!n--) break; if (!n--) break;
*args++ = regs->dx; *args++ = regs->r10;
case 2: case 4:
if (!n--) break; if (!n--) break;
*args++ = regs->si; *args++ = regs->r8;
case 1: case 5:
if (!n--) break; if (!n--) break;
*args++ = regs->di; *args++ = regs->r9;
case 0: case 6:
if (!n--) break; if (!n--) break;
default: default:
BUG(); BUG();
...@@ -154,55 +154,57 @@ static inline void syscall_set_arguments(struct task_struct *task, ...@@ -154,55 +154,57 @@ static inline void syscall_set_arguments(struct task_struct *task,
{ {
# ifdef CONFIG_IA32_EMULATION # ifdef CONFIG_IA32_EMULATION
if (task_thread_info(task)->status & TS_COMPAT) if (task_thread_info(task)->status & TS_COMPAT)
switch (i + n) { switch (i) {
case 6: case 0:
if (!n--) break; if (!n--) break;
regs->bp = *args++; regs->bx = *args++;
case 5: case 1:
if (!n--) break; if (!n--) break;
regs->di = *args++; regs->cx = *args++;
case 4: case 2:
if (!n--) break; if (!n--) break;
regs->si = *args++; regs->dx = *args++;
case 3: case 3:
if (!n--) break; if (!n--) break;
regs->dx = *args++; regs->si = *args++;
case 2: case 4:
if (!n--) break; if (!n--) break;
regs->cx = *args++; regs->di = *args++;
case 1: case 5:
if (!n--) break; if (!n--) break;
regs->bx = *args++; regs->bp = *args++;
case 0: case 6:
if (!n--) break; if (!n--) break;
default: default:
BUG(); BUG();
break;
} }
else else
# endif # endif
switch (i + n) { switch (i) {
case 6: case 0:
if (!n--) break; if (!n--) break;
regs->r9 = *args++; regs->di = *args++;
case 5: case 1:
if (!n--) break; if (!n--) break;
regs->r8 = *args++; regs->si = *args++;
case 4: case 2:
if (!n--) break; if (!n--) break;
regs->r10 = *args++; regs->dx = *args++;
case 3: case 3:
if (!n--) break; if (!n--) break;
regs->dx = *args++; regs->r10 = *args++;
case 2: case 4:
if (!n--) break; if (!n--) break;
regs->si = *args++; regs->r8 = *args++;
case 1: case 5:
if (!n--) break; if (!n--) break;
regs->di = *args++; regs->r9 = *args++;
case 0: case 6:
if (!n--) break; if (!n--) break;
default: default:
BUG(); BUG();
break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment