reactos操作系统实现(47)

前端之家收集整理的这篇文章主要介绍了reactos操作系统实现(47)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

@H_404_3@当光盘变成记录数据以后,就开始使用光盘来分发操作系统了。毕竟光盘有着储存数据量大,成本便宜的优势。下面就来分析Reactos@H_404_3@是怎么样通过光盘的格式来引导操作系统的。

@H_404_3@现今的计算机BIOS@H_404_3@,会在开机时根据El Torito@H_404_3@规格,查找光盘上的开机代码。若该光盘具有开机代码,则BIOS@H_404_3@会指配一个磁盘驱动器代号给该光驱。磁盘驱动器代号通常为80@H_404_3@(模拟硬盘)或是00@H_404_3@(模拟软盘)等。借由模拟成硬盘或软盘,可让旧式的操作系统由光盘开机。

@H_404_3@现今新式的操作系统则不需做模拟,只要有如ISOLINUX@H_404_3@之类的开机引导程序(boot loader@H_404_3@),即可由光盘开机。

#001@H_404_3@ ; ****************************************************************************

#002@H_404_3@ ;

#003@H_404_3@ ;@H_404_3@ isolinux.asm

#004@H_404_3@ ;

#005@H_404_3@ ;@H_404_3@ A program to boot Linux kernels off a CD-ROM using the El Torito

#006@H_404_3@ ;@H_404_3@ boot standard in "no emulation" mode,making the entire filesystem

#007@H_404_3@ ;@H_404_3@ available.@H_404_3@ It is based on the SYSLINUX boot loader for MS-DOS

#008@H_404_3@ ;@H_404_3@ floppies.

#009@H_404_3@ ;

#010@H_404_3@ ;@H_404_3@ Copyright (C) 1994-2001@H_404_3@ H. Peter Anvin

#011@H_404_3@ ;

#012@H_404_3@ ;@H_404_3@ This program is free software; you can redistribute it and/or modify

#013@H_404_3@ ;@H_404_3@ it under the terms of the GNU General Public License as published by

#014@H_404_3@ ;@H_404_3@ the Free Software Foundation,Inc.,675 Mass Ave,Cambridge MA 02139,

#015@H_404_3@ ;@H_404_3@ USA; either version 2 of the License,or (at your option) any later

#016@H_404_3@ ;@H_404_3@ version; incorporated herein by reference.

#017@H_404_3@ ;

#018@H_404_3@ ; ****************************************************************************

#019@H_404_3@ ;

#020@H_404_3@ ; THIS FILE IS A MODIFIED VERSION OF ISOLINUX.ASM

#021@H_404_3@ ; MODIFICATION DONE BY MICHAEL K TER LOUW

#022@H_404_3@ ; LAST UPDATED 3-9-2002

#023@H_404_3@ ; SEE "COPYING" FOR INFORMATION ABOUT THE LICENSE THAT APPLIES TO THIS RELEASE

#024@H_404_3@ ;

#025@H_404_3@ ; ****************************************************************************

#026@H_404_3@ ;

#027@H_404_3@ ; This file is a modified version of ISOLINUX.ASM.

#028@H_404_3@ ; Modification done by Eric Kohl

#029@H_404_3@ ; Last update 04-25-2002

#030@H_404_3@ ;

#031@H_404_3@ ; ****************************************************************************

#032@H_404_3@

#033@H_404_3@ ; Note: The Makefile builds one version with DEBUG_MESSAGES automatically.

#034@H_404_3@ ;%define DEBUG_MESSAGES@H_404_3@ ; Uncomment to get debugging messages

#035@H_404_3@

#036@H_404_3@ %define WAIT_FOR_KEY

#037@H_404_3@

#038@H_404_3@

@H_404_3@下面BIOS@H_404_3@的数据区保留内存空间。

#039@H_404_3@ ; ---------------------------------------------------------------------------

#040@H_404_3@ ;@H_404_3@ BEGIN THE BIOS/CODE/DATA SEGMENT

#041@H_404_3@ ; ---------------------------------------------------------------------------

#042@H_404_3@

#043@H_404_3@ @H_404_3@ absolute 0400h

#044@H_404_3@ serial_base@H_404_3@ resw 4@H_404_3@ ; Base addresses for 4 serial ports

#045@H_404_3@ @H_404_3@ absolute 0413h

#046@H_404_3@ BIOS_fbm@H_404_3@ resw 1@H_404_3@ ; Free Base Memory (kilobytes)

#047@H_404_3@ @H_404_3@ absolute 046Ch

#048@H_404_3@ BIOS_timer@H_404_3@ resw 1@H_404_3@ ; Timer ticks

#049@H_404_3@ @H_404_3@ absolute 0472h

#050@H_404_3@ BIOS_magic@H_404_3@ resw 1@H_404_3@ ; BIOS reset magic

#051@H_404_3@ @H_404_3@ absolute 0484h

#052@H_404_3@ BIOS_vidrows@H_404_3@ resb 1@H_404_3@ ; Number of screen rows

#053@H_404_3@

#054@H_404_3@ ;

#055@H_404_3@ ; Memory below this point is reserved for the BIOS and the MBR

#056@H_404_3@ ;

1000h@H_404_3@以前都是BIOS@H_404_3@的数据区,不能放置代码

#057@H_404_3@ @H_404_3@ absolute 1000h

#058@H_404_3@ trackbuf@H_404_3@ resb 8192@H_404_3@ ; Track buffer goes here

#059@H_404_3@ trackbufsize@H_404_3@ equ $-trackbuf

#060@H_404_3@ ;@H_404_3@ trackbuf ends at 3000h

#061@H_404_3@

#062@H_404_3@ @H_404_3@ struc open_file_t

#063@H_404_3@ file_sector@H_404_3@ resd 1@H_404_3@ ; Sector pointer (0 = structure free)

#064@H_404_3@ file_left@H_404_3@ resd 1@H_404_3@ ; Number of sectors left

#065@H_404_3@ @H_404_3@ endstruc

#066@H_404_3@

#067@H_404_3@ @H_404_3@ struc dir_t

#068@H_404_3@ dir_lba@H_404_3@ resd 1@H_404_3@ ; Directory start (LBA)

#069@H_404_3@ dir_len@H_404_3@ resd 1@H_404_3@ ; Length in bytes

#070@H_404_3@ dir_clust@H_404_3@ resd 1@H_404_3@ ; Length in clusters

#071@H_404_3@ @H_404_3@ endstruc

#072@H_404_3@

#073@H_404_3@

#074@H_404_3@ MAX_OPEN_LG2@H_404_3@ equ 2@H_404_3@ ; log2(Max number of open files)

#075@H_404_3@ MAX_OPEN@H_404_3@ equ (1 << MAX_OPEN_LG2)

#076@H_404_3@ SECTORSIZE_LG2@H_404_3@ equ 11@H_404_3@ ; 2048 bytes/sector (El Torito requirement)

#077@H_404_3@ SECTORSIZE@H_404_3@ equ (1 << SECTORSIZE_LG2)

#078@H_404_3@ CR@H_404_3@ equ 13@H_404_3@ ; Carriage Return

#079@H_404_3@ LF@H_404_3@ equ 10@H_404_3@ ; Line Feed

#080@H_404_3@ retry_count@H_404_3@ equ 6@H_404_3@ ; How patient are we with the BIOS?

#081@H_404_3@

#082@H_404_3@

#083@H_404_3@

BSS@H_404_3@段数据。

#084@H_404_3@ @H_404_3@ absolute 5000h@H_404_3@ ; Here we keep our BSS stuff

#085@H_404_3@

#086@H_404_3@ DriveNo@H_404_3@ resb 1@H_404_3@ ; CD-ROM BIOS drive number

#087@H_404_3@ DiskError@H_404_3@ resb 1@H_404_3@ ; Error code for disk I/O

#088@H_404_3@ RetryCount@H_404_3@ resb 1@H_404_3@ ; Used for disk access retries

#089@H_404_3@ TimeoutCount@H_404_3@ resb 1@H_404_3@ ; Timeout counter

#090@H_404_3@ ISOFlags@H_404_3@ resb 1@H_404_3@ ; Flags for ISO directory search

#091@H_404_3@ RootDir@H_404_3@ resb dir_t_size@H_404_3@ ; Root directory

#092@H_404_3@ CurDir@H_404_3@ resb dir_t_size@H_404_3@ ; Current directory

#093@H_404_3@ ISOFileName@H_404_3@ resb 64@H_404_3@ ; ISO filename canonicalization buffer

#094@H_404_3@ ISOFileNameEnd@H_404_3@ equ $

#095@H_404_3@

#096@H_404_3@

#097@H_404_3@ @H_404_3@ alignb open_file_t_size

#098@H_404_3@ Files@H_404_3@ resb MAX_OPEN*open_file_t_size

#099@H_404_3@

#100@H_404_3@

#101@H_404_3@

@H_404_3@这里ISOBOOT@H_404_3@有代码段开始,由于BIOS@H_404_3@会读取光盘的引导区到内存 7000@H_404_3@开始位置,跟硬盘和磁盘是一样的。

#102@H_404_3@ @H_404_3@ section .text

#103@H_404_3@ @H_404_3@ org 7000h

#104@H_404_3@

#105@H_404_3@ start:

#106@H_404_3@ @H_404_3@ cli@H_404_3@ ; Disable interrupts

#107@H_404_3@ @H_404_3@ xor@H_404_3@ ax,ax@H_404_3@ ; ax = segment zero

#108@H_404_3@ @H_404_3@ mov@H_404_3@ ss,ax@H_404_3@ ; Initialize stack segment

#109@H_404_3@ @H_404_3@ mov@H_404_3@ sp,start@H_404_3@ ; Set up stack

#110@H_404_3@ @H_404_3@ mov@H_404_3@ ds,ax@H_404_3@ ; Initialize other segment registers

