www.pudn.com > LFYOS.zip > os_struct.h


 
#ifndef OS_OS_STRUCT 
#define OS_OS_STRUCT 
 
struct cpu_information{ 
	int thread_id; 
	struct{ 
		int thread_id,process_id; 
		struct thread_physical_block physical_block; 
	}last; 
}; 
 
#define RESET_CPU_INFORMATION(info)				\ 
{								\ 
	(info).last.thread_id=(-1);				\ 
	(info).last.process_id=(-1);				\ 
	RESET_PHYSICAL_BLOCK((info).last.physical_block,(-2));	\ 
} 
 
struct os_data{ 
	struct{ 
		struct cpu_information used_cpu[VIRTUAL_CPU_NUMBER]; 
		struct{ 
			int cpu_id; 
		}free_cpu[VIRTUAL_CPU_NUMBER]; 
		int free_cpu_top; 
	}virtual_cpu; 
 
	struct process process[PROCESS_NUMBER]; 
 
	struct thread thread[THREAD_NUMBER]; 
	struct{ 
		struct thread_heap run_heap[VIRTUAL_CPU_NUMBER]; 
		struct thread_heap ready_heap[THREAD_NUMBER]; 
		int run_thread_number,ready_thread_number; 
	}thread_heap; 
	struct semaphore semaphore[SEMAPHORE_NUMBER]; 
	struct{ 
		int semaphore_id; 
	}semaphore_heap[SEMAPHORE_NUMBER]; 
	struct kernel_time current_time; 
	struct system_file_information system_file[MEMORY_BODY_NUMBER]; 
	struct capability system_capability; 
}; 
 
struct current_information { 
	struct thread_environment *env; 
	struct return_stack *rt; 
	struct thread *t; 
	struct cpu_information *cpu_info; 
	union system_call_parameter *par; 
	int thread_id,cpu_id,return_stack_top; 
}; 
extern struct current_information current; 
 
#endif