void Scheduler::waitForFreeKMMLock() //not as severe as stopping Interrupts { if ( block_scheduling_==0 ) arch_panic ( ( uint8* ) "FATAL ERROR: Scheduler::waitForFreeKMMLock: This is meant to be used while Scheduler is locked\n" ); while ( ! KernelMemoryManager::instance()->isKMMLockFree() ) { unlockScheduling(); yield(); lockScheduling(); } }
/* Simple sbrk function */ void* mm_sbrk(unsigned long increment) { int old; void *base = sbrk_base; old = irq_disable(); if(increment & 3) increment = (increment + 4) & ~3; sbrk_base = (void *)(increment + (unsigned long)sbrk_base); if(((uint32)sbrk_base) >= (0x8d000000 - 65536)) { dbglog(DBG_DEAD, "Requested sbrk_base %p, was %p, diff %lu\n", sbrk_base, base, increment); arch_panic("out of memory; about to run over kernel stack"); } irq_restore(old); return base; }
void Scheduler::lockScheduling() //not as severe as stopping Interrupts { if ( unlikely ( ArchThreads::testSetLock ( block_scheduling_,1 ) ) ) arch_panic ( ( uint8* ) "FATAL ERROR: Scheduler::*: block_scheduling_ was set !! How the Hell did the program flow get here then ?\n" ); }