#111@H_404_3@ @H_404_3@ mov@H_404_3@ es,ax

#112@H_404_3@ @H_404_3@ mov@H_404_3@ fs,ax

#113@H_404_3@ @H_404_3@ mov@H_404_3@ gs,ax

#114@H_404_3@ @H_404_3@ sti@H_404_3@ ; Enable interrupts

#115@H_404_3@ @H_404_3@ cld@H_404_3@ ; Increment pointers

#116@H_404_3@

@H_404_3@把引导代码0000:7C00@H_404_3@位置拷贝到0000:7000@H_404_3@位置,然后再运行。

#117@H_404_3@ @H_404_3@ mov@H_404_3@ cx,2048 >> 2@H_404_3@ ; Copy the bootsector

#118@H_404_3@ @H_404_3@ mov@H_404_3@ si,0x7C00@H_404_3@ ; from 0000:7C00

#119@H_404_3@ @H_404_3@ mov@H_404_3@ di,0x7000@H_404_3@ ; to 0000:7000

#120@H_404_3@ @H_404_3@ rep@H_404_3@ movsd@H_404_3@ ; copy the program

@H_404_3@通过一个跳转,实现重定位代码位置。

#121@H_404_3@ @H_404_3@ jmp@H_404_3@ 0:relocate@H_404_3@ ; jump into relocated code

#122@H_404_3@

#123@H_404_3@ relocate:

@H_404_3@如果显示调度信息。

#124@H_404_3@ @H_404_3@ ; Display the banner and copyright

#125@H_404_3@ %ifdef DEBUG_MESSAGES

#126@H_404_3@ @H_404_3@ mov@H_404_3@ si,isolinux_banner@H_404_3@ ; si points to hello message

#127@H_404_3@ @H_404_3@ call@H_404_3@ writestr@H_404_3@ ; display the message

#128@H_404_3@ @H_404_3@ mov@H_404_3@ si,copyright_str

#129@H_404_3@ @H_404_3@ call@H_404_3@ writestr

#130@H_404_3@ %endif

#131@H_404_3@

#132@H_404_3@

@H_404_3@下面通过检查键盘输入来决定是否从光盘引导系统。

@H_404_3@先清空键盘输入。

#133@H_404_3@ @H_404_3@ ; Make sure the keyboard buffer is empty

#134@H_404_3@ %ifdef WAIT_FOR_KEY

#135@H_404_3@ .kbd_buffer_test:

#136@H_404_3@ @H_404_3@ call@H_404_3@ pollchar

#137@H_404_3@ @H_404_3@ jz@H_404_3@ .kbd_buffer_empty

#138@H_404_3@ @H_404_3@ call@H_404_3@ getchar

#139@H_404_3@ @H_404_3@ jmp@H_404_3@ .kbd_buffer_test

#140@H_404_3@ .kbd_buffer_empty:

@H_404_3@到这里已经把键盘缓冲区清空了。

@H_404_3@检查硬盘的MBR@H_404_3@是否可以引导。

#141@H_404_3@

#142@H_404_3@ @H_404_3@ ; Check for MBR on harddisk

#143@H_404_3@ @H_404_3@ pusha

#144@H_404_3@ @H_404_3@ mov@H_404_3@ ax,0201h

#145@H_404_3@ @H_404_3@ mov@H_404_3@ dx,0080h

#146@H_404_3@ @H_404_3@ mov@H_404_3@ cx,0001h

#147@H_404_3@ @H_404_3@ mov@H_404_3@ bx,trackbuf

#148@H_404_3@ @H_404_3@ int@H_404_3@ 13h

#149@H_404_3@ @H_404_3@ popa

@H_404_3@如果硬盘不是可引导的,就立即跳到光盘引导,不需要用户选择。

#150@H_404_3@ @H_404_3@ jc@H_404_3@ .boot_cdrom ; could not read hdd

#151@H_404_3@

@H_404_3@判断硬盘是否有引导扇区。

#152@H_404_3@ @H_404_3@ push ax

#153@H_404_3@ @H_404_3@ mov ax,word [trackbuf]

#154@H_404_3@ @H_404_3@ cmp ax,0

@H_404_3@如果没有引导扇区,就立即跳到光盘引导。

#155@H_404_3@ @H_404_3@ je@H_404_3@ .boot_cdrom ; no boot sector found (hopefully there are no weird bootsectors which begin with 0)

#156@H_404_3@ @H_404_3@ pop ax

#157@H_404_3@

@H_404_3@开始显示用户选择光盘引导,还是磁盘引导,同时进行5@H_404_3@秒钟计时,如果用户不按下任何按键,就会自动选择硬盘引导。

#158@H_404_3@ @H_404_3@ ; Display the 'Press key' message and wait for a maximum of 5 seconds

@H_404_3@输出换行回车。

#159@H_404_3@ @H_404_3@ call@H_404_3@ crlf

@H_404_3@输出按下任何键的提示字符串。

#160@H_404_3@ @H_404_3@ mov@H_404_3@ si,presskey_msg@H_404_3@ ; si points to 'Press key' message

#161@H_404_3@ @H_404_3@ call@H_404_3@ writestr@H_404_3@ ; display the message

#162@H_404_3@

5@H_404_3@秒钟倒计时。

#163@H_404_3@ @H_404_3@ mov@H_404_3@ byte [TimeoutCount],5

#164@H_404_3@ .next_second:

@H_404_3@获取当前时钟计数到eax@H_404_3@,并且相加19@H_404_3@个计数。

#165@H_404_3@ @H_404_3@ mov@H_404_3@ eax,[BIOS_timer]@H_404_3@ ; load current tick counter

#166@H_404_3@ @H_404_3@ add@H_404_3@ eax,19@H_404_3@ ;

#167@H_404_3@

@H_404_3@测试是否有键盘输入任何按键。

#168@H_404_3@ .poll_again:

#169@H_404_3@ @H_404_3@ call@H_404_3@ pollchar

@H_404_3@如果有任何按键输入,就跳到光盘引导。

#170@H_404_3@ @H_404_3@ jnz@H_404_3@ .boot_cdrom

#171@H_404_3@

@H_404_3@每次比较BIOS@H_404_3@里的计数是否与EAX@H_404_3@计数相同。

#172@H_404_3@ @H_404_3@ mov@H_404_3@ ebx,[BIOS_timer]

#173@H_404_3@ @H_404_3@ cmp@H_404_3@ eax,ebx

#174@H_404_3@ @H_404_3@ jnz@H_404_3@ .poll_again

#175@H_404_3@

@H_404_3@如果经历过19@H_404_3@个计数,说明已经过了1@H_404_3@秒钟。接着开始在屏幕上打印一个点。

#176@H_404_3@ @H_404_3@ mov@H_404_3@ si,dot_msg@H_404_3@ ; print '.'

#177@H_404_3@ @H_404_3@ call@H_404_3@ writestr

@H_404_3@如果超过5@H_404_3@秒钟,就跳到硬盘引导。

#178@H_404_3@ @H_404_3@ dec@H_404_3@ byte [TimeoutCount]@H_404_3@ ; decrement timeout counter

#179@H_404_3@ @H_404_3@ jz@H_404_3@ .boot_harddisk

@H_404_3@跳到下一秒计时。

#180@H_404_3@ @H_404_3@ jmp@H_404_3@ .next_second

#181@H_404_3@

@H_404_3@硬盘引导的代码

#182@H_404_3@ .boot_harddisk:

#183@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#184@H_404_3@

@H_404_3@从第一个硬盘引导。

#185@H_404_3@ @H_404_3@ ; Boot first harddisk (drive 0x80)

#186@H_404_3@ @H_404_3@ mov@H_404_3@ ax,0201h

#187@H_404_3@ @H_404_3@ mov@H_404_3@ dx,0080h

#188@H_404_3@ @H_404_3@ mov@H_404_3@ cx,0001h

#189@H_404_3@ @H_404_3@ mov@H_404_3@ bx,7C00h

#190@H_404_3@ @H_404_3@ int@H_404_3@ 13h

#191@H_404_3@ @H_404_3@ jnc@H_404_3@ .go_hd

#192@H_404_3@ @H_404_3@ jmp@H_404_3@ kaboom

#193@H_404_3@ .go_hd:

#194@H_404_3@ @H_404_3@ mov@H_404_3@ ax,cs

#195@H_404_3@ @H_404_3@ mov@H_404_3@ ds,ax

#196@H_404_3@ @H_404_3@ mov@H_404_3@ es,ax

#197@H_404_3@ @H_404_3@ mov@H_404_3@ fs,ax

#198@H_404_3@ @H_404_3@ mov@H_404_3@ gs,ax

#199@H_404_3@ @H_404_3@ mov@H_404_3@ dx,0080h

#200@H_404_3@

#201@H_404_3@ @H_404_3@ jmp@H_404_3@ 0:0x7C00

#202@H_404_3@ %endif

#203@H_404_3@

@H_404_3@从光盘引导。

#204@H_404_3@ .boot_cdrom:

#205@H_404_3@ %ifdef WAIT_FOR_KEY

#206@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#207@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#208@H_404_3@ %endif

#209@H_404_3@

#210@H_404_3@ @H_404_3@ ; Save and display the boot drive number

#211@H_404_3@ @H_404_3@ mov@H_404_3@ [DriveNo],dl

#212@H_404_3@ %ifdef DEBUG_MESSAGES

#213@H_404_3@ @H_404_3@ mov@H_404_3@ si,startup_msg

#214@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#215@H_404_3@ @H_404_3@ mov@H_404_3@ al,dl

#216@H_404_3@ @H_404_3@ call@H_404_3@ writehex2

#217@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#218@H_404_3@ %endif

#219@H_404_3@

@H_404_3@获取光驱的模拟状态。

#220@H_404_3@ @H_404_3@ ; Now figure out what we're actually doing

#221@H_404_3@ @H_404_3@ ; Note: use passed-in DL value rather than 7Fh because

