Subversion Repositories HelenOS

Rev

Rev 3386 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3386 Rev 4153
Line 26... Line 26...
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
#
27
#
28
 
28
 
29
.text
29
.text
30
 
30
 
31
/** Syscall wrapper.
31
/** Syscall wrapper - INT $0x30 version.
32
 *
32
 *
33
 * Mind the order of arguments. First two arguments and the syscall number go to
33
 * Mind the order of arguments. First two arguments and the syscall number go to
34
 * scratch registers. An optimized version of this wrapper for fewer arguments
34
 * scratch registers. An optimized version of this wrapper for fewer arguments
35
 * could benefit from this and not save unused registers on the stack.
35
 * could benefit from this and not save unused registers on the stack.
36
 */
36
 */
37
.global __syscall
37
.global __syscall_int
38
__syscall:
38
__syscall_int:
39
	pushl %ebx
39
	pushl %ebx
40
	pushl %esi
40
	pushl %esi
41
	pushl %edi
41
	pushl %edi
42
	pushl %ebp
42
	pushl %ebp
43
	movl 20(%esp), %edx	# First argument.
43
	movl 20(%esp), %edx	# First argument.
Line 51... Line 51...
51
	popl %ebp
51
	popl %ebp
52
	popl %edi
52
	popl %edi
53
	popl %esi
53
	popl %esi
54
	popl %ebx
54
	popl %ebx
55
	ret
55
	ret
-
 
56
 
-
 
57
 
-
 
58
/** Syscall wrapper - SYSENTER version.
-
 
59
 *
-
 
60
 * This is an optimized version of syscall for four or less arguments.  Note
-
 
61
 * that EBP and EDI are used to remember user stack address and the return
-
 
62
 * address. The kernel part doesn't save DS, ES and FS so the handler restores
-
 
63
 * these to the selector immediately following CS (it must be the flat data
-
 
64
 * segment, otherwise the SYSENTER wouldn't work in the first place).
-
 
65
 */
-
 
66
.global __syscall_sysenter
-
 
67
__syscall_sysenter:
-
 
68
	pushl %ebx
-
 
69
	pushl %esi
-
 
70
	pushl %edi
-
 
71
	pushl %ebp
-
 
72
	mov %esp, %ebp
-
 
73
	lea ra, %edi
-
 
74
	movl 20(%esp), %edx	# First argument.
-
 
75
	movl 24(%esp), %ecx	# Second argument.
-
 
76
	movl 28(%esp), %ebx	# Third argument.
-
 
77
	movl 32(%esp), %esi	# Fourth argument.
-
 
78
	movl 44(%esp), %eax	# Syscall number.
-
 
79
	sysenter
-
 
80
ra:
-
 
81
	movw %cs, %cx
-
 
82
	addw $8, %cx
-
 
83
	movw %cx, %ds
-
 
84
	movw %cx, %es
-
 
85
	movw %cx, %fs
-
 
86
	popl %ebp
-
 
87
	popl %edi
-
 
88
	popl %esi
-
 
89
	popl %ebx
-
 
90
	ret