reactos:reactos操作系统实现(25)

  在操作系统里有时候需要从保护模式转换为实模式来BIOS些功能因此在硬件抽象层里就需要提供这样支持这个代码如下:

#001  BOOLEAN
#002  NTAPI
#003  HalpBiosDisplayRe(VOID)
#004  {
#005      ULONG Flags = 0;
#006 


  保存CPU所有状态寄存器然后关闭中断

#007      /* Disable errupts */
#008      Ke386SaveFlags(Flags);
#009      _disable;
#010 


  映射内存到虚拟8086实模式

#011      /* Map memory available to the V8086 real-mode code */
#012      HalpMapRealModeMemory;
#013 


  切换到实模式中断处理

#014      /* Use special invalid opcode and GPF trap handlers */
#015      HalpSwitchToRealModeTrapHandlers;
#016 


  配置实模式IOPM和TSS

#017      /* Configure the IOPM and TSS */
#018      HalpSetupRealModeIoPermissionsAndTask;
#019 


  现在开始在实模式里BIOS功能

#020      /* Now jump to real mode */
#021      HalpBiosCall;
#022 


  恢复中断处理

#023      /* Restore kernel trap handlers */
#024      HalpRestoreTrapHandlers;
#025   


  恢复TSS和IOPM

#026      /* Restore TSS and IOPM */
#027      HalpRestoreIoPermissionsAndTask;
#028 


  恢复低端内存

#029      /* Restore low memory mapping */
#030      HalpUnmapRealModeMemory;
#031 


  恢复保存状态寄存器

#032      /* Restore errupts  they were previously enabled */
#033      Ke386RestoreFlags(Flags);
#034       TRUE;
#035  }


  上面是保存了现场状态后就切换到虚拟8086实模式这样才可以BIOS功能这是由于在保护模式下不能运行BIOS决定

Tags:  reactos安装 reactos

延伸阅读

最新评论

发表评论