#222@H_404_3@ @H_404_3@ ; at least some BIOSes will get the wrong value otherwise

#223@H_404_3@ @H_404_3@ mov@H_404_3@ ax,4B01h@H_404_3@ ; Get disk emulation status

#224@H_404_3@ @H_404_3@ mov@H_404_3@ dl,[DriveNo]

#225@H_404_3@ @H_404_3@ mov@H_404_3@ si,spec_packet

#226@H_404_3@ @H_404_3@ int@H_404_3@ 13h

#227@H_404_3@ @H_404_3@ jc@H_404_3@ near spec_query_Failed@H_404_3@ ; Shouldn't happen (BIOS bug)

#228@H_404_3@ @H_404_3@ mov@H_404_3@ dl,[DriveNo]

#229@H_404_3@ @H_404_3@ cmp@H_404_3@ [sp_drive],dl@H_404_3@ ; Should contain the drive number

#230@H_404_3@ @H_404_3@ jne@H_404_3@ near spec_query_Failed

#231@H_404_3@

#232@H_404_3@ %ifdef DEBUG_MESSAGES

#233@H_404_3@ @H_404_3@ mov@H_404_3@ si,spec_ok_msg

#234@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#235@H_404_3@ @H_404_3@ mov@H_404_3@ al,byte [sp_drive]

#236@H_404_3@ @H_404_3@ call@H_404_3@ writehex2

#237@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#238@H_404_3@ %endif

#239@H_404_3@

@H_404_3@发现有驱动器可以使用。

#240@H_404_3@ found_drive:

@H_404_3@通过中断13 @H_404_3@的48H@H_404_3@号功能读取驱动器信息。

#241@H_404_3@ @H_404_3@ ; Get drive information

#242@H_404_3@ @H_404_3@ mov@H_404_3@ ah,48h

#243@H_404_3@ @H_404_3@ mov@H_404_3@ dl,[DriveNo]

#244@H_404_3@ @H_404_3@ mov@H_404_3@ si,drive_params

#245@H_404_3@ @H_404_3@ int@H_404_3@ 13h

#246@H_404_3@ @H_404_3@ jnc@H_404_3@ params_ok

#247@H_404_3@

#248@H_404_3@ @H_404_3@ ; mov@H_404_3@ si,nosecsize_msg@H_404_3@ No use in reporting this

#249@H_404_3@ @H_404_3@ ; call@H_404_3@ writemsg

#250@H_404_3@

#251@H_404_3@ params_ok:

#252@H_404_3@ @H_404_3@ ; Check for the sector size (should be 2048,but

#253@H_404_3@ @H_404_3@ ; some BIOSes apparently think we're 512-byte media)

#254@H_404_3@ @H_404_3@ ;

#255@H_404_3@ @H_404_3@ ; FIX: We need to check what the proper behavIoUr

#256@H_404_3@ @H_404_3@ ; is for getlinsec when the BIOS thinks the sector

#257@H_404_3@ @H_404_3@ ; size is 512!!!@H_404_3@ For that,we need such a BIOS,though...

#258@H_404_3@ %ifdef DEBUG_MESSAGES

#259@H_404_3@ @H_404_3@ mov@H_404_3@ si,secsize_msg

#260@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#261@H_404_3@ @H_404_3@ mov@H_404_3@ ax,[dp_secsize]

#262@H_404_3@ @H_404_3@ call@H_404_3@ writehex4

#263@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#264@H_404_3@ %endif

#265@H_404_3@

#266@H_404_3@

@H_404_3@清空文件结构。

#267@H_404_3@ @H_404_3@ ;

#268@H_404_3@ @H_404_3@ ; Clear Files structures

#269@H_404_3@ @H_404_3@ ;

#270@H_404_3@ @H_404_3@ mov@H_404_3@ di,Files

#271@H_404_3@ @H_404_3@ mov@H_404_3@ cx,(MAX_OPEN*open_file_t_size)/4

#272@H_404_3@ @H_404_3@ xor@H_404_3@ eax,eax

#273@H_404_3@ @H_404_3@ rep@H_404_3@ stosd

#274@H_404_3@

#275@H_404_3@ @H_404_3@ ;

#276@H_404_3@ @H_404_3@ ; Now,we need to sniff out the actual filesystem data structures.

#277@H_404_3@ @H_404_3@ ; mkisofs gave us a pointer to the primary volume descriptor

#278@H_404_3@ @H_404_3@ ; (which will be at 16 only for a single-session disk!); from the PVD

#279@H_404_3@ @H_404_3@ ; we should be able to find the rest of what we need to know.

#280@H_404_3@ @H_404_3@ ;

@H_404_3@获取一个扇区数据。

#281@H_404_3@ get_fs_structures:

#282@H_404_3@ @H_404_3@ mov@H_404_3@ eax,16@H_404_3@ ; Primary Volume Descriptor (sector 16)

#283@H_404_3@ @H_404_3@ mov@H_404_3@ bx,trackbuf

#284@H_404_3@ @H_404_3@ call@H_404_3@ getonesec

#285@H_404_3@

#286@H_404_3@ @H_404_3@ mov@H_404_3@ eax,[trackbuf+156+2]

#287@H_404_3@ @H_404_3@ mov@H_404_3@ [RootDir+dir_lba],eax

#288@H_404_3@ @H_404_3@ mov@H_404_3@ [CurDir+dir_lba],eax

#289@H_404_3@ %ifdef DEBUG_MESSAGES

#290@H_404_3@ @H_404_3@ mov@H_404_3@ si,rootloc_msg

#291@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#292@H_404_3@ @H_404_3@ call@H_404_3@ writehex8

#293@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#294@H_404_3@ %endif

#295@H_404_3@

#296@H_404_3@ @H_404_3@ mov@H_404_3@ eax,[trackbuf+156+10]

#297@H_404_3@ @H_404_3@ mov@H_404_3@ [RootDir+dir_len],eax

#298@H_404_3@ @H_404_3@ mov@H_404_3@ [CurDir+dir_len],eax

#299@H_404_3@ %ifdef DEBUG_MESSAGES

#300@H_404_3@ @H_404_3@ mov@H_404_3@ si,rootlen_msg

#301@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#302@H_404_3@ @H_404_3@ call@H_404_3@ writehex8

#303@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#304@H_404_3@ %endif

#305@H_404_3@ @H_404_3@ add@H_404_3@ eax,SECTORSIZE-1

#306@H_404_3@ @H_404_3@ shr@H_404_3@ eax,SECTORSIZE_LG2

#307@H_404_3@ @H_404_3@ mov@H_404_3@ [RootDir+dir_clust],eax

#308@H_404_3@ @H_404_3@ mov@H_404_3@ [CurDir+dir_clust],eax

#309@H_404_3@ %ifdef DEBUG_MESSAGES

#310@H_404_3@ @H_404_3@ mov@H_404_3@ si,rootsect_msg

#311@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#312@H_404_3@ @H_404_3@ call@H_404_3@ writehex8

#313@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#314@H_404_3@ %endif

#315@H_404_3@

@H_404_3@这里查找根目录里的目录名称/LOADER@H_404_3@”。

#316@H_404_3@ @H_404_3@ ; Look for the "REACTOS" directory,and if found,

#317@H_404_3@ @H_404_3@ ; make it the current directory instead of the root

#318@H_404_3@ @H_404_3@ ; directory.

#319@H_404_3@ @H_404_3@ mov@H_404_3@ di,isolinux_dir

#320@H_404_3@ @H_404_3@ mov@H_404_3@ al,02h@H_404_3@ ; Search for a directory

#321@H_404_3@ @H_404_3@ call@H_404_3@ searchdir_iso

#322@H_404_3@ @H_404_3@ jnz@H_404_3@ .dir_found

#323@H_404_3@ @H_404_3@ mov@H_404_3@ si,no_dir_msg

#324@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#325@H_404_3@ @H_404_3@ jmp@H_404_3@ kaboom

#326@H_404_3@

#327@H_404_3@ .dir_found:

#328@H_404_3@ @H_404_3@ mov@H_404_3@ [CurDir+dir_len],eax

#329@H_404_3@ @H_404_3@ mov@H_404_3@ eax,[si+file_left]

#330@H_404_3@ @H_404_3@ mov@H_404_3@ [CurDir+dir_clust],eax

#331@H_404_3@ @H_404_3@ xor@H_404_3@ eax,eax@H_404_3@ ; Free this file pointer entry

#332@H_404_3@ @H_404_3@ xchg@H_404_3@ eax,[si+file_sector]

#333@H_404_3@ @H_404_3@ mov@H_404_3@ [CurDir+dir_lba],eax

#334@H_404_3@

#335@H_404_3@

@H_404_3@这里查找二级引导程序“SETUPLDR.SYS@H_404_3@”文件

#336@H_404_3@ @H_404_3@ mov@H_404_3@ di,isolinux_bin@H_404_3@ ; di points to Isolinux filename

#337@H_404_3@ @H_404_3@ call@H_404_3@ searchdir@H_404_3@ ; look for the file

#338@H_404_3@ @H_404_3@ jnz@H_404_3@ .isolinux_opened@H_404_3@ ; got the file

#339@H_404_3@ @H_404_3@ mov@H_404_3@ si,no_isolinux_msg@H_404_3@ ; si points to error message

#340@H_404_3@ @H_404_3@ call@H_404_3@ writemsg@H_404_3@ ; display the message

#341@H_404_3@ @H_404_3@ jmp@H_404_3@ kaboom@H_404_3@ ; fail boot

#342@H_404_3@

#343@H_404_3@ .isolinux_opened:

#344@H_404_3@ @H_404_3@ mov@H_404_3@ di,si@H_404_3@ ; save file pointer

#345@H_404_3@

#346@H_404_3@ %ifdef DEBUG_MESSAGES

#347@H_404_3@ @H_404_3@ mov@H_404_3@ si,filelen_msg

