Subversion Repositories HelenOS

Rev

Rev 2630 | Rev 3892 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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