📄 grub-0.95-patch1-startups
字号:
+ xorb %al, %al /* 0 means the end of the string */+ cld+ repnz scasb+ popw %cx++ movw %cx, %ax+ addw %di, %ax+ cmpw $ABS_PSP(end_dosstart+0x6f), %ax /* check for possible+ buffer overflow */+ jnb file_name_too_long+ cld+ repz movsb /* now it is safe, perform the move */+ xorb %al, %al /* write an end-of-string mark */+ movb %al, (%di) /* to the new config file name */+#if 1 + smsw %ax /* the old 286 code, save MSW to AX */+ testb $0x01, %al /* is it in protected mode? */+ jnz protected_mode /* continue to check vm86 mode */+#endif+ jmp guess_DOS_versions /* in real mode, continue */++use_default_config_file:+ movw $ABS_PSP(option_config_file + 0x0e), %si+ movw $0x001a, %cx+ jmp put_config_file_name++invalid_option:+ movw $ABS_PSP(usage_string), %dx+ movb $0x09, %ah /* display a dollar teminated string */+ int $0x21 /* call DOS */+ + /* hexdump the PSP commandline area */+ movb $0x0e, %ah /* display char */+ movw $7, %bx /* white */+ movb $8, %dh /* 8 sections (1 section = 16 bytes) */+ movw $0x0080, %si /* offset in PSP */+4:+ movw $0x10, %cx /* display 16 bytes per line */+ /* display leading string like "0080: " */+ movb $0x30, %al /* display "0" */+ int $0x10+ int $0x10 /* twice */+ movw %si, %ax /* AH modified */+ shrb $4, %al /* higher 4 bits of SI */+ cmpb $9, %al+ jbe 2f+ addb $7, %al+2:+ addb $0x30, %al /* 0x30 is '0' */+ movb $0x0e, %ah /* display char */+ int $0x10+ movb $0x30, %al /* display "0" */+ int $0x10+ movb $0x3a, %al /* display ":" */+ int $0x10+ movb $0x20, %al /* display 3 space chars */+ int $0x10+ int $0x10+ int $0x10+ + /* display hex values */+1:+ lodsb+ movb %al, %dl /* save lower 4 bits of AL to DL */+ shrb $4, %al /* higher 4 bits */+ cmpb $9, %al+ jbe 2f+ addb $7, %al+2:+ addb $0x30, %al /* 0x30 is '0' */+ movb $0x0e, %ah /* display char */+ //movw $7, %bx /* white */+ int $0x10+ movb %dl, %al /* restore AL from DL */+ andb $0x0f, %al+ cmpb $9, %al+ jbe 2f+ addb $7, %al+2:+ addb $0x30, %al /* 0x30 is '0' */+ //movb $0x0e, %ah /* display char */+ //movw $7, %bx /* white */+ int $0x10+ movb $0x20, %al /* display a space char */+ int $0x10+ loop 1b+ + int $0x10 /* display 2 space chars */+ int $0x10+ + /* display ascii values */+ + movw $0x10, %cx+ subw %cx, %si+1:+ lodsb+ //cmpb $0x80, %al /* is it big char? */+ //jb 2f /* no, continue */+ cmpb $7, %al /* is it BELL char? */+ je 2f /* no, continue */+ cmpb $8, %al /* is it BACKSPACE char? */+ je 2f /* no, continue */+ cmpb $0x0a, %al /* is it LF char? */+ je 2f /* no, continue */+ cmpb $0x0d, %al /* is it CR char? */+ jne 3f /* no, continue */+2:+ movb $0x2e, %al /* display a dot */+3:+ int $0x10+ loop 1b+ + movb $0x0d, %al /* display CR char */+ int $0x10+ movb $0x0a, %al /* display LF char */+ int $0x10+ + decb %dh+ jnz 4b+ + jmp 1f++message_exit:+ movb $0x09, %ah /* display a dollar teminated string */+ int $0x21 /* call DOS */+1:+ movw $0x4c01, %ax /* exit with error number 01 */+ int $0x21 /* call DOS */++program_hangs: /* should not get here, just in case int21/4c01 would fail */+ jmp program_hangs++protected_mode:+ pushfw+ popw %ax+ testb $0x30, %ah /* IOPL */+ jz 1f++ /* IOPL is not 0 */+ andb $0xcf, %ah /* let IOPL = 0 */+ pushw %ax+ popfw+ pushfw+ popw %ax+ testb $0x30, %ah /* is IOPL still 0? */+ jz 2f /* CPL is 0 */+ jmp 3f+1:+ /* IOPL is 0 */+ orb $0x30, %ah /* let IOPL != 0 */+ pushw %ax+ popfw+ pushfw+ popw %ax+ testb $0x30, %ah /* is IOPL still 0? */+ jnz 2f /* CPL is 0 */+ jmp 3f+2:+ /* emm386 will get here */+ andb $0xcf, %ah /* let IOPL = 0 */+ pushw %ax+ popfw+ jmp guess_DOS_versions /* CPL = 0, Continue */+3:+ /* CPL != 0, exit */+ /* vm86 mode would get here */+ movw $ABS_PSP(protected_string), %dx+ jmp message_exit++file_name_too_long:+ movw $ABS_PSP(fatal_string), %dx+ jmp message_exit+ +mapped_int13_vector_BIOS:+ .word 0 /* hooked int13 segment */+ .word 0 /* low mem in K before int13 hook */+ .long 0 /* original BIOS int13 vector if non-zero */+/* stage2_64K_pages: */+ .word (STAGE2_SIZE + 0x200 + 0xffff) >> 16++usage_string: /* DOS string terminator is dollar($), not the null char */+ .ascii "\r\nGRUB: Unrecognized command line parameters. Usage:\r\n\r\n"+ .ascii "\tGRUB --config-file=FILE\r\n\r\n"+ .ascii "The options are case-sensitive, you must use lower-case "+ .ascii "letters. Example:\r\n\r\n\tGRUB "+option_config_file:+ .ascii "--config-file=(hd0,0)/boot/grub/menu.lst\r\n\r\n"+ .ascii "Hexdump of command-line buffer in PSP:\r\n\r\n$"+protected_string:+ .ascii "\r\n\r\nMust run in real mode or ring 0 of protected mode. Cannot run in vm86 mode.\r\n\r\n$"+fatal_string:+ .ascii "\r\nFatal error: filename too long!\r\n$"+dos_unsupport_string:+ .ascii "\r\nSorry! Currently supported DOS versions are: MS-DOS 3.30 and later; FreeDOS\r\nkernel build 2032 and later.\r\n\r\nPrograms such as TSRs and device drivers may also change the BIOS interrupt\r\nvector table. Make sure those programs are not running, then try again.\r\n$"++check_a_range_of_ROM_vectors:+ cld+ lodsl+ cmpl $0xC0000000, %eax /* ROM vectors assumed to be above C000:0 */+ jb 1f /* check failed, with carry */+ loop check_a_range_of_ROM_vectors+ clc /* check passed, with no carry */+1: ret++guess_DOS_versions:++#if 1+ /* Check if any bootable CDROM disk emulation exists */++ xorw %dx, %dx /* DL=0 means floppy */+ movw $0x4b01, %ax /* query emulation status */+ movw $0x100, %si+ int $0x13+ jc 1f+ testb %ah, %ah+ jz 4f /* floppy emulation exists */+1:+ movw $0x0010, %cx+3:+ movw %cx, %dx+ orb $0x80, %dl /* check hard disk emulation */+ decb %dl+ movw $0x4b01, %ax+ movw $0x100, %si+ int $0x13+ jc 1f+ testb %ah, %ah+ jz 4f /* hard disk emulation exists */+1:+ loop 3b+ jmp 2f /* no disk emulation, do nothing */+4:+ /* terminate CDROM disk emulation for win98 to work well */+ + movw $0x4b00, %ax /* CDROM terminate disk emulation */+ movb $0x7f, %dl /* try to terminate all emulated drives */++ /* We use the beginning of the code segment as a scratch area. This is+ * safe because this code area no longer got executed from now on. */+ movw $0x0100, %si /* DS:SI=PSP:0100=CS:0000, use 0x13 bytes */+ int $0x13+ jc 1f+ testb %ah, %ah+ jz 2f /* all drive emulations are terminated */+1:+ /* failed, so try to terminate each emulated drive one by one */+ xorw %dx, %dx /* DL=0 means terminate floppy emulation */+ movw $0x4b00, %ax+ movw $0x100, %si+ int $0x13+ + movw $0x0010, %cx+3:+ movw %cx, %dx /* DL is the drive to terminate emulation */+ orb $0x80, %dl+ decb %dl+ movw $0x4b00, %ax+ movw $0x100, %si+ int $0x13+ incb %dl+ cmpw %cx, %dx /* int13 function 4b works? */+ jne 2f /* no, exit the loop */+ loop 3b+2:+#endif++ /* check for MS-DOS 7.0+ */+ + xorw %ax, %ax+ movw %ax, %ds++ movw $0x0560, %si /* begins the int 08 vector */+ movw $0x0008, %cx /* 8 vectors to check, from int 08 to 0f */+ call check_a_range_of_ROM_vectors+ jc failed_check_msdos7plus+#if 0+ /* this area seems to be an internal MSDOS stack, so may be corrupted */+ movw $0x05dc, %si /* begins the int 70 vector */+ movw $0x0008, %cx /* 8 vectors to check, from int 70 to 77 */+ call check_a_range_of_ROM_vectors+ jc failed_check_msdos7plus+#else+ movw $0x05dc, %si /* check int70 */+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ movw $0x01c0, %si+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ ldsw -4(%si), %si /* DS got changed */+ subw $4, %si+ lodsl+ cmpl $0xc0000000, %eax+ jb failed_check_msdos7plus+ xorw %ax, %ax+ movw %ax, %ds /* let DS = 0 */+1:+ movw $0x05e0, %si /* check int71 */+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ movw $0x01c4, %si+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jb failed_check_msdos7plus+1:+ movw $0x05e4, %si /* check int72 */+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ movw $0x01c8, %si+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ ldsw -4(%si), %si /* DS got changed */+ lodsw+ cmpw $0x10eb, %ax+ jne failed_check_msdos7plus+ lodsl+ cmpl $0xc0000000, %eax+ jb failed_check_msdos7plus+ xorw %ax, %ax+ movw %ax, %ds /* let DS = 0 */+1:+ movw $0x05e8, %si /* check int73 */+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ movw $0x01cc, %si+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ ldsw -4(%si), %si /* DS got changed */+ lodsw+ cmpw $0x10eb, %ax+ jne failed_check_msdos7plus+ lodsl+ cmpl $0xc0000000, %eax+ jb failed_check_msdos7plus+ xorw %ax, %ax+ movw %ax, %ds /* let DS = 0 */+1:+ movw $0x05ec, %si /* check int74 */+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ movw $0x01d0, %si+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ ldsw -4(%si), %si /* DS got changed */+ lodsw+ cmpw $0x10eb, %ax+ jne failed_check_msdos7plus+ lodsl+ cmpl $0xc0000000, %eax+ jb failed_check_msdos7plus+ xorw %ax, %ax+ movw %ax, %ds /* let DS = 0 */+1:+ movw $0x05f0, %si /* check int75 */+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ movw $0x01d4, %si+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jb failed_check_msdos7plus+1:+ movw $0x05f4, %si /* check int76 */+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ movw $0x01d8, %si+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ ldsw -4(%si), %si /* DS got changed */+ lodsw+ cmpw $0x10eb, %ax+ jne failed_check_msdos7plus+ lodsl+ cmpl $0xc0000000, %eax+ jb failed_check_msdos7plus+ xorw %ax, %ax+ movw %ax, %ds /* let DS = 0 */+1:+ movw $0x05f8, %si /* check int77 */+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ movw $0x01dc, %si+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ ldsw -4(%si), %si /* DS got changed */+ lodsw+ cmpw $0x10eb, %ax+ jne failed_check_msdos7plus+ lodsl+ cmpl $0xc0000000, %eax+ jb failed_check_msdos7plus+ xorw %ax, %ax+ movw %ax, %ds /* let DS = 0 */+1:+#endif+ movw $0x05a4, %si /* the int 19 vector(?) must be 0 */+ cld+ lodsl+ orl %eax, %eax+ jnz failed_check_msdos7plus+#if 1+ movw $0x05d4, %si /* the int 4b vector must be preserved */+ cld+ lodsl+ movl %eax, %ebx+ movw $0x012c, %si /* the int 4b vector in place */+ cld+ lodsl+ cmpl %ebx, %eax+ jnz failed_check_msdos7plus+#endif+ movw $0x081e, %si /* another saved int 08 vector */+ cld+ lodsb+ cmpb $0x08, %al+ jnz failed_check_msdos7plus+ cld+ lodsl+ movl %eax, %ebx+ movw $0x0560, %si /* the saved int 08 vector */+ cld+ lodsl+ cmpl %ebx, %eax+ jnz failed_check_msdos7plus++ movw $0x0823, %si /* another saved int 0f vector */+ cld+ lodsb+ cmpb $0x0f, %al+ jnz failed_check_msdos7plus+ cld+ lodsl+ movl %eax, %ebx+ movw $0x057c, %si /* the saved int 0f vector */+ cld+ lodsl+ cmpl %ebx, %eax+ jnz failed_check_msdos7plus++ call restore_BDA_EBDA+ + cli+ xorw %ax, %ax+ movw %ax, %es+ movw %ax, %ds+ movw $0x0540, %si+ movw %ax, %di /* int 00 to 1f */+ movw $0x0040, %cx /* 64 words to move */+ cld+ repz movsw+ movw $0x0100, %di /* int 40 to 43 */+ movw $0x0008, %cx /* 8 words to move */+ repz movsw+ lodsl+ movw $0x0118, %di /* int 46 */+ stosl+ lodsl /* int 4b, maybe already in place */+#if 0+ movw $0x012c, %di /* int 4b, maybe changed by emm386 */+ stosl+#endif+ lodsl+ movw $0x013c, %di /* int 4f */+ stosl+#if 0+ /* the area 0x5dc-0x5ff seems to be an internal MSDOS stack, so may be corrupted */+ movw $0x01c0, %di /* int 70 to 77 */+ movw $0x0010, %cx /* 16 words to move */+ repz movsw+#else+ movw $0x05dc, %si /* check int70 */+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 2f+ movw $0x01c0, %si+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ ldsw -4(%si), %si /* DS get changed */+ subw $4, %si+ lodsl+ xorw %ax, %ax+ movw %ax, %ds /* let DS = 0 */+2:+ movw $0x01c0, %di+ stosl /* save new int70 */+1:+ movw $0x05e0, %si /* check int71 */+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jb 1f+ movw $0x01c4, %di+ stosl /* save new int71 */+1:+ movw $0x05e4, %si /* check int72 */+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 2f+ movw $0x01c8, %si+ cld+ lodsl+ cmpl $0xc0000000, %eax+ jnb 1f+ ldsw -4(%si), %si /* DS get changed */+ lodsw+ lodsl+ xorw %ax, %ax+ movw %ax, %ds /* let DS = 0 */+2:+ movw $0x01c8, %di+ stosl /* save new int72 */+1:+ movw $0x05e8, %si /* check int73 */+ cld
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -