Annotation of XNU/iokit/Drivers/platform/drvAppleI386Generic/AppleI386CPU.cpp, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 2000 Apple Computer, Inc.  All rights reserved.
        !             3:  *
        !             4:  * AppleI386CPU.cpp
        !             5:  * 
        !             6:  * March 6, 2000 jliu
        !             7:  *    Created based on AppleCPU.
        !             8:  */
        !             9: 
        !            10: #include "AppleI386CPU.h"
        !            11: 
        !            12: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
        !            13: 
        !            14: #undef super
        !            15: #define super IOCPU
        !            16: 
        !            17: OSDefineMetaClassAndStructors(AppleI386CPU, IOCPU);
        !            18: 
        !            19: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
        !            20: 
        !            21: bool AppleI386CPU::start(IOService * provider)
        !            22: {
        !            23: //  kern_return_t result;
        !            24: 
        !            25:     if (!super::start(provider)) return false;
        !            26: 
        !            27:     cpuIC = new AppleI386CPUInterruptController;
        !            28:     if (cpuIC == 0) return false;
        !            29: 
        !            30:     if (cpuIC->initCPUInterruptController(1) != kIOReturnSuccess)
        !            31:         return false;
        !            32: 
        !            33:     cpuIC->attach(this);
        !            34:     
        !            35:     cpuIC->registerCPUInterruptController();
        !            36: 
        !            37: #ifdef NOTYET
        !            38:     // Register this CPU with mach.
        !            39:     result = ml_processor_register((cpu_id_t)this, 0,
        !            40:                     &machProcessor, &ipi_handler, true);
        !            41:     if (result == KERN_FAILURE) return false;
        !            42: #endif
        !            43: 
        !            44:     cpuState = kIOCPUStateUninitalized;
        !            45: 
        !            46: #ifdef NOTYET
        !            47:     processor_start(machProcessor);
        !            48: #endif
        !            49: 
        !            50:     // Hack. Call initCPU() ourself since no one else will.
        !            51:     initCPU();
        !            52: 
        !            53:     return true;
        !            54: }
        !            55: 
        !            56: void AppleI386CPU::initCPU(void)
        !            57: {
        !            58:     cpuIC->enableCPUInterrupt(this);
        !            59: 
        !            60:     cpuState = kIOCPUStateRunning;
        !            61: }
        !            62: 
        !            63: OSSymbol * AppleI386CPU::getCPUName(void)
        !            64: {
        !            65:     return (OSSymbol *) OSSymbol::withCStringNoCopy("Primary0");
        !            66: }
        !            67: 
        !            68: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
        !            69: 
        !            70: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
        !            71: 
        !            72: #undef super
        !            73: #define super IOCPUInterruptController
        !            74: 
        !            75: OSDefineMetaClassAndStructors(AppleI386CPUInterruptController, 
        !            76:                               IOCPUInterruptController);
        !            77: 
        !            78: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
        !            79: 
        !            80: IOReturn AppleI386CPUInterruptController::handleInterrupt(void * /*refCon*/,
        !            81:                                                           IOService * /*nub*/,
        !            82:                                                           int source)
        !            83: {
        !            84:     IOInterruptVector * vector;
        !            85: 
        !            86:     // Override the implementation in IOCPUInterruptController to
        !            87:     // dispatch interrupts the old way.
        !            88:     //
        !            89:     // source argument is ignored, use the first IOCPUInterruptController
        !            90:     // in the vector array.
        !            91:     //
        !            92:     vector = &vectors[0];
        !            93: 
        !            94:     if (!vector->interruptRegistered)
        !            95:         return kIOReturnInvalid;
        !            96:   
        !            97:     vector->handler(vector->target,
        !            98:                     vector->refCon,
        !            99:                     vector->nub,
        !           100:                     source);
        !           101: 
        !           102:     return kIOReturnSuccess;
        !           103: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.