| FreeBSD启动扇区代码分析(ver5.2.1) |
热 ★★★★★ |
| FreeBSD启动扇区代码分析(ver5.2.1) |
|
| |
|
|
movw $crlf,%si # Leave some
callw puts # space
popw %si # Restore
打印“回车”和“换行”。
jmp *%bx # Invoke bootstrap
跳转到我们选择的引导扇区去执行。整个Boot Manager代码到此执行完毕。
#
# Display routines
#
putkey:
movb $'F',%al # Display
callw putchr # 'F'
movb $'1',%al # Prepare
addb %dl,%al # digit
jmp putstr.1 # Display the rest
“putkey”函数在屏幕上打印“F1”、“F2”或“F3”等。如果dl为0则打印“F1”,
如果dl为1则打印“F2”,如果dl为3则打印“F3”。和调用“putstr”在屏幕上打印
es:si指向的以最高位置1为结束字符的字符串。
#
# Display the option and note that it is a valid option.
# That last point is a bit tricky..
#
putx: #首先,把_MNUOPT(%bp)的第dx位(bit)置1,表示此菜单选项被显示。然后在
屏幕上打印空格和es:di指向的以最高位置1为结束字符的字符串。
btsw %dx,_MNUOPT(%bp) # Enable menu option
movw $item,%si # Display
callw putkey # key
movw %di,%si # Display the rest
puts: #调用“putstr”在屏幕上打印es:si指向的以最高位置1为结束字符的字符串。
callw putstr # Display string
putn: #“putn”打印“回车/换行”后在屏幕上打印es:si指向的以最高位置1为结束字符的字符串。
movw $crlf,%si # To next line
putstr: #“putstr”在屏幕上打印es:si指向的以最高位置1为结束字符的字符串。
lodsb # Get byte
testb $0x80,%al # End of string?
jnz putstr.2 # Yes
putstr.1:
callw putchr # Display char
jmp putstr # Continue
putstr.2:
andb $~0x80,%al # Clear MSB
putchr:
pushw %bx # Save
movw $0x7,%bx # Page:attribute
movb $0xe,%ah # BIOS: Display
int $0x10 # character
popw %bx # Restore
retw # To caller
“putchr”在屏幕上显示“al”中的字符。
# One-sector disk I/O routine
intx13:
movb 0x1(%si),%dh # Load head
movw 0x2(%si),%cx # Load cylinder:sector
movb $0x1,%al # Sector count
pushw %si # Save
movw %sp,%di # Save
testb $0x80,_FLAGS(%bp) # Use packet interface?
jz intx13.1 # No
pushl $0x0 # Set the
pushl 0x8(%si) # LBA address
pushw %es # Set the transfer
pushw %bx # buffer address
push $0x1 # Block count
push $0x10 # Packet size
movw %sp,%si # Packet pointer
decw %ax # Verify off
orb $0x40,%ah # Use disk packet
intx13.1:
int $0x13 # BIOS: Disk I/O
movw %di,%sp # Restore
popw %si # Restore
retw # To caller
# Menu strings
item:
.ascii " "; .byte ' '|0x80
prompt:
.ascii "\nDefault:"; .byte ' '|0x80
crlf:
.ascii "\r"; .byte '\n'|0x80
# Partition type tables
tables:
#
# These entries identify invalid or NON BOOT types and partitions.
#
.byte 0x0, 0x5, 0xf
#
# These values indicate bootable types we know the names of
#
.byte 0x1, 0x4, 0x6, 0xb, 0xc, 0xe, 0x83
.byte 0x9f, 0xa5, 0xa6, 0xa9
#
# These are offsets that match the known names above and point to the strings
# that will be printed.
#
.byte os_misc-. # Unknown
.byte os_dos-. # DOS
.byte os_dos-. # DOS
.byte os_dos-. # DOS
.byte os_dos-. # Windows
.byte os_dos-. # Windows
.byte os_dos-. # Windows
.byte os_linux-. # Linux
.byte os_bsd-. # BSD/OS
.byte os_freebsd-. # FreeBSD
.byte o
(完) 上一页 [1] [2] [3]
 |
频道声明:本频道的文章除部分特别声明禁止转载的专稿外,可以自由转载.但请务必注明出出处和原始作者 文章版权归本频道与文章作者所有.对于被频道转载文章的个人和网站,我们表示深深的谢意。
| 原始作者:佚名 |
录入时间:2006-10-10 |
| 信息来源:不详 |
投稿信箱:itqoo@126.com |
|
|
 |
|
|
|
| 教程录入:admin 责任编辑:admin |
|
上一个教程: FreeBSD操作系统的引导
下一个教程: 硬盘容量 |
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |