Back to Website

关于 boot 代码的几个疑点?

Moderators: Lone_Rifle, unlinux

关于 boot 代码的几个疑点?

Postby plato » Mon Jul 20, 2009 2:22 pm

(Translation done by Lone_Rifle)
最近刚刚研读boot部分代码,发现有几个疑点:
(I've recently read through the boot part of the source, and have a few uncertainties:)
1. isobtrt.asm 这个文件的代码拿来干啥?
(What is isobtrt for?)
我知道isoboot.asm 是引导光盘代码,fat32.asm 是硬盘引导区代码,dosmbr.asm 是mbr代码。但不知道isobtrt.asm他的作用。

2. isoboot.asm 的代码是否有冗余.
我发现,进行光盘引导时屏蔽下面的代码照样可以成功引导:
(Are there redundancies in isoboot.asm? I noticed that if I removed [literally shielded/isolated] the following code I can still commence with the boot process)
; Save and display the boot drive number
mov [DriveNo], dl
%ifdef DEBUG_MESSAGES
mov si, startup_msg
call writemsg
mov al, dl
call writehex2
call crlf
%endif

; Now figure out what we're actually doing
; Note: use passed-in DL value rather than 7Fh because
; at least some BIOSes will get the wrong value otherwise
mov ax, 4B01h ; Get disk emulation status
mov dl, [DriveNo]
mov si, spec_packet
int 13h
jc near spec_query_failed ; Shouldn't happen (BIOS bug)
mov dl, [DriveNo]
cmp [sp_drive], dl ; Should contain the drive number
jne near spec_query_failed

%ifdef DEBUG_MESSAGES
mov si, spec_ok_msg
call writemsg
mov al, byte [sp_drive]
call writehex2
call crlf
%endif

found_drive:
; Get drive information
mov ah, 48h
mov dl, [DriveNo]
mov si, drive_params
int 13h
jnc params_ok
我发先,call 中断13 (ah 为48,4b) 它取出来的值接下来的代码并没有用上,查文献资料对这两个中断交代不是很详。
我在bochs和QEMU上测试,屏蔽后能正常运行,但没有在正真的pc上run.
(I noticed that interrupt 13 (as well as 48 and 4b? translator unsure) and the code associated with it never gets used, and the documentation related to the interrupts is not very clear. I've done my research on bochs and QEMU, and after removal the code still can run. I've not tried this on real hardware though.)
3. 光盘DriveNo是从哪里来的? 代码直接把dl值赋给DriveNo,(这个值我测试结果为e0 bochs, qemu)后面就开始用它了,难道机器重启后会给dl附上光盘DriveNo吗?
(Where does Drive DriveNo come from? The code passes dl to DriveNo, and uses it afterwards.. is it really the case that after the machine restarts it will assign the value of dl to Drive DriveNo? [translator not sure of entire sentence] )
plato
 
Posts: 11
Joined: Sat Jul 11, 2009 3:25 am

Postby hto » Tue Jul 21, 2009 4:39 am

Hi,

What is isobtrt for?


Here is the commit log for this file. Boot sector for regression tests: do always boot HDD if there is a MBR, otherwise always start the installation.
(isobtrt是用来做回归测试。 我们的BuildBot总是用空的硬盘经行测试,所以如果硬盘已有了MBR,我们已经办到设建, 因此用硬盘boot)
I noticed that interrupt 13 (as well as 48 and 4b? translator unsure) and the code associated with it never gets used, and the documentation related to the interrupts is not very clear. I've done my research on bochs and QEMU, and after removal the code still can run. I've not tried this on real hardware though.


I'm not sure which code do you mean. The code above is used when booting from CD-ROM.

IBM/MS INT 13 Extensions - GET DRIVE PARAMETERS and Bootable CD-ROM - GET STATUS, they are described in Ralf Brown's Interrupt List.
(我不太清楚你讲哪一个代码。。。 上面的代码是用来从光盘boot。。。 你可以从Ralf Brown's Interrupt List找到IBM/MS INT 13 Extensions 的原因)
Where does Drive DriveNo come from? The code passes dl to DriveNo, and uses it afterwards.. is it really the case that after the machine restarts it will assign the value of dl to Drive DriveNo? [translator not sure of entire sentence]


Yes. BIOS calls bootstrap code with boot drive number in dl.
(对了,当BIOS叫bootstrap的代码时,boot盘的号码已在dl)
hto
Developer
 
Posts: 2195
Joined: Sun Oct 01, 2006 3:43 pm

Re: 关于 boot 代码的几个疑点?

Postby plato » Tue Jul 21, 2009 7:29 am

I can skip the GET DRIVE PARAMETERS and GET STATUS, and I success boot and do the install from CD-ROM.So these codes can be removed realy?

thanks!
plato
 
Posts: 11
Joined: Sat Jul 11, 2009 3:25 am

Re: 关于 boot 代码的几个疑点?

Postby Lone_Rifle » Tue Jul 21, 2009 12:30 pm

亲爱的读者们很抱歉,我暂时没空翻译hto的回答,希望中国明天早上前能办的到。。。plato,你可以翻译你自己对他的回答吗?谢谢。
Apologies to our dear readers, I currently don't have time to translate hto's reply, but will try to do so before tomorrow morning China time.
Lone_Rifle
Test Team
 
Posts: 802
Joined: Thu Apr 03, 2008 2:17 pm

Re: 关于 boot 代码的几个疑点?

Postby plato » Tue Jul 21, 2009 2:03 pm

你的意思还要翻译成中文吗?

好的,我的意思是,我可以修改代码不做获取CD-ROM 驱动的参数和状态,但任然能够从光驱引导并安装,这段代码可以删除掉吗?
plato
 
Posts: 11
Joined: Sat Jul 11, 2009 3:25 am

Re: 关于 boot 代码的几个疑点?

Postby Lone_Rifle » Tue Jul 21, 2009 4:39 pm

plato wrote:你的意思还要翻译成中文吗?

这只是为了我们读不懂英文的读者而已。。。 =)
It's just for the readers who don't read English =)
Lone_Rifle
Test Team
 
Posts: 802
Joined: Thu Apr 03, 2008 2:17 pm

Postby hto » Tue Jul 21, 2009 9:35 pm

plato wrote:I can skip the GET DRIVE PARAMETERS and GET STATUS, and I success boot and do the install from CD-ROM. So these codes can be removed really?


Get status seems to be a workaround for buggy BIOSes, which do not pass correct boot drive number in dl. Get drive parameters is indeed unneeded.
(caimouse 猜对了,GET STATUS 好像是用来治理一些有问题的BIOS;它们不会把针对的boot驱动器号码放经dl。GET DRIVE PARAMETERS 真的是没用的。)
hto
Developer
 
Posts: 2195
Joined: Sun Oct 01, 2006 3:43 pm

Re: 关于 boot 代码的几个疑点?

Postby caimouse » Wed Jul 22, 2009 7:43 am

可能这段代码是为了一些不兼容的BIOS代码写的。
caimouse
 
Posts: 6
Joined: Wed Jun 24, 2009 7:44 am

Postby hto » Wed Jul 22, 2009 4:45 pm

This code is from (some old version of) syslinux, so it is probably better to ask syslinux people about details.
(这段代码是从syslinux其中一个陈旧的译文,你最好问他们解释。)
hto
Developer
 
Posts: 2195
Joined: Sun Oct 01, 2006 3:43 pm


Return to Chinese

Who is online

Users browsing this forum: No registered users and 1 guest