Ignore:
Timestamp:
Jul 10, 2017, 10:33:15 AM (5 years ago)
Author:
max@…
Message:

make the TLS initialization per-cpu

File:
1 edited

Legend:

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

    r167 r168  
    4343            (*(tls_t * const *)offsetof(tls_t, tls_self)));
    4444        return cputls;
    45 }
    46 
    47 static void hal_tls_load_cpu(tls_t *cputls)
    48 {
    49         wrmsr(MSR_FSBASE, 0);
    50         wrmsr(MSR_GSBASE, (uint64_t)cputls);
    51         wrmsr(MSR_KERNELGSBASE, 0);
    52 }
    53 
    54 void hal_tls_init_cpu0()
    55 {
    56         tls_t *cputls = &cpu0;
    57 
    58         memset(cputls, 0, sizeof(tls_t));
    59 
    60         cputls->tls_self = cputls;
    61         cputls->tls_gid = hal_lapic_gid();
    62         cputls->tls_lid = 0; /* XXX */
    63 
    64         hal_tls_load_cpu(cputls);
    6545}
    6646
Note: See TracChangeset for help on using the changeset viewer.