Giter Site home page Giter Site logo

minios's Introduction

MiniOS

操作系统真相还原MiniOS

minios's People

Contributors

alruddy avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar Archer avatar

minios's Issues

完善MBR

Section和Segment的区别

Section 是由程序员指定的逻辑划分的段,又称为节, 如代码段、数据段、附加段
Segment 是由编译器完成的,对于具有相同属性的Section进行整合,用于在内存中加载的段,属性指rwx之类

vstart的作用

vstart用于指定逻辑段的起始地址, 在section中,大部分的地址都是偏移地址

保护模式

实模式与保护模式比较

  1. 实模式下地址线是16位,使用基址:段内偏移方式扩展后是20位,最多可以访问1M的空间; 保护模式下地址线可扩展到32位甚至64位,可以访问更多的空间, 而且寻址的基址也不需要移位。
  2. 实模式下用户和操作系统对内存具有相同的等级,对于各个地址内存都可以访问。保护模式下有特权级,对不应该被访问的内存进行保护。
  3. 保护模式下的寄存器和指令也得到扩展
  4. 保护模式下对于段的描述不再使用实际地址,而是使用选择子和全局描述符

全局描述符GDT

是一个8字节的数据,用来描述保护模式下内存段的登记结构

31-24 23 22 21 20 19-16 15 14-13 12 11-18 7-0
段基址31-24 G D/B L AVL 段界限19~16 P DPL 14-13 S TYPE 段基址23-16
31-16 15-0
段基址15-0 段界限15-0

选择子

4 字节

15-3 2 1-0
描述符索引 TI RPL

GDT寄存器

6字节

47-16 15-0
GDT起始地址 GDT界限

打开保护模式步骤

  • 打开A20地址线 也就是0x92的1位置1
  • 加载gdt, 使用lgdt指令加载gdt
  • 打开保护模式字段 cr0控制寄存器的pe字段, 第0位置1

让MBR先飞一会儿

计算机启动过程

程序载入内存: 程序被加载到内存里面, CPU的CS:IP寄存器被指向这个程序的起始地址

计算机启动接力

BIOS: 基本输入输出系统 BASIC I/O SYSTEM
MBR: 主引导记录 MAIN BOOT RECORD
OBR: 操作系统引导记录 OS BOOT RECORD

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.