Rev 3386 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3386 | Rev 4153 | ||
|---|---|---|---|
| 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 | sti |
|
| - | 162 | pushl %ebp # remember user stack |
|
| - | 163 | pushl %edi # remember return user address |
|
| - | 164 | ||
| - | 165 | pushl %gs # remember TLS |
|
| - | 166 | ||
| - | 167 | pushl %eax # syscall number |
|
| - | 168 | subl $8, %esp # unused sixth and fifth argument |
|
| - | 169 | pushl %esi # fourth argument |
|
| - | 170 | pushl %ebx # third argument |
|
| - | 171 | pushl %ecx # second argument |
|
| - | 172 | pushl %edx # first argument |
|
| - | 173 | ||
| - | 174 | movw $16, %ax |
|
| - | 175 | movw %ax, %ds |
|
| - | 176 | movw %ax, %es |
|
| - | 177 | ||
| - | 178 | cld |
|
| - | 179 | call syscall_handler |
|
| - | 180 | addl $28, %esp # remove arguments from stack |
|
| - | 181 | ||
| - | 182 | pop %gs # restore TLS |
|
| - | 183 | ||
| - | 184 | pop %edx # prepare return EIP for SYSEXIT |
|
| - | 185 | pop %ecx # prepare userspace ESP for SYSEXIT |
|
| - | 186 | ||
| - | 187 | sysexit # return to userspace |
|
| - | 188 | ||
| - | 189 | ||
| 150 | ## Declare interrupt handlers |
190 | ## Declare interrupt handlers |
| 151 | # |
191 | # |
| 152 | # Declare interrupt handlers for n interrupt |
192 | # Declare interrupt handlers for n interrupt |
| 153 | # vectors starting at vector i. |
193 | # vectors starting at vector i. |
| 154 | # |
194 | # |
| Line 226... | Line 266... | ||
| 226 | pushl %ds |
266 | pushl %ds |
| 227 | pushl %es |
267 | pushl %es |
| 228 | pushl %fs |
268 | pushl %fs |
| 229 | pushl %gs |
269 | pushl %gs |
| 230 | 270 | ||
| 231 | #ifdef CONFIG_DEBUG_ALLREGS |
- | |
| 232 | pushl %ebx |
- | |
| 233 | pushl %ebp |
- | |
| 234 | pushl %edi |
- | |
| 235 | pushl %esi |
- | |
| 236 | #else |
- | |
| 237 | subl $16, %esp |
- | |
| 238 | #endif |
- | |
| 239 | pushl %edx |
271 | pushl %edx |
| 240 | pushl %ecx |
272 | pushl %ecx |
| 241 | pushl %eax |
273 | pushl %eax |
| 242 | 274 | ||
| 243 | # we must fill the data segment registers |
275 | # we must fill the data segment registers |
| Line 255... | Line 287... | ||
| 255 | CLEAR_NT_FLAG # Modifies %ecx |
287 | CLEAR_NT_FLAG # Modifies %ecx |
| 256 | 288 | ||
| 257 | popl %eax |
289 | popl %eax |
| 258 | popl %ecx |
290 | popl %ecx |
| 259 | popl %edx |
291 | popl %edx |
| 260 | #ifdef CONFIG_DEBUG_ALLREGS |
- | |
| 261 | popl %esi |
- | |
| 262 | popl %edi |
- | |
| 263 | popl %ebp |
- | |
| 264 | popl %ebx |
- | |
| 265 | #else |
- | |
| 266 | addl $16, %esp |
- | |
| 267 | #endif |
- | |
| 268 | 292 | ||
| 269 | popl %gs |
293 | popl %gs |
| 270 | popl %fs |
294 | popl %fs |
| 271 | popl %es |
295 | popl %es |
| 272 | popl %ds |
296 | popl %ds |