1.hidden __sysinfo
2
3# The calling convention for __vsyscall has the syscall number
4# and 5 args arriving as:  eax, edx, ecx, edi, esi, 4(%esp).
5# This ensures that the inline asm in the C code never has to touch
6# ebx or ebp (which are unavailable in PIC and frame-pointer-using
7# code, respectively), and optimizes for size/simplicity in the caller.
8
9.global __vsyscall
10.hidden __vsyscall
11.type __vsyscall,@function
12__vsyscall:
13	push %edi
14	push %ebx
15	mov %edx,%ebx
16	mov %edi,%edx
17	mov 12(%esp),%edi
18	push %eax
19	call 1f
202:	mov %ebx,%edx
21	pop %ebx
22	pop %ebx
23	pop %edi
24	ret
25
261:	mov (%esp),%eax
27	add $[__sysinfo-2b],%eax
28	mov (%eax),%eax
29	test %eax,%eax
30	jz 1f
31	push %eax
32	mov 8(%esp),%eax
33	ret                     # tail call to kernel vsyscall entry
341:	mov 4(%esp),%eax
35	int $128
36	ret
37
38# The __vsyscall6 entry point is used only for 6-argument syscalls.
39# Instead of passing the 5th argument on the stack, a pointer to the
40# 5th and 6th arguments is passed. This is ugly, but there are no
41# register constraints the inline asm could use that would make it
42# possible to pass two arguments on the stack.
43
44.global __vsyscall6
45.hidden __vsyscall6
46.type __vsyscall6,@function
47__vsyscall6:
48	push %ebp
49	push %eax
50	mov 12(%esp), %ebp
51	mov (%ebp), %eax
52	mov 4(%ebp), %ebp
53	push %eax
54	mov 4(%esp),%eax
55	call __vsyscall
56	pop %ebp
57	pop %ebp
58	pop %ebp
59	ret
60
61.global __syscall
62.hidden __syscall
63.type __syscall,@function
64__syscall:
65	lea 24(%esp),%eax
66	push %esi
67	push %edi
68	push %eax
69	mov 16(%esp),%eax
70	mov 20(%esp),%edx
71	mov 24(%esp),%ecx
72	mov 28(%esp),%edi
73	mov 32(%esp),%esi
74	call __vsyscall6
75	pop %edi
76	pop %edi
77	pop %esi
78	ret
79