Changeset 8262010 in mainline for arch/ia32/src/smp/apic.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
  • arch/ia32/src/smp/apic.c

    r43114c5 r8262010  
    2727 */
    2828
    29 #ifdef __SMP__
    30 
    3129#include <arch/types.h>
    3230#include <arch/smp/apic.h>
     
    3937#include <arch/asm.h>
    4038#include <arch.h>
     39
     40#ifdef __SMP__
    4141
    4242/*
     
    222222{
    223223        __u32 tmp, t1, t2;
    224        
     224        int cpu_id = config.cpu_active - 1;
     225       
     226
     227        /*
     228         * Here we set local APIC ID's so that they match operating system's CPU ID's
     229         * This operation is dangerous as it is model specific.
     230         * TODO: some care should be taken.
     231         * NOTE: CPU may not be used to define APIC ID
     232         */
     233        if (l_apic_id() != cpu_id) {
     234                l_apic[L_APIC_ID] &= L_APIC_IDClear;
     235                l_apic[L_APIC_ID] |= (l_apic[L_APIC_ID]&L_APIC_IDClear)|((cpu_id)<<L_APIC_IDShift);
     236        }
    225237
    226238        l_apic[LVT_Err] |= (1<<16);
     
    271283        int i, lint;
    272284
    273         printf("LVT on cpu%d, LAPIC ID: %d\n", CPU->id, (l_apic[L_APIC_ID] >> 24)&0xf);
     285        printf("LVT on cpu%d, LAPIC ID: %d\n", CPU->id, l_apic_id());
    274286
    275287        printf("LVT_Tm: ");
     
    305317         * This register is supported only on P6 and higher.
    306318         */
    307         if (CPU->family > 5) {
     319        if (CPU->arch.family > 5) {
    308320                printf("LVT_PCINT: ");
    309321                if (l_apic[LVT_PCINT] & (1<<16)) printf("masked"); else printf("not masked"); putchar(',');
     
    324336        l_apic_eoi();
    325337        clock();
     338}
     339
     340__u8 l_apic_id(void)
     341{
     342        return (l_apic[L_APIC_ID] >> L_APIC_IDShift)&L_APIC_IDMask;
    326343}
    327344
Note: See TracChangeset for help on using the changeset viewer.