libc: Fix weird push/pop of ebx in syscall bindings
This commit is contained in:
parent
3ca8a5fcc2
commit
976b51a285
@ -15,47 +15,47 @@ _Begin_C_Header
|
||||
|
||||
#define DEFN_SYSCALL0(fn, num) \
|
||||
int syscall_##fn() { \
|
||||
int a; __asm__ __volatile__("int $0x7F" : "=a" (a) : "0" (num)); \
|
||||
int a = num; __asm__ __volatile__("int $0x7F" : "=a" (a) : "a" (a)); \
|
||||
return a; \
|
||||
}
|
||||
|
||||
#define DEFN_SYSCALL1(fn, num, P1) \
|
||||
int syscall_##fn(P1 p1) { \
|
||||
int __res; __asm__ __volatile__("push %%ebx; movl %2,%%ebx; int $0x7F; pop %%ebx" \
|
||||
int __res = num; __asm__ __volatile__("int $0x7F" \
|
||||
: "=a" (__res) \
|
||||
: "0" (num), "r" ((int)(p1))); \
|
||||
: "a" (__res), "b" ((int)(p1))); \
|
||||
return __res; \
|
||||
}
|
||||
|
||||
#define DEFN_SYSCALL2(fn, num, P1, P2) \
|
||||
int syscall_##fn(P1 p1, P2 p2) { \
|
||||
int __res; __asm__ __volatile__("push %%ebx; movl %2,%%ebx; int $0x7F; pop %%ebx" \
|
||||
int __res = num; __asm__ __volatile__("int $0x7F" \
|
||||
: "=a" (__res) \
|
||||
: "0" (num), "r" ((int)(p1)), "c"((int)(p2))); \
|
||||
: "a" (__res), "b" ((int)(p1)), "c"((int)(p2))); \
|
||||
return __res; \
|
||||
}
|
||||
|
||||
#define DEFN_SYSCALL3(fn, num, P1, P2, P3) \
|
||||
int syscall_##fn(P1 p1, P2 p2, P3 p3) { \
|
||||
int __res; __asm__ __volatile__("push %%ebx; movl %2,%%ebx; int $0x7F; pop %%ebx" \
|
||||
int __res = num; __asm__ __volatile__("int $0x7F" \
|
||||
: "=a" (__res) \
|
||||
: "0" (num), "r" ((int)(p1)), "c"((int)(p2)), "d"((int)(p3))); \
|
||||
: "a" (__res), "b" ((int)(p1)), "c"((int)(p2)), "d"((int)(p3))); \
|
||||
return __res; \
|
||||
}
|
||||
|
||||
#define DEFN_SYSCALL4(fn, num, P1, P2, P3, P4) \
|
||||
int syscall_##fn(P1 p1, P2 p2, P3 p3, P4 p4) { \
|
||||
int __res; __asm__ __volatile__("push %%ebx; movl %2,%%ebx; int $0x7F; pop %%ebx" \
|
||||
int __res = num; __asm__ __volatile__("int $0x7F" \
|
||||
: "=a" (__res) \
|
||||
: "0" (num), "r" ((int)(p1)), "c"((int)(p2)), "d"((int)(p3)), "S"((int)(p4))); \
|
||||
: "a" (__res), "b" ((int)(p1)), "c"((int)(p2)), "d"((int)(p3)), "S"((int)(p4))); \
|
||||
return __res; \
|
||||
}
|
||||
|
||||
#define DEFN_SYSCALL5(fn, num, P1, P2, P3, P4, P5) \
|
||||
int syscall_##fn(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { \
|
||||
int __res; __asm__ __volatile__("push %%ebx; movl %2,%%ebx; int $0x7F; pop %%ebx" \
|
||||
int __res = num; __asm__ __volatile__("int $0x7F" \
|
||||
: "=a" (__res) \
|
||||
: "0" (num), "r" ((int)(p1)), "c"((int)(p2)), "d"((int)(p3)), "S"((int)(p4)), "D"((int)(p5))); \
|
||||
: "a" (__res), "b" ((int)(p1)), "c"((int)(p2)), "d"((int)(p3)), "S"((int)(p4)), "D"((int)(p5))); \
|
||||
return __res; \
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user