Changeset 165 for trunk/hal/x86_64


Ignore:
Timestamp:
Jul 10, 2017, 9:13:04 AM (7 years ago)
Author:
max@…
Message:

put the per-cpu structures into one structure

File:
1 edited

Legend:

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

    r164 r165  
    313313/* -------------------------------------------------------------------------- */
    314314
     315/* x86-specific per-cluster structures */
    315316uint8_t gdtstore[PAGE_SIZE] __in_kdata;
    316317uint8_t idtstore[PAGE_SIZE] __in_kdata;
    317 struct tss cpu_tss[CONFIG_MAX_LOCAL_CORES] __in_kdata;
    318 uint8_t cpu_intr_stack[CONFIG_MAX_LOCAL_CORES][STKSIZE] __in_kdata;
    319 uint8_t cpu_dbfl_stack[CONFIG_MAX_LOCAL_CORES][STKSIZE] __in_kdata;
    320 uint8_t cpu_nmfl_stack[CONFIG_MAX_LOCAL_CORES][STKSIZE] __in_kdata;
     318
     319/* x86-specific per-cpu structures */
     320typedef struct {
     321        struct tss tss;
     322        uint8_t intr_stack[STKSIZE];
     323        uint8_t dbfl_stack[STKSIZE];
     324        uint8_t nmfl_stack[STKSIZE];
     325} percpu_archdata_t;
     326percpu_archdata_t cpudata[CONFIG_MAX_LOCAL_CORES] __in_kdata;
    321327
    322328static void
     
    437443/* -------------------------------------------------------------------------- */
    438444
    439 /*
    440  * The gdt bitmap must be per-cluster.
    441  */
    442445int tss_alloc(struct tss *tss, size_t lid)
    443446{
    444447        int slot;
    445448
    446         /* Once we have proper SMP support, we will change that */
    447449        slot = GDT_CPUTSS_SEL + lid;
    448450
     
    455457void cpu_create_tss(size_t lid)
    456458{
    457         struct tss *tss = &cpu_tss[lid];
     459        percpu_archdata_t *data = &cpudata[lid];
     460        struct tss *tss = &data->tss;
    458461        int sel;
    459462
     
    462465
    463466        /* tss->tss_rsp0 */
    464         tss->tss_ist[0] = (uint64_t)cpu_intr_stack[lid] + STKSIZE;
    465         tss->tss_ist[1] = (uint64_t)cpu_dbfl_stack[lid] + STKSIZE;
    466         tss->tss_ist[2] = (uint64_t)cpu_nmfl_stack[lid] + STKSIZE;
     467        tss->tss_ist[0] = (uint64_t)data->intr_stack[lid] + STKSIZE;
     468        tss->tss_ist[1] = (uint64_t)data->dbfl_stack[lid] + STKSIZE;
     469        tss->tss_ist[2] = (uint64_t)data->nmfl_stack[lid] + STKSIZE;
    467470        tss->tss_iobase = IOMAP_INVALOFF << 16;
    468471        sel = tss_alloc(tss, lid);
Note: See TracChangeset for help on using the changeset viewer.