如何使用汇编 (NASM) 从 CD-ROM 将内核加载到内存中 [英] How to load kernel into memory from CD-ROM using Assembly (NASM)

查看:30
本文介绍了如何使用汇编 (NASM) 从 CD-ROM 将内核加载到内存中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为自己编写一个引导程序和内核,引导程序和内核都将刻录在 CD-R 上,并将用作 CD-live.它不是 linux CD-Live 或其他东西,完全是我自己的引导程序和内核.我不想使用其他 booloader(即 GRUB),所以请不要建议我使用它们.

I'm writing a bootstrap and kernel for myself and both bootstrap and kernel will be burn on a CD-R and will function as a CD-live. It is not a linux CD-Live or something else,is totally my own bootloader and kernel. I do not want to use other booloaders (i.e. GRUB) so please don't suggest me to use them.

这是我的问题:在我的引导加载程序 ASM 代码中,我想将我的内核和内核条目加载到 RAM 从 CD-ROM(不是从硬盘或软盘),并假设我们知道内核的确切位置在 CD-ROM 上(扇区号).据我所知,我必须使用 int 0x13, AH = 02h 将扇区从驱动器读取到 RAM 中.为了使用这个中断服务,我必须设置几个寄存器,我将在下面列出:参数:啊 02h要读取的 AL 扇区数CX Track + Sector/见备注DH头DL 驱动器ES:BX 缓冲区地址指针

Here is my question: In my bootloader ASM code, I want to load my kernel and kernel entry into the RAM from CD-ROM (not from hard disk or floppy disk), and lets assume that we know where the kernel located exactly on the CD-ROM (sector number). As far as I know I have to use int 0x13, AH = 02h which will read sectors from Drive in to the RAM. In order to use this interrupt service,I have to set couple of registers that I'll list bellow: Parameters: AH 02h AL Sectors To Read Count CX Track + Sector / See remark DH Head DL Drive ES:BX Buffer Address Pointer

我的问题是关于 DL 和 DH.为了指向要读取的第一个硬盘驱动器,我们可以将其设置为 80h,或者对于软盘,我们可以将其设置为 00h.但是我想从 CD-ROM 中读取,我不知道我必须为 DH 和 DL 使用什么值.

My problem is about DL and DH.In order to point to 1st hard drive to read from, we can set it to 80h or, for floppy disk we can set it to 00h. But I want to read from CD-ROM and I don't know what values I have to use for DH and DL.

为了从 CD-ROM 读取几个扇区到 RAM 是正确的中断(int 0x13)吗?如果是,我应该为 DH 和 DL 赋予什么价值.

In order to read from CD-ROM couple of sectors into to the RAM is it a right interrupt (int 0x13)? if yes, what value should I have to put for DH and DL.

问候,普利亚.

推荐答案

要让 BIOS 从 CD 加载引导扇区,您需要使用 "El Torito" 标准.

For the BIOS to load your boot sector from CD, you'll need to make the CD bootable by using the "El Torito" standard.

一旦你使用它,你有两个选择
一个.模拟 - BIOS 模拟软盘或硬盘驱动器,您可以使用设备 00 或设备 80 通过 INT13 调用读取内核.
湾.该设备不模拟,您可以使用 INT13 ExtendedRead 功能直接从 CD 读取.

Once you use that, you have two options
a. Emulation - the BIOS emulates either a floppy or hard drive, and you can read your kernel through the INT13 calls with either device 00 or device 80.
b. The device doesn't emulate, and you can read directly from the CD using the INT13 ExtendedRead function.

要了解这是如何完成的,请查看 Linux ISOLINUX"加载程序 - ISOLINUX.ASM

To see how this is done, look at the Linux "ISOLINUX" loader - ISOLINUX.ASM

为您的问题提供更具体的起点,El Torito 规范,第 5.3 节:

To provide a more specific starting point to your question, El Torito spec,section 5.3:

Once the system jumps to segment:0, the program can retrieve its boot
information by issuing INT 13, Function 4B, AL=01.  After the boot process
has been initiated the INT 13 Extensions (functions 41-48) will access the
CD using 800 byte sectors and the LBA address provided to INT 13 is an
absolute sector number. This gives any program running in no emulation mode
the ability to locate the boot catalog, and any other information on the
CD, without providing a device driver.

这篇关于如何使用汇编 (NASM) 从 CD-ROM 将内核加载到内存中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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