BIOS将哪些信息加载到RAM中? [英] What information does BIOS load into RAM?

查看:179
本文介绍了BIOS将哪些信息加载到RAM中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道BIOS在启动时会在内存0x7c00上加载预定义设备驱动器的第一个扇区(512字节),然后跳转到该地址.

I know that, on booting, BIOS loads the first sector (512 bytes) of a pre-defined device drive on memory 0x7c00 and then jump to that address.

因此,占用了从0x7c00到0x7dff的内存. RAM是否还有其他部分被占用?

So, memory from 0x7c00 to 0x7dff is occupied. Is there any other section of RAM that is occupied?

如果我正在对操作系统进行编程,是否可以将除0x7c00之外的所有RAM都用于ox7dff以实现自己的目的?或者,在引导时是否还有其他部分充满了宝贵的"信息,我不能覆盖这些信息?

If I'm programming an Operating System, could I use all the RAM except 0x7c00 to ox7dff for my own purposes?, or, is there any other section filled with "precious" information at boot time that I must not overwrite?

我知道在给定的时刻,我可以覆盖加载在内存上的MBR(链式加载),我的问题集中在……操作系统的哪一部分内存可用?

I know that at a given moment, I can overwrite MBR loaded on memory (chainloading), my question is focused on... what part of the memory is available for an Operating System?

对不起,我的英语不好.谢谢您的回答!

Sorry for my bad english. Thanks for your answers!!

推荐答案

x86实模式内存映射如下:

The x86 Real Mode Memory Map is as follows:

 - 0x00000000 - 0x000003FF - Real Mode Interrupt Vector Table
 - 0x00000400 - 0x000004FF - BIOS Data Area
 - 0x00000500 - 0x00007BFF - Unused
 - 0x00007C00 - 0x00007DFF - Our Bootloader
 - 0x00007E00 - 0x0009FFFF - Unused
 - 0x000A0000 - 0x000BFFFF - Video RAM (VRAM) Memory
 - 0x000B0000 - 0x000B7777 - Monochrome Video Memory
 - 0x000B8000 - 0x000BFFFF - Color Video Memory
 - 0x000C0000 - 0x000C7FFF - Video ROM BIOS
 - 0x000C8000 - 0x000EFFFF - BIOS Shadow Area
 - 0x000F0000 - 0x000FFFFF - System BIOS

在我的实模式编程中,我通常停留在0x00007E00-0x0009FFFF(并非全部)的范围内..我使用segment:offset寻址来使用内存..要从1阶段引导加载程序转到内核或第2阶段引导加载程序,我使用:

In my real mode programming I usually stick from 0x00007E00 - 0x0009FFFF (Not all of it).. I use segment:offset addressing to use the memory.. To go from a 1 Stage bootloader to a Kernel or a Bootloader 2nd Stage, I use:

; bootloader.s

BITS  16
ORG   0x7C00

  CLI
  JMP 0xE000      ; Can also be JMP 0x7C00:200
  HLT

TIMES 510 - ($-$$) DB 0
DW 0xAA55

-

; Something.s

BITS  16
ORG   0x7E00      ; Can also be ORG   0x7C00:200

; Code goes here for your purposes.. whether it be a 2nd stage
; bootloader or your 16bit kernel..

CLI
HLT

如果要进入保护模式,则仍然需要如上所示的存根.在Something.s中,您可以在保护模式例程(GDT,A20,设置视频模式等)中进行编程.

If you are going into Protected mode, you will still need a stub as shown above.. In Something.s you can program in your protected mode routines (GDT, A20, Set video mode, etc..)

要说明有关0x7C00(引导加载程序入口点)处的内存位置,请在0x7C00-0x7DFF中放置引导加载程序(上面的bootloader.s).您将其放在此处是因为BIOS在执行完例程后会跳至该位置.引导加载程序的大小必须恰好为512字节(请注意TIMES指令).从那里开始,您的代码可以是任意大小(只要适合内存映射),就可以在操作系统上完全工作.

To explain about the memory location at 0x7C00 (Bootloader Entry Point), 0x7C00 - 0x7DFF is where you place your bootloader (the bootloader.s above). You place it there because the BIOS jumps to that location after doing its routines. The bootloader must be exactly 512 bytes in size (notice the TIMES directive). From there, your code can be any size (as long as it fits in the memory map), and you will be able to work on the OS fully.

如果您确实进入32位保护模式,则可以使用有关1MiB标记的任何内容.

If you DO go into 32Bit Protected Mode, you will be able to use ANYTHING about the 1MiB mark.

这篇关于BIOS将哪些信息加载到RAM中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