#348@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#349@H_404_3@ @H_404_3@ call@H_404_3@ writehex8

#350@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#351@H_404_3@ %endif

#352@H_404_3@

@H_404_3@计算扇区的大小。

#353 @H_404_3@@H_404_3@ mov ecx,eax@H_404_3@ ; calculate sector count

#354@H_404_3@ @H_404_3@ shr ecx,11

#355@H_404_3@ @H_404_3@ test eax,0x7FF

#356@H_404_3@ @H_404_3@ jz .full_sector

#357@H_404_3@ @H_404_3@ inc ecx

#358@H_404_3@ .full_sector:

#359@H_404_3@

#360@H_404_3@ %ifdef DEBUG_MESSAGES

#361@H_404_3@ @H_404_3@ mov eax,ecx

#362@H_404_3@ @H_404_3@ mov@H_404_3@ si,filesect_msg

#363@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#364@H_404_3@ @H_404_3@ call@H_404_3@ writehex8

#365@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#366@H_404_3@ %endif

#367@H_404_3@

@H_404_3@这里把二级引导程序加载到0x8000@H_404_3@位置。

#368@H_404_3@ @H_404_3@ mov@H_404_3@ bx,0x8000@H_404_3@ ; bx = load address

#369@H_404_3@ @H_404_3@ mov@H_404_3@ si,di@H_404_3@ ; restore file pointer

#370@H_404_3@ @H_404_3@ mov@H_404_3@ cx,0xFFFF@H_404_3@ ; load the whole file

#371@H_404_3@ @H_404_3@ call@H_404_3@ getfssec@H_404_3@ ; get the whole file

#372@H_404_3@

#373@H_404_3@ %ifdef DEBUG_MESSAGES

#374@H_404_3@ @H_404_3@ mov@H_404_3@ si,startldr_msg

#375@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#376@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#377@H_404_3@ %endif

#378@H_404_3@

#379@H_404_3@ @H_404_3@ mov@H_404_3@ dl,[DriveNo]@H_404_3@ ; dl = boot drive

#380@H_404_3@ @H_404_3@ mov dh,0@H_404_3@ ; dh = boot partition

@H_404_3@最后跳转0x8000@H_404_3@的位置运行二级引导程序,也就是运行SETUPLDR.SYS@H_404_3@文件

#381@H_404_3@ @H_404_3@ jmp@H_404_3@ 0:0x8000@H_404_3@ ; jump into OSLoader

#382@H_404_3@

#383@H_404_3@

#384@H_404_3@

#385@H_404_3@ ;

#386@H_404_3@ ; searchdir:

#387@H_404_3@ ;

#388@H_404_3@ ; Open a file

#389@H_404_3@ ;

#390@H_404_3@ ;@H_404_3@ On entry:

#391@H_404_3@ ;@H_404_3@ DS:DI@H_404_3@ = filename

#392@H_404_3@ ;@H_404_3@ If successful:

#393@H_404_3@ ;@H_404_3@ ZF clear

#394@H_404_3@ ;@H_404_3@ SI@H_404_3@ = file pointer

#395@H_404_3@ ;@H_404_3@ DX:AX or EAX@H_404_3@ = file length in bytes

#396@H_404_3@ ;@H_404_3@ If unsuccessful

#397@H_404_3@ ;@H_404_3@ ZF set

#398@H_404_3@ ;

#399@H_404_3@

#400@H_404_3@ ;

#401@H_404_3@ ; searchdir_iso is a special entry point for ISOLINUX only.@H_404_3@ In addition

#402@H_404_3@ ; to the above,searchdir_iso passes a file flag mask in AL.@H_404_3@ This is useful

#403@H_404_3@ ; for searching for directories.

#404@H_404_3@ ;

#405@H_404_3@ alloc_failure:

#406@H_404_3@ @H_404_3@ xor@H_404_3@ ax,ax@H_404_3@ ; ZF <- 1

#407@H_404_3@ @H_404_3@ ret

#408@H_404_3@

#409@H_404_3@ searchdir:

#410@H_404_3@ @H_404_3@ xor@H_404_3@ al,al

#411@H_404_3@ searchdir_iso:

#412@H_404_3@ @H_404_3@ mov@H_404_3@ [ISOFlags],al

#413@H_404_3@ @H_404_3@ call@H_404_3@ allocate_file@H_404_3@ ; Temporary file structure for directory

#414@H_404_3@ @H_404_3@ jnz@H_404_3@ alloc_failure

#415@H_404_3@ @H_404_3@ push@H_404_3@ es

#416@H_404_3@ @H_404_3@ push@H_404_3@ ds

#417@H_404_3@ @H_404_3@ pop@H_404_3@ es@H_404_3@ @H_404_3@ ; ES = DS

#418@H_404_3@ @H_404_3@ mov@H_404_3@ si,CurDir

#419@H_404_3@ @H_404_3@ cmp@H_404_3@ byte [di],'/'@H_404_3@ ; If filename begins with slash

#420@H_404_3@ @H_404_3@ jne@H_404_3@ .not_rooted

#421@H_404_3@ @H_404_3@ inc@H_404_3@ di@H_404_3@ ; Skip leading slash

#422@H_404_3@ @H_404_3@ mov@H_404_3@ si,RootDir@H_404_3@ ; Reference root directory instead

#423@H_404_3@ .not_rooted:

#424@H_404_3@ @H_404_3@ mov@H_404_3@ eax,[si+dir_clust]

#425@H_404_3@ @H_404_3@ mov@H_404_3@ [bx+file_left],eax

#426@H_404_3@ @H_404_3@ mov@H_404_3@ eax,[si+dir_lba]

#427@H_404_3@ @H_404_3@ mov@H_404_3@ [bx+file_sector],eax

#428@H_404_3@ @H_404_3@ mov@H_404_3@ edx,[si+dir_len]

#429@H_404_3@

#430@H_404_3@ .look_for_slash:

#431@H_404_3@ @H_404_3@ mov@H_404_3@ ax,di

#432@H_404_3@ .scan:

#433@H_404_3@ @H_404_3@ mov@H_404_3@ cl,[di]

#434@H_404_3@ @H_404_3@ inc@H_404_3@ di

#435@H_404_3@ @H_404_3@ and@H_404_3@ cl,cl

#436@H_404_3@ @H_404_3@ jz@H_404_3@ .isfile

#437@H_404_3@ @H_404_3@ cmp@H_404_3@ cl,'/'

#438@H_404_3@ @H_404_3@ jne@H_404_3@ .scan

#439@H_404_3@ @H_404_3@ mov@H_404_3@ [di-1],byte 0@H_404_3@ ; Terminate at directory name

#440@H_404_3@ @H_404_3@ mov@H_404_3@ cl,02h@H_404_3@ ; Search for directory

#441@H_404_3@ @H_404_3@ xchg@H_404_3@ cl,[ISOFlags]

#442@H_404_3@ @H_404_3@ push@H_404_3@ di

#443@H_404_3@ @H_404_3@ push@H_404_3@ cx

#444@H_404_3@ @H_404_3@ push@H_404_3@ word .resume@H_404_3@ ; Where to "return" to

#445@H_404_3@ @H_404_3@ push@H_404_3@ es

#446 @H_404_3@.isfile:

#447@H_404_3@ @H_404_3@ xchg@H_404_3@ ax,di

#448@H_404_3@

#449@H_404_3@ .getsome:

#450@H_404_3@ @H_404_3@ ; Get a chunk of the directory

#451@H_404_3@ @H_404_3@ mov@H_404_3@ si,trackbuf

#452@H_404_3@ @H_404_3@ pushad

#453@H_404_3@ @H_404_3@ xchg@H_404_3@ bx,si

#454@H_404_3@ @H_404_3@ mov@H_404_3@ cx,1@H_404_3@ ; load one sector

#455@H_404_3@ @H_404_3@ call@H_404_3@ getfssec

#456@H_404_3@ @H_404_3@ popad

#457@H_404_3@

#458@H_404_3@ .compare:

#459@H_404_3@ @H_404_3@ movzx@H_404_3@ eax,byte [si]@H_404_3@ ; Length of directory entry

#460@H_404_3@ @H_404_3@ cmp@H_404_3@ al,33

#461@H_404_3@ @H_404_3@ jb@H_404_3@ .next_sector

#462@H_404_3@ @H_404_3@ mov@H_404_3@ cl,[si+25]

#463@H_404_3@ @H_404_3@ xor@H_404_3@ cl,[ISOFlags]

#464@H_404_3@ @H_404_3@ test@H_404_3@ cl,byte 8Eh@H_404_3@ ; Unwanted file attributes!

#465@H_404_3@ @H_404_3@ jnz@H_404_3@ .not_file

#466@H_404_3@ @H_404_3@ pusha

#467@H_404_3@ @H_404_3@ movzx@H_404_3@ cx,byte [si+32]@H_404_3@ ; File identifier length

#468@H_404_3@ @H_404_3@ add@H_404_3@ si,byte 33@H_404_3@ ; File identifier offset

#469@H_404_3@ @H_404_3@ call@H_404_3@ iso_compare_names

#470@H_404_3@ @H_404_3@ popa

#471@H_404_3@ @H_404_3@ je@H_404_3@ .success

#472@H_404_3@ .not_file:

#473@H_404_3@ @H_404_3@ sub@H_404_3@ edx,eax@H_404_3@ ; Decrease bytes left

#474@H_404_3@ @H_404_3@ jbe@H_404_3@ .failure

#475@H_404_3@ @H_404_3@ add@H_404_3@ si,ax@H_404_3@ ; Advance pointer

#476@H_404_3@

#477@H_404_3@ .check_overrun:

#478@H_404_3@ @H_404_3@ ; Did we finish the buffer?

#479@H_404_3@ @H_404_3@ cmp@H_404_3@ si,trackbuf+trackbufsize

