Example #1
0
ARMKernel::ARMKernel(ARMInterrupt *intr,
                     CoreInfo *info)
    : Kernel(info)
{
    NOTICE("");

    // Setup interrupt callbacks
    m_intControl = intr;
    intr->install(ARMInterrupt::UndefinedInstruction, undefinedInstruction);
    intr->install(ARMInterrupt::SoftwareInterrupt, trap);
    intr->install(ARMInterrupt::PrefetchAbort, prefetchAbort);
    intr->install(ARMInterrupt::DataAbort, dataAbort);
    intr->install(ARMInterrupt::Reserved, reserved);
    intr->install(ARMInterrupt::IRQ, interrupt);
    intr->install(ARMInterrupt::FIQ, interrupt);

    // Enable clocks and irqs
    m_timer = &m_bcmTimer;
    m_bcmTimer.setFrequency( 250 ); /* trigger timer interrupts at 250Hz (clock runs at 1Mhz) */
    m_intControl->enable(BCM_IRQ_SYSTIMERM1);

    // Set ARMCore modes
    ARMControl ctrl;
    ctrl.unset(ARMControl::AlignmentCorrect);
    ctrl.set(ARMControl::AlignmentFaults);
    ctrl.unset(ARMControl::BigEndian);
}
Example #2
0
ARMKernel::ARMKernel(Memory::Range kernel,
                     Memory::Range memory,
                     ARMInterrupt *intr,
                     Address tags)
    : Kernel(kernel, memory), m_tags(tags)
{    
    NOTICE("");

    m_intControl = intr;
    intr->install(ARMInterrupt::UndefinedInstruction, undefinedInstruction);
    intr->install(ARMInterrupt::SoftwareInterrupt, trap);
    intr->install(ARMInterrupt::PrefetchAbort, prefetchAbort);
    intr->install(ARMInterrupt::DataAbort, dataAbort);
    intr->install(ARMInterrupt::Reserved, reserved);
    intr->install(ARMInterrupt::IRQ, interrupt);
    intr->install(ARMInterrupt::FIQ, interrupt);

    // Enable clocks and irqs
    m_timer.setInterval( 250 ); /* trigger timer interrupts at 250Hz (clock runs at 1Mhz) */
    m_intControl->enable(BCM_IRQ_SYSTIMERM1);

    // Set ARMCore modes
    ARMControl ctrl;
    ctrl.unset(ARMControl::AlignmentCorrect);
    ctrl.set(ARMControl::AlignmentFaults);
    ctrl.unset(ARMControl::BigEndian);
}
Example #3
0
extern C int kernel_main(u32 r0, u32 r1, u32 r2)
{
    // Invalidate all caches now
    Arch::Cache cache;
    cache.invalidate(Cache::Unified);

#ifdef ARMV7
    // Raise the SMP bit for ARMv7
    ARMControl ctrl;
    ctrl.set(ARMControl::SMPBit);
#endif

    // Retrieve boot image from ATAGS
    Arch::MemoryMap mem;
    BroadcomInterrupt irq;
    ARMTags tags(r2);
    Memory::Range initrd = tags.getInitRd2();

    // Fill coreInfo
    MemoryBlock::set(&coreInfo, 0, sizeof(CoreInfo));
    coreInfo.bootImageAddress = initrd.phys;
    coreInfo.bootImageSize    = initrd.size;
    coreInfo.kernel.phys      = 0;
    coreInfo.kernel.size      = MegaByte(4);
    coreInfo.memory.phys      = 0;
    coreInfo.memory.size      = MegaByte(512);

    // Initialize heap
    Kernel::heap( MegaByte(3), MegaByte(1) );

    // TODO: put this in the boot.S, or maybe hide it in the support library? maybe a _run_main() or something.
    constructors();

    // Open the serial console as default Log
    RaspiSerial console;
    console.setMinimumLogLevel(Log::Notice);

    // Create the kernel
    ARMKernel kernel(&irq, &coreInfo);

    // Run the kernel
    return kernel.run();
}
Example #4
0
extern C int kernel_main(u32 r0, u32 r1, u32 r2)
{
    Arch::MemoryMap mem;
    BroadcomInterrupt irq;
    ARMTags tags(r2);
    Memory::Range initrd = tags.getInitRd2();

    // Fill coreInfo
    MemoryBlock::set(&coreInfo, 0, sizeof(CoreInfo));
    coreInfo.bootImageAddress = initrd.phys;
    coreInfo.bootImageSize    = initrd.size;
    coreInfo.kernel.phys      = 0;
    coreInfo.kernel.size      = MegaByte(4);
    coreInfo.memory.phys      = 0;
    coreInfo.memory.size      = MegaByte(512);

    // Initialize heap
    Kernel::heap( MegaByte(3), MegaByte(1) );

    // TODO: put this in the boot.S, or maybe hide it in the support library? maybe a _run_main() or something.
    constructors();

    // Open the serial console as default Log
    RaspiSerial console;
    console.setMinimumLogLevel(Log::Notice);

    // Create the kernel
    ARMKernel kernel(&irq, &coreInfo);

    // Print some info
    DEBUG("ATAGS = " << r2);
    ARMControl ctrl;
    DEBUG("MainID = " << ctrl.read(ARMControl::MainID));
    ctrl.write(ARMControl::UserProcID, 11223344);
    DEBUG("UserProcID = " << ctrl.read(ARMControl::UserProcID));

    // Run the kernel
    return kernel.run();
}
Example #5
0
extern C int kernel_main(u32 r0, u32 r1, u32 r2)
{
    Arch::MemoryMap mem;
    BCM2835Interrupt irq;

    // Initialize heap
    Kernel::heap( MegaByte(3), MegaByte(1) );

    // TODO: put this in the boot.S, or maybe hide it in the support library? maybe a _run_main() or something.
    constructors();

    // Open the serial console as default Log
    RaspiSerial console;
    console.setMinimumLogLevel(Log::Notice);

    // Kernel memory range
    Memory::Range kernelRange;
    kernelRange.phys = 0;
    kernelRange.size = MegaByte(4);

    // RAM physical range
    Memory::Range ramRange;
    ramRange.phys = 0;
    ramRange.size = MegaByte(512);

    // Create the kernel
    ARMKernel kernel(kernelRange, ramRange, &irq, r2);

    // Print some info
    DEBUG("ATAGS = " << r2);
    ARMControl ctrl;
    DEBUG("MainID = " << ctrl.read(ARMControl::MainID));
    ctrl.write(ARMControl::UserProcID, 11223344);
    DEBUG("UserProcID = " << ctrl.read(ARMControl::UserProcID));

    // Run the kernel
    return kernel.run();
}