Changeset 8262010 in mainline for src/cpu/cpu.c


Ignore:
Timestamp:
2005-04-10T16:36:45Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
23c0c08
Parents:
43114c5
Message:

Switch from mm-based 'the' mechanism to macro-based 'cpu_private_data[CPU_ID_ARCH]' mechanism.
Added l_apic_id() and some other minor APIC changes.
Move gdtr to K_DATA_START section.
Move K_DATA_START section immediately behind K_TEXT_START section so that real-mode addresses work even with growing size of kernel code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/cpu/cpu.c

    r43114c5 r8262010  
    4040#include <list.h>
    4141
    42 cpu_private_page_t *the = NULL;
    43 
     42cpu_private_data_t *cpu_private_data;
    4443cpu_t *cpus;
    4544
     
    5049        if (config.cpu_active == 1) {
    5150        #endif /* __SMP__ */
     51                cpu_private_data = (cpu_private_data_t *) malloc(sizeof(cpu_private_data_t) * config.cpu_count);
     52                if (!cpu_private_data)
     53                        panic("malloc/cpu_private_data");
     54
    5255                cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count);
    5356                if (!cpus)
     
    5558
    5659                /* initialize everything */
     60                memsetb((__address) cpu_private_data, sizeof(cpu_private_data_t) * config.cpu_count, 0);
    5761                memsetb((__address) cpus, sizeof(cpu_t) * config.cpu_count, 0);
    5862   
     
    7175                                list_initialize(&cpus[i].rq[j].rq_head);
    7276                        }
     77                       
     78                        cpu_private_data[i].cpu = &cpus[i];
    7379                }
    7480               
    75                 the = (cpu_private_page_t *) frame_alloc(FRAME_KA | FRAME_PANIC);
    76                 memsetb((__address) the, PAGE_SIZE, 0);
    7781        #ifdef __SMP__
    78         }
    79         else {
    80                 __address frame;
    81                
    82                 frame = frame_alloc(FRAME_KA | FRAME_PANIC);
    83                 memsetb(frame, PAGE_SIZE, 0);
    84                 map_page_to_frame((__address) the, frame, PAGE_CACHEABLE, 1);
    8582        }
    8683        #endif /* __SMP__ */
    8784       
    88         CPU = &cpus[config.cpu_active-1];       
    8985        cpu_identify();
    9086        cpu_arch_init();
Note: See TracChangeset for help on using the changeset viewer.