#480@H_404_3@ @H_404_3@ jb@H_404_3@ .compare@H_404_3@ ; No,keep going

#481@H_404_3@

#482@H_404_3@ @H_404_3@ jmp@H_404_3@ short .getsome@H_404_3@ ; Get some more directory

#483@H_404_3@

#484@H_404_3@ .next_sector:

#485@H_404_3@ @H_404_3@ ; Advance to the beginning of next sector

#486@H_404_3@ @H_404_3@ lea@H_404_3@ ax,[si+SECTORSIZE-1]

#487@H_404_3@ @H_404_3@ and@H_404_3@ ax,~(SECTORSIZE-1)

#488@H_404_3@ @H_404_3@ sub@H_404_3@ ax,si

#489@H_404_3@ @H_404_3@ jmp@H_404_3@ short .not_file@H_404_3@ ; We still need to do length checks

#490@H_404_3@

#491@H_404_3@ .failure:

#492@H_404_3@ %ifdef DEBUG_MESSAGES

#493@H_404_3@ @H_404_3@ mov@H_404_3@ si,findfail_msg

#494@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#495@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#496@H_404_3@ %endif

#497@H_404_3@ @H_404_3@ xor@H_404_3@ eax,eax@H_404_3@ ; ZF = 1

#498@H_404_3@ @H_404_3@ mov@H_404_3@ [bx+file_sector],eax

#499@H_404_3@ @H_404_3@ pop@H_404_3@ es

#500@H_404_3@ @H_404_3@ ret

#501@H_404_3@

#502@H_404_3@ .success:

#503@H_404_3@ @H_404_3@ mov@H_404_3@ eax,[si+2]@H_404_3@ ; Location of extent

#504@H_404_3@ @H_404_3@ mov@H_404_3@ [bx+file_sector],eax

#505@H_404_3@ @H_404_3@ mov@H_404_3@ eax,[si+10]@H_404_3@ ; Data length

#506@H_404_3@ @H_404_3@ push@H_404_3@ eax

#507@H_404_3@ @H_404_3@ add@H_404_3@ eax,SECTORSIZE-1

#508@H_404_3@ @H_404_3@ shr@H_404_3@ eax,SECTORSIZE_LG2

#509@H_404_3@ @H_404_3@ mov@H_404_3@ [bx+file_left],eax

#510@H_404_3@ @H_404_3@ pop@H_404_3@ eax

#511@H_404_3@ @H_404_3@ mov@H_404_3@ edx,eax

#512@H_404_3@ @H_404_3@ shr@H_404_3@ edx,16

#513@H_404_3@ @H_404_3@ and@H_404_3@ bx,bx@H_404_3@ ; ZF = 0

#514@H_404_3@ @H_404_3@ mov@H_404_3@ si,bx

#515@H_404_3@ @H_404_3@ pop@H_404_3@ es

#516@H_404_3@ @H_404_3@ ret

#517@H_404_3@

#518 @H_404_3@.resume:

#519@H_404_3@ @H_404_3@ ; We get here if we were only doing part of a lookup

#520@H_404_3@ @H_404_3@ ; This relies on the fact that .success returns bx == si

#521@H_404_3@ @H_404_3@ xchg@H_404_3@ edx,eax@H_404_3@ ; Directory length in edx

#522@H_404_3@ @H_404_3@ pop@H_404_3@ cx@H_404_3@ ; Old ISOFlags

#523@H_404_3@ @H_404_3@ pop@H_404_3@ di@H_404_3@ ; Next filename pointer

#524@H_404_3@

#525@H_404_3@ @H_404_3@ mov@H_404_3@ byte [di-1],'/'@H_404_3@ ; restore the backslash in the filename

#526@H_404_3@

#527@H_404_3@ @H_404_3@ mov@H_404_3@ [ISOFlags],cl@H_404_3@ ; Restore the flags

#528@H_404_3@ @H_404_3@ jz@H_404_3@ .failure@H_404_3@ ; Did we fail?@H_404_3@ If so fail for real!

#529@H_404_3@ @H_404_3@ jmp@H_404_3@ .look_for_slash@H_404_3@ ; Otherwise,next level

#530@H_404_3@

#531@H_404_3@ ;

#532@H_404_3@ ; allocate_file: Allocate a file structure

#533@H_404_3@ ;

#534@H_404_3@ ;@H_404_3@ If successful:

#535@H_404_3@ ;@H_404_3@ @H_404_3@ ZF set

#536@H_404_3@ ;@H_404_3@ @H_404_3@ BX = file pointer

#537@H_404_3@ ;@H_404_3@ In unsuccessful:

#538@H_404_3@ ;@H_404_3@ @H_404_3@ ZF clear

#539@H_404_3@ ;

#540@H_404_3@ allocate_file:

#541@H_404_3@ @H_404_3@ push@H_404_3@ cx

#542@H_404_3@ @H_404_3@ mov@H_404_3@ bx,Files

#543@H_404_3@ @H_404_3@ mov@H_404_3@ cx,MAX_OPEN

#544@H_404_3@ .check:

#545@H_404_3@ @H_404_3@ cmp@H_404_3@ dword [bx],byte 0

#546@H_404_3@ @H_404_3@ je@H_404_3@ .found

#547@H_404_3@ @H_404_3@ add@H_404_3@ bx,open_file_t_size@H_404_3@ ; ZF = 0

#548@H_404_3@ @H_404_3@ loop@H_404_3@ .check

#549@H_404_3@ @H_404_3@ ; ZF = 0 if we fell out of the loop

#550@H_404_3@ .found:

#551@H_404_3@ @H_404_3@ pop@H_404_3@ cx

#552@H_404_3@ @H_404_3@ ret

#553@H_404_3@

#554@H_404_3@ ;

#555@H_404_3@ ; iso_compare_names:

#556@H_404_3@ ;@H_404_3@ Compare the names DS:SI and DS:DI and report if they are

#557@H_404_3@ ;@H_404_3@ equal from an ISO 9660 perspective.@H_404_3@ SI is the name from

#558@H_404_3@ ;@H_404_3@ the filesystem; CX indicates its length,and ';' terminates.

#559@H_404_3@ ;@H_404_3@ DI is expected to end with a null.

#560@H_404_3@ ;

#561@H_404_3@ ;@H_404_3@ Note: clobbers AX,CX,SI,DI; assumes DS == ES == base segment

#562@H_404_3@ ;

#563@H_404_3@ iso_compare_names:

#564@H_404_3@ @H_404_3@ ; First,terminate and canonicalize input filename

#565@H_404_3@ @H_404_3@ push@H_404_3@ di

#566@H_404_3@ @H_404_3@ mov@H_404_3@ di,ISOFileName

#567@H_404_3@ .canon_loop:

#568@H_404_3@ @H_404_3@ jcxz@H_404_3@ .canon_end

#569@H_404_3@ @H_404_3@ lodsb

#570@H_404_3@ @H_404_3@ dec@H_404_3@ cx

#571@H_404_3@ @H_404_3@ cmp@H_404_3@ al,';'

#572@H_404_3@ @H_404_3@ je@H_404_3@ .canon_end

#573@H_404_3@ @H_404_3@ and@H_404_3@ al,al

#574@H_404_3@ @H_404_3@ je@H_404_3@ .canon_end

#575@H_404_3@ @H_404_3@ stosb

#576@H_404_3@ @H_404_3@ cmp@H_404_3@ di,ISOFileNameEnd-1@H_404_3@ ; Guard against buffer overrun

#577@H_404_3@ @H_404_3@ jb@H_404_3@ .canon_loop

#578@H_404_3@ .canon_end:

#579@H_404_3@ @H_404_3@ cmp@H_404_3@ di,ISOFileName

#580@H_404_3@ @H_404_3@ jbe@H_404_3@ .canon_done

#581@H_404_3@ @H_404_3@ cmp@H_404_3@ byte [di-1],'.'@H_404_3@ ; Remove terminal dots

#582@H_404_3@ @H_404_3@ jne@H_404_3@ .canon_done

#583@H_404_3@ @H_404_3@ dec@H_404_3@ di

#584@H_404_3@ @H_404_3@ jmp@H_404_3@ short .canon_end

#585@H_404_3@ .canon_done:

#586@H_404_3@ @H_404_3@ mov@H_404_3@ [di],byte 0@H_404_3@ ; Null-terminate string

#587@H_404_3@ @H_404_3@ pop@H_404_3@ di

#588@H_404_3@ @H_404_3@ mov@H_404_3@ si,ISOFileName

#589@H_404_3@ .compare:

#590@H_404_3@ @H_404_3@ lodsb

#591@H_404_3@ @H_404_3@ mov@H_404_3@ ah,[di]

#592@H_404_3@ @H_404_3@ inc@H_404_3@ di

#593@H_404_3@ @H_404_3@ and@H_404_3@ ax,ax

#594@H_404_3@ @H_404_3@ jz@H_404_3@ .success@H_404_3@ ; End of string for both

#595@H_404_3@ @H_404_3@ and@H_404_3@ al,al@H_404_3@ ; Is either one end of string?

#596@H_404_3@ @H_404_3@ jz@H_404_3@ .failure@H_404_3@ ; If so,failure

#597@H_404_3@ @H_404_3@ and@H_404_3@ ah,ah

#598@H_404_3@ @H_404_3@ jz@H_404_3@ .failure

#599@H_404_3@ @H_404_3@ or@H_404_3@ ax,2020h@H_404_3@ ; Convert to lower case

#600@H_404_3@ @H_404_3@ cmp@H_404_3@ al,ah

#601@H_404_3@ @H_404_3@ je@H_404_3@ .compare

#602@H_404_3@ .failure:

#603@H_404_3@ @H_404_3@ and@H_404_3@ ax,ax@H_404_3@ ; ZF = 0 (at least one will be nonzero)

#604@H_404_3@ .success:

#605@H_404_3@ @H_404_3@ ret

