一步步编写操作系统21 x86虚拟机bochs 跟踪bios

为了让大家更好的理解bios是怎样被执行的,也就是计算机中第一个软件是怎样开始的,咱们还是先看下图3-17。在图的上面第5行,显示的是下一条待执行的指令,这是程序计数器(PC)中的值,在x86上的程序计数器是指cs:ip。大家看,cs是0xf000,ip是fff0,所以最终地址是0xffff0,这是bios的入口地址:低端1M内存最顶端的16字节。忘记的同学翻看以往文章中有介绍实模式下的内存布局。在右边的jmp far f000:e05b,是指此内存0xffff0处的内容,在内存中,内容不是普通数据就是指令,在此处就是条跳转指令。这是咱们之前分析bios时所说的,1M内存的最顶端只有16字节,肯定容不下完整bios代码,必然是条跳转指令。由此可见,果然没错,它是跳转到0xf000:e05b的地方了。咱们需要验证一下内存0xffff0处的内容是不是jmp far f000:e05b。

验证的方法有多种,不过先来个简单粗暴可依赖的,咱们查看此处内存的内容是什么。内容如图:

由于默认xp是以4字节来显示,所以xp中斜杠后面指定的数字2,最终会让xp显示8个字节。提醒一下,咱们bochs模拟的是x86平台,它是小端字节序。咱们只看1个4字节,先从低地址看,最低位是ea,这是直接绝对远转移jmp far的机器码,高位的是0xe05b,这是jmp far的操作数,待跳转到的地址,如果忘记指令格式的同学,赶紧到前面找到IA32指令格式回忆一下。

这与程序计数器(cs:ip)中指定的内容是吻合的,不过咱们还是不太放心,也许您说,万一0x00e05bea只是普通数据呢,我又对机器码不熟,不许忽悠我。为了打消您的疑虑,那再用一种方法来验证一下吧。

在“Debugger control”类中,有个命令U,它用来将内存数据反汇编成指令。咱们看一下此命令的帮助。help u回车后效果如图:

大概意思是说,u和disasm是一样的命令,用哪个都行,其用法是在后面跟需要汇编的指令数,起始线性地址,终止线性地址。由于我们在实模式下,线性地址就是物理地址。键入 u/1 0xffff0回车,效果如图:

果然没有忽悠大家,地址0xffff0处的内容确实是指令,并且是jmp far f000:e05b。这下大家对理解bios启动应该更深刻一些了。

以上内容来自《操作系统真象还原》,请大家支持正版,多谢。

【再续】

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/439859.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【CodeForces - 361D】Levko and Array (二分,dp)

题干: Levko has an array that consists of integers: a1, a2, ... , an. But he doesn’t like this array at all. Levko thinks that the beauty of the array a directly depends on value c(a), which can be calculated by the formula: The less value…

5.深度学习练习:Deep Neural Network for Image Classification: Application

本文节选自吴恩达老师《深度学习专项课程》编程作业,在此表示感谢。 课程链接:https://www.deeplearning.ai/deep-learning-specialization/ After this assignment you will be able to: Build and apply a deep neural network to supervised learning…

排序集锦(各种排序算法的特点及性能分析)

关于排序,似乎很简单的很常见的概念,却蕴含着很多技术,下面是从不同的角度,对排序的总结: 直插希 冒泡快 选择堆 1 按照排序特性分类 首先按照排序本身的操作特性可以分为下面几种: 插入排序 直接插入排…

【CodeForces - 689D】Friends and Subsequences(RMQ,二分 或单调队列)

题干: Mike and !Mike are old childhood rivals, they are opposite in everything they do, except programming. Today they have a problem they cannot solve on their own, but together (with you) — who knows? Every one of them has an integer seque…

6.深度学习练习:Initialization

本文节选自吴恩达老师《深度学习专项课程》编程作业,在此表示感谢。 课程链接:https://www.deeplearning.ai/deep-learning-specialization/ 目录 1 - Neural Network model 2 - Zero initialization 3 - Random initialization(掌握&…

Java Object类的各个方法

Java中所有的类都继承自java.lang.Object类&#xff0c;Object类中一共有11个方法&#xff1a; public final native Class<?> getClass();public native int hashCode();public boolean equals(Object obj) {return (this obj); }protected native Object clone() th…

【CodeForces - 602D】Lipshitz Sequence(思维,单调栈,斜率单调性)

题干&#xff1a; A function is called Lipschitz continuous if there is a real constant Ksuch that the inequality |f(x) - f(y)| ≤ K|x - y| holds for all . Well deal with a more... discrete version of this term. For an array , we define its Lipschi…

7.深度学习练习:Regularization

