Subversion Repositories HelenOS

Rev

Rev 3403 | Rev 3674 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3403 Rev 3535
Line 145... Line 145...
145
	and $0xffffbfff, %ecx
145
	and $0xffffbfff, %ecx
146
	push %ecx
146
	push %ecx
147
	popfl
147
	popfl
148
.endm	
148
.endm	
149
 
149
 
-
 
150
/*
-
 
151
 * The SYSENTER syscall mechanism can be used for syscalls with
-
 
152
 * four or fewer arguments. To pass these four arguments, we
-
 
153
 * use four registers: EDX, ECX, EBX, ESI. The syscall number
-
 
154
 * is passed in EAX. We use EDI to remember the return address
-
 
155
 * and EBP to remember the stack. The INT-based syscall mechanism
-
 
156
 * can actually handle six arguments plus the syscall number
-
 
157
 * entirely in registers.
-
 
158
 */
-
 
159
.global sysenter_handler
-
 
160
sysenter_handler:
-
 
161
	pushl %ebp	# remember user stack
-
 
162
	pushl %edi	# remember return user address
-
 
163
 
-
 
164
	pushl %gs	# remember TLS
-
 
165
 
-
 
166
	pushl %eax	# syscall number
-
 
167
	subl $8, %esp	# unused sixth and fifth argument
-
 
168
	pushl %esi	# fourth argument
-
 
169
	pushl %ebx	# third argument
-
 
170
	pushl %ecx	# second argument
-
 
171
	pushl %edx	# first argument
-
 
172
 
-
 
173
	movw $16, %ax
-
 
174
	movw %ax, %ds
-
 
175
	movw %ax, %es
-
 
176
 
-
 
177
	cld
-
 
178
	call syscall_handler
-
 
179
	addl $28, %esp	# remove arguments from stack
-
 
180
 
-
 
181
	pop %gs		# restore TLS
-
 
182
 
-
 
183
	pop %edx	# prepare return EIP for SYSEXIT
-
 
184
	pop %ecx	# prepare userspace ESP for SYSEXIT
-
 
185
 
-
 
186
	sysexit		# return to userspace
-
 
187
 
-
 
188
 
150
## Declare interrupt handlers
189
## Declare interrupt handlers
151
#
190
#
152
# Declare interrupt handlers for n interrupt
191
# Declare interrupt handlers for n interrupt
153
# vectors starting at vector i.
192
# vectors starting at vector i.
154
#
193
#