Changeset 32573ff in mainline for kernel/arch/ia32/src/pm.c


Ignore:
Timestamp:
2016-05-02T20:58:16Z (8 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7c4b26c
Parents:
6adb775f (diff), 5035ba05 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline, which has dltest and fixes.

File:
1 edited

Legend:

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

    r6adb775f r32573ff  
    4141#include <panic.h>
    4242#include <arch/mm/page.h>
     43#include <mm/km.h>
     44#include <mm/frame.h>
    4345#include <mm/slab.h>
    4446#include <memstr.h>
     
    5153
    5254/*
    53  * We have no use for segmentation so we set up flat mode. In this
    54  * mode, we use, for each privilege level, two segments spanning the
     55 * We don't have much use for segmentation so we set up flat mode.
     56 * In this mode, we use, for each privilege level, two segments spanning the
    5557 * whole memory. One is for code and one is for data.
    5658 *
    57  * One is for GS register which holds pointer to the TLS thread
    58  * structure in it's base.
     59 * One special segment apart of that is for the GS register which holds
     60 * a pointer to the VREG page in its base.
    5961 */
    6062descriptor_t gdt[GDT_ITEMS] = {
     
    7173        /* TSS descriptor - set up will be completed later */
    7274        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    73         /* TLS descriptor */
    74         { 0xffff, 0, 0, AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER, 0xf, 0, 0, 1, 1, 0 },
     75        /* VREG descriptor - segment used for virtual registers, will be reinitialized later */
     76        { 0xffff, 0 , 0, AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER, 0xf, 0, 0, 1, 1, 0 },
    7577        /* VESA Init descriptor */
    7678#ifdef CONFIG_FB
     
    8284static idescriptor_t idt[IDT_ITEMS];
    8385
    84 static tss_t tss;
     86static tss_t tss0;
    8587
    8688tss_t *tss_p = NULL;
     
    9597{
    9698        d->base_0_15 = base & 0xffff;
    97         d->base_16_23 = ((base) >> 16) & 0xff;
    98         d->base_24_31 = ((base) >> 24) & 0xff;
     99        d->base_16_23 = (base >> 16) & 0xff;
     100        d->base_24_31 = (base >> 24) & 0xff;
    99101}
    100102
     
    265267                 * the heap hasn't been initialized so far.
    266268                 */
    267                 tss_p = &tss;
    268         }
    269         else {
     269                tss_p = &tss0;
     270        } else {
    270271                tss_p = (tss_t *) malloc(sizeof(tss_t), FRAME_ATOMIC);
    271272                if (!tss_p)
     
    292293}
    293294
    294 void set_tls_desc(uintptr_t tls)
    295 {
    296         ptr_16_32_t cpugdtr;
    297         descriptor_t *gdt_p;
    298 
    299         gdtr_store(&cpugdtr);
    300         gdt_p = (descriptor_t *) cpugdtr.base;
    301         gdt_setbase(&gdt_p[TLS_DES], tls);
    302         /* Reload gdt register to update GS in CPU */
    303         gdtr_load(&cpugdtr);
    304 }
    305 
    306295/** @}
    307296 */
Note: See TracChangeset for help on using the changeset viewer.