本文节选自吴恩达老师《深度学习专项课程》编程作业&#xff0c;在此表示感谢。 课程链接&#xff1a;https://www.deeplearning.ai/deep-learning-specialization/ 目录 1-Package 2 - Non-regularized model 3 - L2 Regularization&#xff08;掌握&#xff09; 4-Dropou…

深入详解JVM内存模型与JVM参数详细配置

本系列会持续更新。 JVM基本是BAT面试必考的内容&#xff0c;今天我们先从JVM内存模型开启详解整个JVM系列&#xff0c;希望看完整个系列后&#xff0c;可以轻松通过BAT关于JVM的考核。 BAT必考JVM系列专题 1.JVM内存模型 2.JVM垃圾回收算法 3.JVM垃圾回收器 4.JVM参数详解 5…

【2019牛客暑期多校训练营(第三场)- A】Graph Games(思维,对边分块)

题干&#xff1a; 链接&#xff1a;https://ac.nowcoder.com/acm/contest/883/A 来源&#xff1a;牛客网 You are given an undirected graph with N\ N N vertices and M\ M M edges. The edges are numbered from 1\ 1 1 to M\ M M . Denote the set S(x)\ S(x) S…

8.深度学习练习:Gradient Checking

本文节选自吴恩达老师《深度学习专项课程》编程作业&#xff0c;在此表示感谢。 课程链接&#xff1a;https://www.deeplearning.ai/deep-learning-specialization/ 目录 1) How does gradient checking work? 2) 1-dimensional gradient checking 3) N-dimensional gradie…

苹果手机看电流判断故障

正常的开机电流 1、按开机键后电流在40mA摆动一下&#xff08;CPU供电正常&#xff09;&#xff1b; 2、到80mA左右摆动一下&#xff08;暂存开始工作&#xff0c;也就是CPU上盖&#xff0c;然后开始进行总线的初始化&#xff09;&#xff1b; 3、指针到120mA左右摆动&#xff…

【CodeForces - 675C】Money Transfers(思维,前缀和)

题干&#xff1a; There are n banks in the city where Vasya lives, they are located in a circle, such that any two banks are neighbouring if their indices differ by no more than 1. Also, bank 1 and bank n are neighbours if n > 1. No bank is a neighbou…

9.深度学习练习:Optimization Methods

本文节选自吴恩达老师《深度学习专项课程》编程作业&#xff0c;在此表示感谢。 课程链接&#xff1a;https://www.deeplearning.ai/deep-learning-specialization/ 目录 1 - Gradient Descent 2 - Mini-Batch Gradient descent 3 - Momentum 4 - Adam 5 - Model with dif…

一步步编写操作系统 22 硬盘操作方法

硬盘中的指令很多&#xff0c;各指令的用法也不同。有的指令直接往command寄存器中写就行了&#xff0c;有的还要在feature寄存器中写入参数&#xff0c;最权威的方法还是要去参考ATA手册。由于本书中用到的都是简单的指令&#xff0c;所以对此抽象出一些公共的步骤仅供参考之用…

10.深度学习练习:Convolutional Neural Networks: Step by Step(强烈推荐)

本文节选自吴恩达老师《深度学习专项课程》编程作业&#xff0c;在此表示感谢。 课程链接&#xff1a;https://www.deeplearning.ai/deep-learning-specialization/ 目录 1 - Packages 2 - Outline of the Assignment 3 - Convolutional Neural Networks 3.1 - Zero-Paddin…

【HDU - 2639】Bone Collector II (第K大背包,dp,STLset)

题干&#xff1a; The title of this problem is familiar,isnt it?yeah,if you had took part in the "Rookie Cup" competition,you must have seem this title.If you havent seen it before,it doesnt matter,I will give you a link: Here is the link: http…

一步步编写操作系统 23 重写主引导记录mbr

本节我们在之前MBR的基础上&#xff0c;做个稍微大一点的改进&#xff0c;经过这个改进后&#xff0c;我们的MBR可以读取硬盘。听上去这可是个大“手术”呢&#xff0c;我们要将之前学过的知识都用上啦。其实没那么大啦&#xff0c;就是加了个读写磁盘的函数而已&#xff0c;哈…

11.深度学习练习:Keras tutorial - the Happy House(推荐)

本文节选自吴恩达老师《深度学习专项课程》编程作业&#xff0c;在此表示感谢。 课程链接&#xff1a;https://www.deeplearning.ai/deep-learning-specialization/ Welcome to the first assignment of week 2. In this assignment, you will: Learn to use Keras, a high-lev…

【HDU - 5014】Number Sequence(贪心构造)

题干&#xff1a; There is a special number sequence which has n1 integers. For each number in sequence, we have two rules: ● a i ∈ [0,n] ● a i ≠ a j( i ≠ j ) For sequence a and sequence b, the integrating degree t is defined as follows(“♁” deno…