Skip to content

Commit 542dc79

Browse files
benzeajmberg-intel
authored andcommitted
um: Add generic stub_syscall6 function
This function will be used by the new syscall handling code. Signed-off-by: Benjamin Berg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent dc26184 commit 542dc79

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

arch/x86/um/shared/sysdep/stub_32.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,28 @@ static __always_inline long stub_syscall5(long syscall, long arg1, long arg2,
8080
return ret;
8181
}
8282

83+
static __always_inline long stub_syscall6(long syscall, long arg1, long arg2,
84+
long arg3, long arg4, long arg5,
85+
long arg6)
86+
{
87+
struct syscall_args {
88+
int ebx, ebp;
89+
} args = { arg1, arg6 };
90+
long ret;
91+
92+
__asm__ volatile ("pushl %%ebp;"
93+
"movl 0x4(%%ebx),%%ebp;"
94+
"movl (%%ebx),%%ebx;"
95+
"int $0x80;"
96+
"popl %%ebp"
97+
: "=a" (ret)
98+
: "0" (syscall), "b" (&args),
99+
"c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5)
100+
: "memory");
101+
102+
return ret;
103+
}
104+
83105
static __always_inline void trap_myself(void)
84106
{
85107
__asm("int3");

arch/x86/um/shared/sysdep/stub_64.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,22 @@ static __always_inline long stub_syscall5(long syscall, long arg1, long arg2,
8080
return ret;
8181
}
8282

83+
static __always_inline long stub_syscall6(long syscall, long arg1, long arg2,
84+
long arg3, long arg4, long arg5,
85+
long arg6)
86+
{
87+
long ret;
88+
89+
__asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; movq %7,%%r9 ; "
90+
__syscall
91+
: "=a" (ret)
92+
: "0" (syscall), "D" (arg1), "S" (arg2), "d" (arg3),
93+
"g" (arg4), "g" (arg5), "g" (arg6)
94+
: __syscall_clobber, "r10", "r8", "r9");
95+
96+
return ret;
97+
}
98+
8399
static __always_inline void trap_myself(void)
84100
{
85101
__asm("int3");

0 commit comments

Comments
 (0)