Changeset 339 for trunk/hal/x86_64/core/hal_context.c
- Timestamp:
- Aug 7, 2017, 3:11:45 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_context.c
r335 r339 39 39 hal_trapframe_t *tf; 40 40 hal_cpu_context_t *ctx; 41 uint64_t kstacktop; 41 42 kmem_req_t req; 43 44 kstacktop = (uint64_t)thread->k_stack_base + thread->k_stack_size; 42 45 43 46 /* allocate memory for cpu_context */ … … 56 59 * Build the context 57 60 */ 58 ctx->ctx_rsp0 = ((uint64_t)thread->k_stack_base) + thread->k_stack_size; 59 ctx->ctx_rsp0 &= ~0xF; 60 /* XXX: ctx_rsp */ 61 ctx->ctx_rsp0 = kstacktop & ~0xF; 62 ctx->ctx_tf = (uint64_t)&ctx->ctx_hidden_tf; 61 63 62 64 /* 63 65 * Build the trap frame 64 66 */ 65 tf = (void *)(((uint64_t)thread->k_stack_base + 66 thread->k_stack_size) & ~0xF); 67 tf = &ctx->ctx_hidden_tf; 67 68 tf->tf_gs = GDT_FIXED_SEL(GDT_UDATA_SEL, SEL_UPL); 68 69 tf->tf_fs = GDT_FIXED_SEL(GDT_UDATA_SEL, SEL_UPL); … … 78 79 } else { 79 80 tf->tf_cs = GDT_FIXED_SEL(GDT_KCODE_SEL, SEL_KPL); 80 tf->tf_rsp = ((uint64_t)thread->k_stack_base) + 81 thread->k_stack_size; 81 tf->tf_rsp = kstacktop; 82 82 } 83 83 … … 99 99 { 100 100 x86_panic((char *)__func__); 101 102 /* Switch the VM space */ 103 // TODO 104 105 /* Switch the CPU context */ 106 cpu_context_switch(old->cpu_context, new->cpu_context); 101 107 } 102 108
Note: See TracChangeset
for help on using the changeset viewer.