Changeset 339 for trunk/hal/x86_64/core/hal_cpu.S
- Timestamp:
- Aug 7, 2017, 3:11:45 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_cpu.S
r309 r339 24 24 #include <hal_segmentation.h> 25 25 #include <hal_register.h> 26 #include <hal_kentry.h> 26 27 27 28 ASM_ENTRY(lgdt) … … 181 182 /* -------------------------------------------------------------------------- */ 182 183 184 ASM_ENTRY(cpu_context_switch) 185 pushq %r12 186 pushq %r13 187 188 movq %rdi,%r13 /* oldctx */ 189 movq %rsi,%r12 /* newctx */ 190 191 /* 192 * Save the current stack in %rdx, and switch to the trap frame of 193 * the old thread. 194 */ 195 movq %rsp,%rdx 196 movq CTX_TF(%r13),%rsp 197 addq $TF_SIZE,%rsp /* end of the structure */ 198 199 /* Build the trap frame */ 200 movl %ss,%eax 201 pushq %rax /* tf_ss */ 202 pushq %rdx /* tf_rsp */ 203 pushfq /* tf_rflags */ 204 movl %cs,%eax 205 pushq %rax /* tf_cs */ 206 movabsq $thr_resume,%rax 207 pushq %rax /* tf_rip */ 208 pushq $0 /* tf_err */ 209 pushq $T_ASTFLT /* tf_trapno */ 210 INTR_SAVE_REGS 211 212 /* Switch rsp0 */ 213 movq CTX_RSP0(%r12),%rax 214 movq TLSVAR(RSP0),%rdx 215 movq %rax,(%rdx) 216 217 /* Switch to the new trap frame */ 218 movq CTX_TF(%r12),%rsp 219 220 /* 221 * Restore the context, and jump into the new thread. 222 */ 223 INTR_RESTORE_REGS 224 iretq 225 226 thr_resume: 227 /* 228 * Only pop %r12 and %r13, and return. 229 */ 230 popq %r13 231 popq %r12 232 233 ret 234 235 /* -------------------------------------------------------------------------- */ 236 183 237 ASM_ENTRY(atomic_cas_32) 184 238 movl %esi,%eax
Note: See TracChangeset
for help on using the changeset viewer.