当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- 服务网格仍然很难 - cncf
- 你有没有想过为什么交易和退款要拆开不同的表
- Android emulator error: x86 emulation currently requires hardware acceleration的解决方案
- C / C + + Programming Notes: pointer! Understand pointer from memory, let you understand pointer completely
- 六家公司CTO讲述曾经历的“宕机噩梦”
- 2020,Android开发者打破寒冬的利器是什么?
- C++之异常捕获和处理
- Huawei HCIA notes
- python生日贺卡制作以及细节问题的解决最后把python项目发布为exe可执行程序过程
- Five design patterns frequently used in development
猜你喜欢

华为HCIA笔记

23 pictures, take you to the recommended system

Adding OpenGL form to MFC dialog

第五章编程

Finally, the python project is released as exe executable program process

基于链表的有界阻塞队列 —— LinkedBlockingQueue

老大问我:“建表为啥还设置个自增 id ?用流水号当主键不正好么?”

老大问我:“建表为啥还设置个自增 id ?用流水号当主键不正好么?”

Introduction to nmon

Copy on write collection -- copyonwritearraylist
随机推荐
Chapter 5 programming
架构中台图
非阻塞的无界线程安全队列 —— ConcurrentLinkedQueue
A brief introduction of C code to open or close the firewall example
《MFC dialog中加入OpenGL窗体》
RabbitMQ脑裂问题解决方案调查
对象
教你如何 分析 Android ANR 问题
1. What does the operating system do?
基于链表的有界阻塞队列 —— LinkedBlockingQueue
AQS 都看完了,Condition 原理可不能少!
华为HCIA笔记
Introduction to nmon
ubuntu 上使用微信的新方案——手机投屏
Share API on the web
你有没有想过为什么交易和退款要拆开不同的表
几行代码轻松实现跨系统传递 traceId,再也不用担心对不上日志了!
Factory Pattern模式(简单工厂、工厂方法、抽象工厂模式)
python生日贺卡制作以及细节问题的解决最后把python项目发布为exe可执行程序过程
On buffer overflow