Rev 803 | Rev 808 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 803 | Rev 806 | ||
---|---|---|---|
Line 190... | Line 190... | ||
190 | handler 0 IDT_ITEMS |
190 | handler 0 IDT_ITEMS |
191 | h_end: |
191 | h_end: |
192 | 192 | ||
193 | 193 | ||
194 | syscall_entry: |
194 | syscall_entry: |
195 | # TODO: Switch to kernel stack |
195 | # Switch to hidden gs |
- | 196 | swapgs |
|
- | 197 | ||
- | 198 | # TODO: I would like LEA instead of thes 2 instrs, |
|
- | 199 | # why does not it work??? |
|
- | 200 | mov %gs:0, %r10 # We have a stack in r10 |
|
- | 201 | addq $0x0ff0, %r10 |
|
- | 202 | ||
- | 203 | movq %rsp, 0(%r10) # Save old stack pointer to stack |
|
- | 204 | movq %r10, %rsp # Change to new stack |
|
- | 205 | pushq %rcx # Return address |
|
- | 206 | pushq %r11 # Save flags |
|
- | 207 | ||
- | 208 | # Switch back to remain consistent |
|
- | 209 | swapgs |
|
- | 210 | ||
- | 211 | movq %r9, %rcx # Exchange last parameter as a third |
|
196 | call syscall_handler |
212 | call syscall_handler |
- | 213 | ||
- | 214 | popq %r11 |
|
197 | # Switch back |
215 | popq %rcx |
- | 216 | movq 0(%rsp), %rsp |
|
198 | sysret |
217 | sysretq |
199 | 218 | ||
200 | .data |
219 | .data |
201 | .global interrupt_handler_size |
220 | .global interrupt_handler_size |
202 | 221 | ||
203 | interrupt_handler_size: .long (h_end-h_start)/IDT_ITEMS |
222 | interrupt_handler_size: .long (h_end-h_start)/IDT_ITEMS |