#606@H_404_3@

#607@H_404_3@

#608@H_404_3@

#609@H_404_3@

#610@H_404_3@

#611@H_404_3@

#612@H_404_3@

#613@H_404_3@ ;

#614@H_404_3@ ; getfssec: Get multiple clusters from a file,given the file pointer.

#615@H_404_3@ ;

#616@H_404_3@ ;@H_404_3@ On entry:

#617@H_404_3@ ;@H_404_3@ ES:BX@H_404_3@ -> Buffer

#618@H_404_3@ ;@H_404_3@ SI@H_404_3@ -> File pointer

#619@H_404_3@ ;@H_404_3@ CX@H_404_3@ -> Cluster count; 0FFFFh = until end of file

#620@H_404_3@ ;@H_404_3@ On exit:

#621@H_404_3@ ;@H_404_3@ SI@H_404_3@ -> File pointer (or 0 on EOF)

#622@H_404_3@ ;@H_404_3@ CF = 1@H_404_3@ -> Hit EOF

#623@H_404_3@ ;

#624@H_404_3@ getfssec:

#625@H_404_3@ @H_404_3@ cmp@H_404_3@ cx,[si+file_left]

#626@H_404_3@ @H_404_3@ jna@H_404_3@ .ok_size

#627@H_404_3@ @H_404_3@ mov@H_404_3@ cx,[si+file_left]

#628@H_404_3@

#629@H_404_3@ .ok_size:

#630@H_404_3@ @H_404_3@ mov@H_404_3@ bp,cx

#631@H_404_3@ @H_404_3@ push@H_404_3@ cx

#632@H_404_3@ @H_404_3@ push@H_404_3@ si

#633@H_404_3@ @H_404_3@ mov@H_404_3@ eax,[si+file_sector]

#634@H_404_3@ @H_404_3@ call@H_404_3@ getlinsec

#635@H_404_3@ @H_404_3@ xor@H_404_3@ ecx,ecx

#636@H_404_3@ @H_404_3@ pop@H_404_3@ si

#637@H_404_3@ @H_404_3@ pop@H_404_3@ cx

#638@H_404_3@

#639@H_404_3@ @H_404_3@ add@H_404_3@ [si+file_sector],ecx

#640@H_404_3@ @H_404_3@ sub@H_404_3@ [si+file_left],ecx

#641@H_404_3@ @H_404_3@ ja@H_404_3@ .not_eof@H_404_3@ ; CF = 0

#642@H_404_3@

#643@H_404_3@ @H_404_3@ xor@H_404_3@ ecx,ecx

#644@H_404_3@ @H_404_3@ mov@H_404_3@ [si+file_sector],ecx@H_404_3@ ; Mark as unused

#645@H_404_3@ @H_404_3@ xor@H_404_3@ si,si

#646@H_404_3@ @H_404_3@ stc

#647@H_404_3@

#648@H_404_3@ .not_eof:

#649@H_404_3@ @H_404_3@ ret

#650@H_404_3@

#651@H_404_3@

#652@H_404_3@

#653@H_404_3@ ; INT 13h,AX=4B01h,DL=<passed in value> Failed.

#654@H_404_3@ ; Try to scan the entire 80h-FFh from the end.

#655@H_404_3@ spec_query_Failed:

#656@H_404_3@ @H_404_3@ mov@H_404_3@ si,spec_err_msg

#657@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#658@H_404_3@

#659@H_404_3@ @H_404_3@ mov@H_404_3@ dl,0FFh

#660@H_404_3@ .test_loop:

#661@H_404_3@ @H_404_3@ pusha

#662@H_404_3@ @H_404_3@ mov@H_404_3@ ax,4B01h

#663@H_404_3@ @H_404_3@ mov@H_404_3@ si,spec_packet

#664@H_404_3@ @H_404_3@ mov@H_404_3@ byte [si],13@H_404_3@ ; Size of buffer

#665@H_404_3@ @H_404_3@ int@H_404_3@ 13h

#666@H_404_3@ @H_404_3@ popa

#667@H_404_3@ @H_404_3@ jc@H_404_3@ .still_broken

#668@H_404_3@

#669@H_404_3@ @H_404_3@ mov@H_404_3@ si,maybe_msg

#670@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#671@H_404_3@ @H_404_3@ mov@H_404_3@ al,dl

#672@H_404_3@ @H_404_3@ call@H_404_3@ writehex2

#673@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#674@H_404_3@

#675@H_404_3@ @H_404_3@ cmp@H_404_3@ byte [sp_drive],dl

#676@H_404_3@ @H_404_3@ jne@H_404_3@ .maybe_broken

#677@H_404_3@

#678@H_404_3@ @H_404_3@ ; Okay,good enough...

#679@H_404_3@ @H_404_3@ mov@H_404_3@ si,alright_msg

#680@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#681@H_404_3@ @H_404_3@ mov@H_404_3@ [DriveNo],dl

#682@H_404_3@ .found_drive:

#683@H_404_3@ @H_404_3@ jmp@H_404_3@ found_drive

#684@H_404_3@

#685@H_404_3@ @H_404_3@ ; Award BIOS 4.51 apparently passes garbage in sp_drive,

#686@H_404_3@ @H_404_3@ ; but if this was the drive number originally passed in

#687@H_404_3@ @H_404_3@ ; DL then consider it "good enough"

#688@H_404_3@ .maybe_broken:

#689@H_404_3@ @H_404_3@ cmp@H_404_3@ byte [DriveNo],dl

#690@H_404_3@ @H_404_3@ je@H_404_3@ .found_drive

#691@H_404_3@

#692@H_404_3@ .still_broken:

#693@H_404_3@ @H_404_3@ dec dx

#694@H_404_3@ @H_404_3@ cmp@H_404_3@ dl,80h

#695@H_404_3@ @H_404_3@ jnb@H_404_3@ .test_loop

#696@H_404_3@

#697@H_404_3@ fatal_error:

#698@H_404_3@ @H_404_3@ mov@H_404_3@ si,nothing_msg

#699@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#700@H_404_3@

#701@H_404_3@ .norge:

#702@H_404_3@ @H_404_3@ jmp@H_404_3@ short .norge

#703@H_404_3@

#704@H_404_3@

#705@H_404_3@

#706@H_404_3@ @H_404_3@ ; Information message (DS:SI) output

#707@H_404_3@ @H_404_3@ ; Prefix with "isolinux: "

#708@H_404_3@ @H_404_3@ ;

#709@H_404_3@ writemsg:

#710@H_404_3@ @H_404_3@ push@H_404_3@ ax

#711@H_404_3@ @H_404_3@ push@H_404_3@ si

#712@H_404_3@ @H_404_3@ mov@H_404_3@ si,isolinux_str

#713@H_404_3@ @H_404_3@ call@H_404_3@ writestr

#714@H_404_3@ @H_404_3@ pop@H_404_3@ si

#715@H_404_3@ @H_404_3@ call@H_404_3@ writestr

#716@H_404_3@ @H_404_3@ pop@H_404_3@ ax

#717@H_404_3@ @H_404_3@ ret

#718@H_404_3@

#719@H_404_3@ ;

#720@H_404_3@ ; crlf: Print a newline

#721@H_404_3@ ;

#722@H_404_3@ crlf:

#723@H_404_3@ @H_404_3@ mov@H_404_3@ si,crlf_msg

#724@H_404_3@ @H_404_3@ ; Fall through

#725@H_404_3@

#726@H_404_3@ ;

#727@H_404_3@ ; writestr: write a null-terminated string to the console,saving

#728@H_404_3@ ;@H_404_3@ registers on entry.

#729@H_404_3@ ;

#730@H_404_3@ writestr:

#731@H_404_3@ @H_404_3@ pushfd

#732@H_404_3@ @H_404_3@ pushad

#733@H_404_3@ .top:

#734@H_404_3@ @H_404_3@ lodsb

#735@H_404_3@ @H_404_3@ and@H_404_3@ al,al

#736@H_404_3@ @H_404_3@ jz@H_404_3@ .end

#737@H_404_3@ @H_404_3@ call@H_404_3@ writechr

#738@H_404_3@ @H_404_3@ jmp@H_404_3@ short .top

#739@H_404_3@ .end:

#740@H_404_3@ @H_404_3@ popad

#741@H_404_3@ @H_404_3@ popfd

#742@H_404_3@ @H_404_3@ ret

#743@H_404_3@

#744@H_404_3@

#745@H_404_3@ ;

#746@H_404_3@ ; writehex[248]: Write a hex number in (AL,AX,EAX) to the console

#747@H_404_3@ ;

#748@H_404_3@ writehex2:

#749@H_404_3@ @H_404_3@ pushfd

#750@H_404_3@ @H_404_3@ pushad

#751@H_404_3@ @H_404_3@ shl@H_404_3@ eax,24

#752@H_404_3@ @H_404_3@ mov@H_404_3@ cx,2

#753@H_404_3@ @H_404_3@ jmp@H_404_3@ short writehex_common

#754@H_404_3@ writehex4:

#755@H_404_3@ @H_404_3@ pushfd

#756@H_404_3@ @H_404_3@ pushad

#757@H_404_3@ @H_404_3@ shl@H_404_3@ eax,16

#758@H_404_3@ @H_404_3@ mov@H_404_3@ cx,4

#759@H_404_3@ @H_404_3@ jmp@H_404_3@ short writehex_common

#760@H_404_3@ writehex8:

#761@H_404_3@ @H_404_3@ pushfd

#762@H_404_3@ @H_404_3@ pushad

#763@H_404_3@ @H_404_3@ mov@H_404_3@ cx,8

#764@H_404_3@ writehex_common:

#765@H_404_3@ .loop:

#766@H_404_3@ @H_404_3@ rol@H_404_3@ eax,4

#767@H_404_3@ @H_404_3@ push@H_404_3@ eax

