日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

FreeBSD啟動(dòng)扇區(qū)代碼分析( 六 )


#
jne main.15 # If not F5恢復(fù)上面保存的si和標(biāo)志寄存器的內(nèi)容 。如果不是按鍵F5,則直接跳轉(zhuǎn)到main.15去執(zhí)行 。movb _NXTDRV(%bp),%dl # Next drive
subb $'0',%dl # number否則的話,我們選擇下一個(gè)驅(qū)動(dòng)器作為啟動(dòng)盤 。#
# load selected bootsector to the LOAD location in RAM.
# If it fails to read or isn't marked bootable, treat it
# as a bad selection.
# XXX what does %si carry?
#
main.15:
movw $LOAD,%bx # Address for read
movb $0x2,%ah # Read sector
callw intx13 # from disk
jc main.10 # If error把我們上面選擇到的分區(qū)讀到0x7c00處,就象我們剛剛才加電啟動(dòng)一樣,只是活動(dòng)分區(qū)改變了而已 。如果發(fā)生讀錯(cuò)誤則直接跳轉(zhuǎn)到main.10 。使用戶重新選擇啟動(dòng)分區(qū) 。cmpw $MAGIC,0x1fe(%bx) # Bootable?jne main.10 # No判斷引導(dǎo)扇區(qū)的最后兩個(gè)字節(jié)是否是“0x55AA,如果不是,則表示此扇區(qū)是不可引導(dǎo)的,或不合法的引導(dǎo)扇區(qū)則直接跳轉(zhuǎn)到main.10 。使用戶重新選擇啟動(dòng)分區(qū) 。pushw %si # Savemovw $crlf,%si # Leave somecallw puts # spacepopw %si # Restore打印“回車和“換行 。jmp *%bx # Invoke bootstrap跳轉(zhuǎn)到我們選擇的引導(dǎo)扇區(qū)去執(zhí)行 。整個(gè)Boot Manager代碼到此執(zhí)行完畢 。#
# 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函數(shù)在屏幕上打印“F1、“F2或“F3等 。如果dl為0則打印“F1,如果dl為1則打印“F2,如果dl為3則打印“F3 。和調(diào)用“putstr在屏幕上打印es:si指向的以最高位置1為結(jié)束字符的字符串 。#
# Display the option and note that it is a valid option.
# That last point is a bit tricky..
#putx: #首先,把_MNUOPT(%bp)的第dx位(bit)置1,表示此菜單選項(xiàng)被顯示 。然后在屏幕上打印空格和es:di指向的以最高位置1為結(jié)束字符的字符串 。btsw %dx,_MNUOPT(%bp) # Enable menu option
movw $item,%si # Display
callw putkey # key
movw %di,%si # Display the restputs: #調(diào)用“putstr在屏幕上打印es:si指向的以最高位置1為結(jié)束字符的字符串 。callw putstr # Display stringputn: #“putn打印“回車/換行后在屏幕上打印es:si指向的以最高位置1為結(jié)束字符的字符串 。movw $crlf,%si # To next line
putstr: #“putstr在屏幕上打印es:si指向的以最高位置1為結(jié)束字符的字符串 。
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.

推薦閱讀