Changeset 281b607 in mainline for arch/ia32/src/pm.c


Ignore:
Timestamp:
2006-03-23T10:29:39Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a0bb10ef
Parents:
9aa72b4
Message:

Added basic kernel infrastructure for ThreadLocalStorage(TLS) for
ia32(complete),amd64(complete),mips32(missing emulation of rdhwr instruction).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/src/pm.c

    r9aa72b4 r281b607  
    4949 * mode, we use, for each privilege level, two segments spanning the
    5050 * whole memory. One is for code and one is for data.
     51 *
     52 * One is for GS register which holds pointer to the TLS thread
     53 * structure in it's base.
    5154 */
    5255struct descriptor gdt[GDT_ITEMS] = {
     
    6265        { 0xffff, 0, 0, AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER, 0xf, 0, 0, 1, 1, 0 },
    6366        /* TSS descriptor - set up will be completed later */
    64         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
     67        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
     68        { 0xffff, 0, 0, AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER, 0xf, 0, 0, 1, 1, 0 }
    6569};
    6670
     
    215219        clean_AM_flag();          /* Disable alignment check */
    216220}
     221
     222void set_tls_desc(__address tls)
     223{
     224        struct ptr_16_32 cpugdtr;
     225        struct descriptor *gdt_p = (struct descriptor *) cpugdtr.base;
     226
     227        __asm__ volatile ("sgdt %0\n" : : "m" (cpugdtr));
     228
     229        gdt_setbase(&gdt_p[TLS_DES], tls);
     230        /* Reload gdt register to update GS in CPU */
     231        __asm__ volatile ("lgdt %0\n" : : "m" (cpugdtr));
     232}
Note: See TracChangeset for help on using the changeset viewer.