#768@H_404_3@ @H_404_3@ and@H_404_3@ al,0Fh

#769@H_404_3@ @H_404_3@ cmp@H_404_3@ al,10

#770@H_404_3@ @H_404_3@ jae@H_404_3@ .high

#771@H_404_3@ .low:

#772@H_404_3@ @H_404_3@ add@H_404_3@ al,'0'

#773@H_404_3@ @H_404_3@ jmp@H_404_3@ short .ischar

#774@H_404_3@ .high:

#775@H_404_3@ @H_404_3@ add@H_404_3@ al,'A'-10

#776@H_404_3@ .ischar:

#777@H_404_3@ @H_404_3@ call@H_404_3@ writechr

#778@H_404_3@ @H_404_3@ pop@H_404_3@ eax

#779@H_404_3@ @H_404_3@ loop@H_404_3@ .loop

#780@H_404_3@ @H_404_3@ popad

#781@H_404_3@ @H_404_3@ popfd

#782@H_404_3@ @H_404_3@ ret

#783@H_404_3@

#784@H_404_3@ ;

#785@H_404_3@ ; Write a character to the screen.@H_404_3@ There is a more "sophisticated"

#786@H_404_3@ ; version of this in the subsequent code,so we patch the pointer

#787@H_404_3@ ; when appropriate.

#788@H_404_3@ ;

#789@H_404_3@

#790@H_404_3@ writechr:

#791@H_404_3@ @H_404_3@ pushfd

#792@H_404_3@ @H_404_3@ pushad

#793@H_404_3@ @H_404_3@ mov@H_404_3@ ah,0Eh

#794@H_404_3@ @H_404_3@ xor@H_404_3@ bx,bx

#795@H_404_3@ @H_404_3@ int@H_404_3@ 10h

#796@H_404_3@ @H_404_3@ popad

#797@H_404_3@ @H_404_3@ popfd

#798@H_404_3@ @H_404_3@ ret

#799@H_404_3@

#800@H_404_3@ ;

#801@H_404_3@ ; Get one sector.@H_404_3@ Convenience entry point.

#802@H_404_3@ ;

#803@H_404_3@ getonesec:

#804@H_404_3@ @H_404_3@ mov@H_404_3@ bp,1

#805@H_404_3@ @H_404_3@ ; Fall through to getlinsec

#806@H_404_3@

#807@H_404_3@ ;

#808@H_404_3@ ; Get linear sectors - EBIOS LBA addressing,2048-byte sectors.

#809@H_404_3@ ;

#810@H_404_3@ ; Note that we can't always do this as a single request,because at least

#811@H_404_3@ ; Phoenix BIOSes has a 127-sector limit.@H_404_3@ To be on the safe side,stick

#812@H_404_3@ ; to 32 sectors (64K) per request.

#813@H_404_3@ ;

#814@H_404_3@ ; Input:

#815@H_404_3@ ;@H_404_3@ EAX@H_404_3@ - Linear sector number

#816@H_404_3@ ;@H_404_3@ ES:BX@H_404_3@ - Target buffer

#817@H_404_3@ ;@H_404_3@ BP@H_404_3@ - Sector count

#818@H_404_3@ ;

#819@H_404_3@ getlinsec:

#820@H_404_3@ @H_404_3@ mov si,dapa@H_404_3@ ; Load up the DAPA

#821@H_404_3@ @H_404_3@ mov [si+4],bx

#822@H_404_3@ @H_404_3@ mov bx,es

#823@H_404_3@ @H_404_3@ mov [si+6],bx

#824@H_404_3@ @H_404_3@ mov [si+8],eax

#825@H_404_3@ .loop2:

#826@H_404_3@ @H_404_3@ push bp@H_404_3@ ; Sectors left

#827@H_404_3@ @H_404_3@ cmp bp,[MaxTransfer]

#828@H_404_3@ @H_404_3@ jbe .bp_ok

#829@H_404_3@ @H_404_3@ mov bp,[MaxTransfer]

#830@H_404_3@ .bp_ok:

#831@H_404_3@ @H_404_3@ mov [si+2],bp

#832@H_404_3@ @H_404_3@ push si

#833@H_404_3@ @H_404_3@ mov dl,[DriveNo]

#834@H_404_3@ @H_404_3@ mov ah,42h@H_404_3@ ; Extended Read

#835@H_404_3@ @H_404_3@ call xint13

#836@H_404_3@ @H_404_3@ pop si

#837@H_404_3@ @H_404_3@ pop bp

#838@H_404_3@ @H_404_3@ movzx eax,word [si+2]@H_404_3@ ; Sectors we read

#839@H_404_3@ @H_404_3@ add [si+8],eax@H_404_3@ ; Advance sector pointer

#840@H_404_3@ @H_404_3@ sub bp,ax@H_404_3@ ; Sectors left

#841@H_404_3@ @H_404_3@ shl ax,SECTORSIZE_LG2-4@H_404_3@ ; 2048-byte sectors -> segment

#842@H_404_3@ @H_404_3@ add [si+6],ax@H_404_3@ ; Advance buffer pointer

#843@H_404_3@ @H_404_3@ and bp,bp

#844@H_404_3@ @H_404_3@ jnz .loop2

#845@H_404_3@ @H_404_3@ mov eax,[si+8]@H_404_3@ ; Next sector

#846@H_404_3@ @H_404_3@ ret

#847@H_404_3@

#848@H_404_3@ @H_404_3@ ; INT 13h with retry

#849@H_404_3@ xint13:

#850@H_404_3@ @H_404_3@ mov@H_404_3@ byte [RetryCount],retry_count

#851@H_404_3@ .try:

#852@H_404_3@ @H_404_3@ pushad

#853@H_404_3@ @H_404_3@ int@H_404_3@ 13h

#854@H_404_3@ @H_404_3@ jc@H_404_3@ .error

#855@H_404_3@ @H_404_3@ add@H_404_3@ sp,byte 8*4@H_404_3@ ; Clean up stack

#856@H_404_3@ @H_404_3@ ret

#857@H_404_3@ .error:

#858@H_404_3@ @H_404_3@ mov@H_404_3@ [DiskError],ah@H_404_3@ ; Save error code

#859@H_404_3@ @H_404_3@ popad

#860@H_404_3@ @H_404_3@ dec byte [RetryCount]

#861@H_404_3@ @H_404_3@ jz .real_error

#862@H_404_3@ @H_404_3@ push ax

#863@H_404_3@ @H_404_3@ mov al,[RetryCount]

#864@H_404_3@ @H_404_3@ mov ah,[dapa+2]@H_404_3@ ; Sector transfer count

#865@H_404_3@ @H_404_3@ cmp al,2@H_404_3@ ; Only 2 attempts left

#866@H_404_3@ @H_404_3@ ja .nodanger

#867@H_404_3@ @H_404_3@ mov ah,1@H_404_3@ ; Drop transfer size to 1

#868@H_404_3@ @H_404_3@ jmp short .setsize

#869@H_404_3@ .nodanger:

#870@H_404_3@ @H_404_3@ cmp al,retry_count-2

#871@H_404_3@ @H_404_3@ ja .again@H_404_3@ ; First time,just try again

#872@H_404_3@ @H_404_3@ shr ah,1@H_404_3@ ; Otherwise,try to reduce

#873@H_404_3@ @H_404_3@ adc ah,0@H_404_3@ ; the max transfer size,but not to 0

#874@H_404_3@ .setsize:

#875@H_404_3@ @H_404_3@ mov [MaxTransfer],ah

#876@H_404_3@ @H_404_3@ mov [dapa+2],ah

#877@H_404_3@ .again:

#878@H_404_3@ @H_404_3@ pop ax

#879@H_404_3@ @H_404_3@ jmp .try

#880@H_404_3@

#881@H_404_3@ .real_error:

#882@H_404_3@ @H_404_3@ mov@H_404_3@ si,diskerr_msg

#883@H_404_3@ @H_404_3@ call@H_404_3@ writemsg

#884@H_404_3@ @H_404_3@ mov@H_404_3@ al,[DiskError]

#885@H_404_3@ @H_404_3@ call@H_404_3@ writehex2

#886@H_404_3@ @H_404_3@ mov@H_404_3@ si,ondrive_str

#887@H_404_3@ @H_404_3@ call@H_404_3@ writestr

#888@H_404_3@ @H_404_3@ mov@H_404_3@ al,dl

#889@H_404_3@ @H_404_3@ call@H_404_3@ writehex2

#890@H_404_3@ @H_404_3@ call@H_404_3@ crlf

#891@H_404_3@ @H_404_3@ ; Fall through to kaboom

#892@H_404_3@

#893@H_404_3@ ;

#894@H_404_3@ ; kaboom: write a message and bail out.@H_404_3@ Wait for a user keypress,

#895@H_404_3@ ;@H_404_3@ @H_404_3@ then do a hard reboot.

#896@H_404_3@ ;

#897@H_404_3@ kaboom:

#898@H_404_3@ @H_404_3@ mov@H_404_3@ ax,cs

#899@H_404_3@ @H_404_3@ mov@H_404_3@ ds,ax

#900@H_404_3@ @H_404_3@ mov@H_404_3@ es,ax

#901@H_404_3@ @H_404_3@ mov@H_404_3@ fs,ax

#902@H_404_3@ @H_404_3@ mov@H_404_3@ gs,ax

#903@H_404_3@ @H_404_3@ sti

#904@H_404_3@ @H_404_3@ mov@H_404_3@ si,err_bootFailed

#905@H_404_3@ @H_404_3@ call@H_404_3@ writestr

#906@H_404_3@ @H_404_3@ call@H_404_3@ getchar

#907@H_404_3@ @H_404_3@ cli

#908@H_404_3@ @H_404_3@ mov@H_404_3@ word [BIOS_magic],0@H_404_3@ ; Cold reboot

#909@H_404_3@ @H_404_3@ jmp@H_404_3@ 0F000h:0FFF0h@H_404_3@ ; Reset vector address

