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

📄 system.h

📁 哈工大的几个人开发的操作系统pyos的部分源码
💻 H
字号:
#ifndef _PYOS_SYSTEM_H_
#define _PYOS_SYSTEM_H_

#include "system_invoke.h"
/*************************************************
定义系统所需要的一些结构
**************************************************/

/* GDT表项结构 */
struct struct_pyos_GdtItem{  
  unsigned short SegLengthLimit_0_15 ; // 段限0~15位
  unsigned short SegBaseAddr_0_15 ; // 基址的 0~15 位
  unsigned char SegBaseAddr_16_23 ; //基址的16~23位
  unsigned char Type : 4 ;  //type位
  unsigned char S : 1 ; //S位
  unsigned char DPL : 2 ; // 特权位
  unsigned char P : 1 ; //P位
  unsigned char SegLengthLimit_16_19 : 4 ; //段限的16~19位
  unsigned char AVL : 1 ;//AVL位
  unsigned char Saved : 1 ; //保留位,必须为0
  unsigned char DorB : 1 ; //D/B位
  unsigned char G : 1 ; //G位
  unsigned char SegBaseAddr_24_31 ; //基址的24~31位
} ;

/* GDT表 */
struct struct_pyos_Gdt{ 
  struct_pyos_GdtItem gdtNull ;       //空段,Intel保留
  struct_pyos_GdtItem gdtSystemCode ; //系统代码段
  struct_pyos_GdtItem gdtSystemDate ; //系统数据段

  /* 系统调用门 */
  struct_pyos_InvokeGate InvokeGate[ 2 ] ; 
} ;

/* GDTR寄存器所用描述符 */
struct struct_pyos_Gdtr{ 
  unsigned short GdtLengthLimit ;
  struct_pyos_Gdt *GdtAddr;
} ;

/* 定义系统类 */
class class_pyos_System{  
  friend class class_pyos_SystemInvoke ;
  protected:
    class_pyos_System(){} ;
    static struct_pyos_Gdtr m_Gdtr ;    
    static void InitGdt() ; // 初始化Gdt表
    static void InitSegRegister() ;
    static struct_pyos_Gdtr m_gdtr ;
    static struct_pyos_Gdt m_gdt ;

  public:    
    static void Init() ; // 系统初始化
    static unsigned char FromPort( unsigned short port ) ; // 读端口
    static void ToPort( unsigned short port , unsigned char data ) ; // 向端口输出
} ;

#endif

⌨️ 快捷键说明

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