⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_struct.h

📁 国内一位牛人自己开发的操作系统
💻 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 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -