当前位置:网站首页>BIOS of operating system
BIOS of operating system
2020-11-09 07:30:00 【open_veyfyz58】
Operating system bios、mbr
What happened after the system was powered up
bios It's every chip that comes out and every manufacturer writes about it rom A piece of code , This code runs first after the system is powered on , Responsible for checking whether there are problems with the computer hardware , After confirming that there are no problems , Will go to memory to find the main boot sector mbr, Load the primary boot sector to 0c7c00 The address of ( This part will be explained in detail later ),mbr Will be responsible for loading the operating system in the disk , And then give control to the operating system , thus , Control is left to the operating system .
bios Related content
bios The code is written from the beginning , Put it in rom Inside , therefore ,cpu In the beginning, we should find rom in bios The address of , Then load it to cpu Implementation of , How is this part realized ?
First , The original operating system was 8086 System , The later operating systems are compatible with 8086, So in the first real mode, it's like 8086 System , So let's talk about 8086 System .
8086 yes 16 Bit cpu, But there are 20 Root address bus , therefore , Use base address + Address by offset , Increase the addressing space to 2^20, That is to say 1M Space ( high 16 Bit shift left 4 position , Add low 16 position ).
therefore , At the start of the rom The location determines which address the back system will address at the beginning of power up .
Because different computer manufacturers produce computers with different peripherals , therefore , The size of this program is limited to different models , If the manufacturer A Of rom The size is 1K, manufacturer B Of rom The size is 2K, Then the programmer's starting address will be inconsistent , For the convenience of programmers , It was decided that rom The code for is in 1M At the back of , In this way, programmers can use it from 0 Start writing code , So here comes the question , take BIOS This program is placed in 1M Top of memory , If the program size is 1K, So we should start from 0xFFC00 Let's go . If the size of this program is 2K, that We should start from 0xFF800 Let's go , about CPU for , In the end, we should start from 0xFFC00 It should start with 0xFF800 It's starting to work ?
To solve this problem ,8086 gauge set ,CPU All from 0xFFFF0 Start execution , And in the 0xFFFF0 It's about , Put an unconditional transfer instruction JMP. If A Factory BIOS It's from 0xFFC00 It started to play , So this one The transfer command jumps to 0xFFC00 Start execution . If B Factory BIOS It's from 0xFF800 It started to play , Then the transfer command jumps to 0xFF800 Start execution , Every factory Home can follow what it produces BIOS The size of the program , To determine the specific jump position of the transfer instruction .
thus , The system already knows what to do when powered on ,bios After checking the hardware , Then I decided to load os.
PS: We said bios Put it in rom in , So why does it affect memory , As shown in the figure below :
rom and ram Unified addressing , At the beginning 1M To include rom Of .
mbr Related content
mbr Also called the primary boot sector , To make responsible for will os Load from disk to memory , Why not let bios Direct will os Loading to memory ?
Because when the machine leaves the factory , You can't limit the disk to just one file system , and BIOS It's impossible to identify programs that support all file systems . So for flexibility , Just read through the loader OS.
mbr Its size is 512 Bytes , The last two bytes are 0x55 and 0xAA, Why are these two bytes ?( Baidu to always have an end sign ), These two bytes are used as mbr The end sign of , If you don't have these two end marks ,cpu The disk is not initialized ,
mbr Why 512 Bytes? , This is because mbr It's responsible for loading os The binary code of 446 Bytes , Then the disk has 4 Zones , The information for each partition is 64bytes, And the last two bytes as the end mark ,446+64+2=512bytes
What does the primary boot sector do ? Mainly responsible for reading and writing disk , First, turn on protected mode , Then initialize gdt, Access disk .
Why? mbr Put it on 0x7c00 The location of ?
Operating systems need 32KB Size , It's also at the end .
0x7ffff-512-512+1=0x7c00, Another one 512 Data generated by the primary boot sector itself .
Where is the operating system ?
0x100000, That is to say bios1M Behind .
thus , The loading of the operating system has finished .
At the end
This article refers to many articles , If you feel copied , Please contact me in time , And I'm so sorry .
版权声明
本文为[open_veyfyz58]所创,转载请带上原文链接,感谢
边栏推荐
- Factory Pattern模式(简单工厂、工厂方法、抽象工厂模式)
- 简单介绍c#通过代码开启或关闭防火墙示例
- After Android solves the setrequested orientation, the rotation of the mobile phone screen does not trigger the onconfigurationchanged method
- Android emulator error: x86 emulation currently requires hardware acceleration solution
- The vowels in the inverted string of leetcode
- 上线1周,B.Protocal已有7000ETH资产!
- 深度优先搜索和广度优先搜索
- 14.Kubenetes简介
- leetcode之反转字符串中的元音字母
- 理论与实践相结合彻底理解CORS
猜你喜欢
RabbitMQ脑裂问题解决方案调查
C + + adjacency matrix
On buffer overflow
卧槽,这年轻人不讲武德,应届生凭“小抄”干掉5年老鸟,成功拿到字节20Koffer
几行代码轻松实现跨系统传递 traceId,再也不用担心对不上日志了!
android开发中提示:requires permission android.permission write_settings解决方法
几行代码轻松实现跨系统传递 traceId,再也不用担心对不上日志了!
A few lines of code can easily transfer traceid across systems, so you don't have to worry about losing the log!
Adding OpenGL form to MFC dialog
C++之异常捕获和处理
随机推荐
老大问我:“建表为啥还设置个自增 id ?用流水号当主键不正好么?”
On buffer overflow
RabbitMQ脑裂问题解决方案调查
Tips in Android Development: requires permission android.permission write_ Settings solution
A bunch of code forgot to indent? Shortcut teach you carefree!
Copy on write collection -- copyonwritearraylist
通过canvas获取视频第一帧封面图
Operation 2020.11.7-8
Talk about my understanding of FAAS with Alibaba cloud FC
Do you know how the computer starts?
梁老师小课堂|谈谈模板方法模式
Copy on write collection -- copyonwritearraylist
Why choose f for the back end of dark website? - darklang
Common feature pyramid network FPN and its variants
Travel notes of csp-s 2020
How to reduce the resource consumption of istio agent through sidecar custom resource
当我们聊数据质量的时候,我们在聊些什么?
How to do thread dump analysis in Windows Environment
SaaS: another manifestation of platform commercialization capability
失业日志 11月5日