void _set_taskn_status(unsigned char taskno, unsigned char state){ if (taskno < _task_count){ #asm("CLI"); _task_status[taskno] = state; _task_switch(); } }
void _set_task_status(unsigned char state){ if (_current_task < _task_count){ #asm("CLI"); _task_status[_current_task] = state; _task_switch(); } }
void _task_delay(unsigned int ticks) { #asm("CLI"); _task_tick_count[_current_task] = ticks; _task_status[_current_task] = TASK_WAIT_TIME; _task_switch(); }
void main(phys_addr_t m_start) { // Record the address of the start of physical RAM. mem_start = m_start; call_initcalls(&_system_initcall_begin, &_system_initcall_end); call_initcalls(&_early_initcall_begin, &_early_initcall_end); print_str("PicardOS v0.1 booting...\n"); call_initcalls(&_initcall_begin, &_initcall_end); /* * Fork user processes. */ up *current_up = (up *)&_up_begin; while (current_up != (up *)&_up_end) { _fork((unsigned int)current_up->u_fn, current_up->s_size); current_up++; } _task_switch(); }
unsigned char _wait_semaphore(unsigned int ticks){ if (_task_count){ #asm("CLI"); _task_status[_current_task] = TASK_WAIT_SEMA; if (ticks){ _task_tick_count[_current_task] = ticks; _task_status[_current_task] |= TASK_WAIT_TIME; } _task_switch(); } return _task_status[_current_task]&TASK_TIMEOUT?TASK_TIMEOUT:_task_status[_current_task]>>4; }