Subversion Repositories HelenOS

Rev

Rev 4055 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4055 Rev 4156
Line 57... Line 57...
57
 */
57
 */
58
void before_thread_runs_arch(void)
58
void before_thread_runs_arch(void)
59
{
59
{
60
    uintptr_t kstk = (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE -
60
    uintptr_t kstk = (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE -
61
        SP_DELTA];
61
        SP_DELTA];
62
 
62
   
63
    /* Set kernel stack for CP3 -> CPL0 switch via SYSENTER */
63
    /* Set kernel stack for CP3 -> CPL0 switch via SYSENTER */
64
    write_msr(IA32_MSR_SYSENTER_ESP, kstk);
64
    write_msr(IA32_MSR_SYSENTER_ESP, kstk);
65
 
65
   
66
    /* Set kernel stack for CPL3 -> CPL0 switch via interrupt */
66
    /* Set kernel stack for CPL3 -> CPL0 switch via interrupt */
67
    CPU->arch.tss->esp0 = kstk;
67
    CPU->arch.tss->esp0 = kstk;
68
    CPU->arch.tss->ss0 = selector(KDATA_DES);
68
    CPU->arch.tss->ss0 = gdtselector(KDATA_DES);
69
 
69
   
70
    /* Set up TLS in GS register */
70
    /* Set up TLS in GS register */
71
    set_tls_desc(THREAD->arch.tls);
71
    set_tls_desc(THREAD->arch.tls);
72
}
72
}
73
 
73
 
74
void after_thread_ran_arch(void)
74
void after_thread_ran_arch(void)