编写一个简单的安全工作引导扇区需要哪些知识?
我知道汇编知识是首先需要的东西(我已经有了),而且我也知道引导扇区代码告诉处理器引导/执行程序(或操作系统),但我不知道它是如何实现的。我看过反汇编的引导扇区代码,但我不知道如何编写该代码。如果我将出现故障的引导扇区代码写入 USB 闪存驱动器,它将永远无法再次工作。
我总是可以从互联网上获得有关引导扇区编程的花絮,但我正在寻找一个有组织的教程或类似的东西,他们教如何从头到尾对引导扇区和其他引导程序进行编程。请指出我正确的方向...
I know knowledge of assembly is the very first thing needed (which I have), and I also know that Boot Sector code tells the processor to boot/execute a program (or OS), but what I don't is the HOW of it. I've seen disassembled bootsector code, but I don't know how to write that code. If I write a malfunctioning bootsector code to my USB flash drive, it will never work again.
I can always get tidbits of programming boot sectors from the internet but I'm looking for an organized tutorial or something like that, where they teach how to program a boot sector and other boot programs from beginning to end. Please point me in the right direction...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上有两个MBR。第一个是主引导记录 (MBR),第二个是卷引导记录 (VBR)。两者都参与操作系统的引导。 MBR 结构与 VBR 的不同之处在于 - MBR 基本上以汇编代码开始,以分区表信息结束,VBR 以跳转到汇编代码开始,汇编代码位于一些卷信息之后。当系统启动时,它会将 MBR 读入内存中的物理地址 0x7c00 并跳转到该地址。假定 MBR 的职责是读取分区表(与 MBR 一起加载,作为它的一部分)并查找实际卷(就 Windows 而言,磁盘驱动器,例如 C、D、E...),操作系统预计在该卷中是。 MBR 找到操作系统卷后,它会在地址 0x7c00 处再次加载 VBR,然后跳转到提到的地址。现在,VBR 读取其卷信息(作为其一部分加载)并决定在哪里查找操作系统引导代码。做出决定后 - VBR 加载操作系统引导代码并跳转到其起始地址。
有了这些信息,您就可以了解所需的引导记录编写器知识。至少 - 您应该知道您正在写入的引导记录(MBR 或 VBR)。然后您可以阅读它的数据结构并编写能够读取它们并加载下一个引导代码块的代码。
There is two MBR actually. First is master boot record (MBR) and second is volume boot record (VBR). Both participate in the bootstrapping of operating system. MBR structure differs from VBR in this way - MBR basically starts with your assembly code and ends with patrition table information, VBR starts with jump to your assembly code which is placed after some volume information. When system starts it reads MBR into memory at physical address 0x7c00 and jumps to that address. It is supposed MBR's responsibility to read partition table (loaded together with MBR as it's part) and to find actual volume (disk drive such as C,D,E,... in terms of Windows), where an operatig system is expected to be. After MBR has found OS volume it loads it's VBR again at the address 0x7c00 and then jumps to the mentioned address. Now VBR reads it's volume information (loaded with it as it's part) and decides where to find operating system bootstrap code. After decision is made - VBR loads OS bootstrap code and jumps to it's starting address.
Having this information you can see the required boot record writer knowledge. At least - you should know wich boot record you are writing (MBR or VBR). Then you can read about it's data structures and write code capable of reading them and loading next chunk of bootstrap code.