- /*
- By Marcus Xing
- kernel/global.c
- 全局变量的分配
- */
- #include "type.h"
- #include "const.h"
- #include "ipc.h"
- #include "protect.h"
- #include "console.h"
- #include "tty.h"
- #include "proc.h"
- #include "proto.h"
- u8 GDT_Ptr[6]; /* GDTR的6字节填充值 */
- Descriptor GDT[GDT_SIZE]; /* GDT的结构数组,有GDT_SIZE个Descriptor */
- u8 IDT_Ptr[6]; /* IDTR的6字节填充值 */
- Gate IDT[IDT_SIZE]; /* IDT的结构数组,有IDT_SIZE个Gate */
- u32 d_Disp_Pos = 0; /* 显示位置 */
- TSS tss; /* TSS,低特权级的段跳转到高特权级的段使用 */
- PCB PCB_Table[MAX_PROC]; /* PCB表 */
- PCB* p_Next_PCB; /* 指向下一个运行的进程的PCB */
- int d_Flag_Reenter; /* 判断是否中断重入 */
- u32 d_Cur_Proc_Num; /* 当前进程的个数 */
- /* 各个进程的堆栈空间 */
- u8 All_Proc_Stack_Space[ALL_PROC_STACK_SPACE];
- /* 进程的与众不同的部分的表 */
- Proc_Unique Proc_Unique_Table[MAX_PROC] =
- { /
- {(u32)Proc_A,STACK_A,"PROC A"}, /
- {(u32)Proc_B,STACK_B,"PROC B"}, /
- {(u32)Proc_C,STACK_C,"PROC_C"}, /
- {(u32)Proc_TTY,STACK_PROC_TTY,"PROC_TTY"}, /
- {(u32)Proc_Send_Receive,STACK_PROC_SR,"PROC_SR"} /
- };
- /* 记录是否是系统进程的表 */
- int Is_System_Proc[MAX_PROC] = {0,0,0,1,1};
- /* 外中断处理程序的表,共16个 */
- IRQ_Handler IRQ_Handler_Table[IRQ_NUM];
- /* 系统调用处理函数表,共3个 */
- System_Call_Handler System_Call_Handler_Table[SYSTEM_CALL_HANDLER_NUM] =
- { /
- (u32)Prepare_To_Real_Mode, /
- (u32)System_Call_Write, /
- (u32)System_Call_Send_Receive /
- };
- /* Ticks,每发生一次时钟中断,自增1,无论是否重入 */
- int d_Ticks = 0;
- /* TTY表 */
- TTY TTY_Table[TTY_NUM];
- /* Console表 */
- Console Console_Table[TTY_NUM];
- int Current_Console; /* 当前的控制台 */