#910@H_404_3@

#911@H_404_3@ getchar:

#912@H_404_3@ .again:

#913@H_404_3@ @H_404_3@ mov@H_404_3@ ah,1@H_404_3@ ; Poll keyboard

#914@H_404_3@ @H_404_3@ int@H_404_3@ 16h

#915@H_404_3@ @H_404_3@ jz@H_404_3@ .again

#916@H_404_3@ .kbd:

#917@H_404_3@ @H_404_3@ xor@H_404_3@ ax,ax@H_404_3@ ; Get keyboard input

#918@H_404_3@ @H_404_3@ int@H_404_3@ 16h

#919@H_404_3@ .func_key:

#920@H_404_3@ @H_404_3@ ret

#921@H_404_3@

#922@H_404_3@

#923@H_404_3@ ;

#924@H_404_3@ ; pollchar: check if we have an input character pending (ZF = 0)

#925@H_404_3@ ;

#926@H_404_3@ pollchar:

#927@H_404_3@ @H_404_3@ pushad

#928@H_404_3@ @H_404_3@ mov ah,1@H_404_3@ ; Poll keyboard

#929@H_404_3@ @H_404_3@ int 16h

#930@H_404_3@ @H_404_3@ popad

#931@H_404_3@ @H_404_3@ ret

#932@H_404_3@

#933@H_404_3@

#934@H_404_3@

#935@H_404_3@ isolinux_banner@H_404_3@ db CR,LF,'Loading IsoBoot...',CR,0

#936@H_404_3@ copyright_str@H_404_3@ db ' Copyright (C) 1994-2002 H. Peter Anvin',0

#937@H_404_3@ presskey_msg@H_404_3@ db 'Press any key to boot from CD',0

#938@H_404_3@ dot_msg@H_404_3@ db '.',0

#939@H_404_3@

#940@H_404_3@ %ifdef DEBUG_MESSAGES

#941@H_404_3@ startup_msg:@H_404_3@ db 'Starting up,DL = ',0

#942@H_404_3@ spec_ok_msg:@H_404_3@ db 'Loaded spec packet OK,drive = ',0

#943@H_404_3@ secsize_msg:@H_404_3@ db 'Sector size appears to be ',0

#944@H_404_3@ rootloc_msg:@H_404_3@ db 'Root directory location: ',0

#945@H_404_3@ rootlen_msg:@H_404_3@ db 'Root directory length: ',0

#946@H_404_3@ rootsect_msg:@H_404_3@ db 'Root directory length(sectors): ',0

#947@H_404_3@ fileloc_msg:@H_404_3@ db 'SETUPLDR.SYS location: ',0

#948@H_404_3@ filelen_msg:@H_404_3@ db 'SETUPLDR.SYS length: ',0

#949@H_404_3@ filesect_msg:@H_404_3@ db 'SETUPLDR.SYS length(sectors): ',0

#950@H_404_3@ findfail_msg:@H_404_3@ db 'Failed to find file!',0

#951@H_404_3@ startldr_msg:@H_404_3@ db 'Starting SETUPLDR.SYS',0

#952@H_404_3@ %endif

#953@H_404_3@

#954@H_404_3@ nosecsize_msg:@H_404_3@ db 'Failed to get sector size,assuming 0800',0

#955@H_404_3@ spec_err_msg:@H_404_3@ db 'Loading spec packet Failed,trying to wing it...',0

#956@H_404_3@ maybe_msg:@H_404_3@ db 'Found something at drive = ',0

#957@H_404_3@ alright_msg:@H_404_3@ db 'Looks like it might be right,continuing...',0

#958@H_404_3@ nothing_msg:@H_404_3@ db 'Failed to locate CD-ROM device; boot Failed.',0

#959@H_404_3@ isolinux_str@H_404_3@ db 'IsoBoot: ',0

#960@H_404_3@ crlf_msg@H_404_3@ db CR,0

#961@H_404_3@ diskerr_msg:@H_404_3@ db 'Disk error ',0

#962@H_404_3@ ondrive_str:@H_404_3@ db ',drive ',0

#963@H_404_3@ err_bootFailed@H_404_3@ db CR,'Boot Failed: press a key to retry...'

#964@H_404_3@ isolinux_dir@H_404_3@ db '/LOADER',0

#965@H_404_3@ no_dir_msg@H_404_3@ db 'Could not find the LOADER directory.',0

#966@H_404_3@ isolinux_bin@H_404_3@ db 'SETUPLDR.SYS',0

#967@H_404_3@ no_isolinux_msg@H_404_3@ db 'Could not find SETUPLDR.SYS.',0

#968@H_404_3@

#969@H_404_3@ ;

#970@H_404_3@ ; El Torito spec packet

#971@H_404_3@ ;

#972@H_404_3@ @H_404_3@ align 8,db 0

#973@H_404_3@ spec_packet:@H_404_3@ db 13h@H_404_3@ ; Size of packet

#974@H_404_3@ sp_media:@H_404_3@ db 0@H_404_3@ ; Media type

#975@H_404_3@ sp_drive:@H_404_3@ db 0@H_404_3@ ; Drive number

#976@H_404_3@ sp_controller:@H_404_3@ db 0@H_404_3@ ; Controller index

#977@H_404_3@ sp_lba:@H_404_3@ dd 0@H_404_3@ ; LBA for emulated disk image

#978@H_404_3@ sp_devspec:@H_404_3@ dw 0@H_404_3@ ; IDE/SCSI information

#979@H_404_3@ sp_buffer:@H_404_3@ dw 0@H_404_3@ ; User-provided buffer

#980@H_404_3@ sp_loadseg:@H_404_3@ dw 0@H_404_3@ ; Load segment

#981@H_404_3@ sp_sectors:@H_404_3@ dw 0@H_404_3@ ; Sector count

#982@H_404_3@ sp_chs:@H_404_3@ db 0,0@H_404_3@ ; Simulated CHS geometry

#983@H_404_3@ sp_dummy:@H_404_3@ db 0@H_404_3@ ; Scratch,safe to overwrite

#984@H_404_3@

#985@H_404_3@ ;

#986@H_404_3@ ; EBIOS drive parameter packet

#987@H_404_3@ ;

#988@H_404_3@ @H_404_3@ align 8,db 0

#989@H_404_3@ drive_params:@H_404_3@ dw 30@H_404_3@ ; Buffer size

#990@H_404_3@ dp_flags:@H_404_3@ dw 0@H_404_3@ ; Information flags

#991@H_404_3@ dp_cyl:@H_404_3@ dd 0@H_404_3@ ; Physical cylinders

#992@H_404_3@ dp_head:@H_404_3@ dd 0@H_404_3@ ; Physical heads

#993@H_404_3@ dp_sec:@H_404_3@ dd 0@H_404_3@ @H_404_3@ ; Physical sectors/track

#994@H_404_3@ dp_totalsec:@H_404_3@ dd 0,0@H_404_3@ ; Total sectors

#995@H_404_3@ dp_secsize:@H_404_3@ dw 0@H_404_3@ ; Bytes per sector

#996@H_404_3@ dp_dpte:@H_404_3@ dd 0@H_404_3@ ; Device Parameter Table

#997@H_404_3@ dp_dpi_key:@H_404_3@ dw 0@H_404_3@ ; 0BEDDh if rest valid

#998@H_404_3@ dp_dpi_len:@H_404_3@ db 0@H_404_3@ ; DPI len

#999@H_404_3@ @H_404_3@ db 0

#1000@H_404_3@ @H_404_3@ dw 0

#1001@H_404_3@ dp_bus:@H_404_3@ times 4 db 0@H_404_3@ ; Host bus type

#1002@H_404_3@ dp_interface:@H_404_3@ times 8 db 0@H_404_3@ ; Interface type

#1003@H_404_3@ db_i_path:@H_404_3@ dd 0,0@H_404_3@ ; Interface path

#1004@H_404_3@ db_d_path:@H_404_3@ dd 0,0@H_404_3@ ; Device path

#1005@H_404_3@ @H_404_3@ db 0

#1006@H_404_3@ db_dpi_csum:@H_404_3@ db 0@H_404_3@ ; Checksum for DPI info

#1007@H_404_3@

#1008@H_404_3@ ;

#1009@H_404_3@ ; EBIOS disk address packet

#1010@H_404_3@ ;

#1011@H_404_3@ @H_404_3@ align 8,db 0

#1012@H_404_3@ dapa:@H_404_3@ dw 16@H_404_3@ ; Packet size

#1013@H_404_3@ .count:@H_404_3@ dw 0@H_404_3@ ; Block count

#1014@H_404_3@ .off:@H_404_3@ dw 0@H_404_3@ ; Offset of buffer

#1015@H_404_3@ .seg:@H_404_3@ dw 0@H_404_3@ ; Segment of buffer

#1016@H_404_3@ .lba:@H_404_3@ dd 0@H_404_3@ ; LBA (LSW)

#1017@H_404_3@ @H_404_3@ dd 0@H_404_3@ ; LBA (MSW)

#1018@H_404_3@

#1019@H_404_3@ @H_404_3@ alignb 4,db 0

#1020@H_404_3@ MaxTransfer@H_404_3@ dw 2 ;32@H_404_3@ ; Max sectors per transfer

#1021@H_404_3@

#1022@H_404_3@ @H_404_3@ times 2046-($-$$) db 0@H_404_3@ ; Pad to file offset 2046

#1023@H_404_3@ @H_404_3@ dw 0aa55h@H_404_3@ ; BootSector signature

#1024@H_404_3@

@H_404_3@上面分析了光盘引导程序,知道怎么跳转到二级引导程序工作。也就是加载SETUPLDR.SYS@H_404_3@文件到内存,然后跳到相应位置运行。最后加载内核ntoskrnl.exe@H_404_3@运行。

猜你在找的React相关文章