Changes in kernel/arch/amd64/src/asm.S [1a5eca4:3b0f1b9a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/asm.S
r1a5eca4 r3b0f1b9a 31 31 #include <arch/mm/page.h> 32 32 #include <arch/istate_struct.h> 33 #include <arch/kseg_struct.h>34 #include <arch/cpu.h>35 33 36 34 .text … … 180 178 subq $(ISTATE_SOFT_SIZE + 8), %rsp 181 179 .endif 182 180 183 181 /* 184 182 * Save the general purpose registers. … … 201 199 202 200 /* 203 * Is this trap from the kernel?204 */205 cmpq $(GDT_SELECTOR(KTEXT_DES)), ISTATE_OFFSET_CS(%rsp)206 jz 0f207 208 /*209 * Switch to kernel FS base.210 */211 swapgs212 movl $AMD_MSR_FS, %ecx213 movl %gs:KSEG_OFFSET_FSBASE, %eax214 movl %gs:KSEG_OFFSET_FSBASE+4, %edx215 wrmsr216 swapgs217 218 /*219 201 * Imitate a regular stack frame linkage. 220 202 * Stop stack traces here if we came from userspace. 221 203 */ 222 0: movl $0x0, %edx 204 xorl %edx, %edx 205 cmpq $(GDT_SELECTOR(KTEXT_DES)), ISTATE_OFFSET_CS(%rsp) 223 206 cmovnzq %rdx, %rbp 224 207 … … 289 272 swapgs 290 273 291 movq %rsp, %gs:KSEG_OFFSET_USTACK_RSP /* save this thread's user RSP */ 292 movq %gs:KSEG_OFFSET_KSTACK_RSP, %rsp /* set this thread's kernel RSP */ 293 274 /* 275 * %gs:0 Scratch space for this thread's user RSP 276 * %gs:8 Address to be used as this thread's kernel RSP 277 */ 278 279 movq %rsp, %gs:0 /* save this thread's user RSP */ 280 movq %gs:8, %rsp /* set this thread's kernel RSP */ 281 294 282 /* 295 283 * Note that the space needed for the imitated istate structure has been … … 320 308 321 309 /* 322 * Switch to kernel FS base.323 */324 movl $AMD_MSR_FS, %ecx325 movl %gs:KSEG_OFFSET_FSBASE, %eax326 movl %gs:KSEG_OFFSET_FSBASE+4, %edx327 wrmsr328 movq ISTATE_OFFSET_RDX(%rsp), %rdx /* restore 3rd argument */329 330 /*331 310 * Save the return address and the userspace stack on locations that 332 311 * would normally be taken by them. 333 312 */ 334 movq %gs: KSEG_OFFSET_USTACK_RSP, %rax313 movq %gs:0, %rax 335 314 movq %rax, ISTATE_OFFSET_RSP(%rsp) 336 315 movq %rcx, ISTATE_OFFSET_RIP(%rsp) … … 346 325 swapgs 347 326 sti 348 327 349 328 /* Copy the 4th argument where it is expected */ 350 329 movq %r10, %rcx
Note:
See TracChangeset
for help on using the changeset viewer.