Changeset 342


Ignore:
Timestamp:
Aug 8, 2017, 11:17:28 AM (7 years ago)
Author:
max@…
Message:

Initialize tf_ss, and don't forget to update tls_thr.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/core/hal_context.c

    r339 r342  
    7575        if (thread->type == THREAD_USER) {
    7676                tf->tf_cs = GDT_FIXED_SEL(GDT_UCODE_SEL, SEL_UPL);
     77                tf->tf_ss = GDT_FIXED_SEL(GDT_UDATA_SEL, SEL_UPL);
    7778                tf->tf_rsp = ((uint64_t)thread->u_stack_base) +
    7879                    thread->u_stack_size;
    7980        } else {
    8081                tf->tf_cs = GDT_FIXED_SEL(GDT_KCODE_SEL, SEL_KPL);
     82                tf->tf_ss = GDT_FIXED_SEL(GDT_KDATA_SEL, SEL_KPL);
    8183                tf->tf_rsp = kstacktop;
    8284        }
     
    98100void hal_cpu_context_switch(thread_t *old, thread_t *new)
    99101{
    100         x86_panic((char *)__func__);
     102        curtls()->tls_thr = new;
    101103
    102104        /* Switch the VM space */
Note: See TracChangeset for help on using the changeset viewer.