⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bootlace.inc

📁 grub4dos-0.4.4-2008- 08-src.zip
💻 INC
📖 第 1 页 / 共 5 页
字号:
	jnz	3f	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$0, ABS(total_sectors)	movl	$ABS(msg_option_total_sectors), %ecx	jnz	4f	/* error */	movl	$0xffffffff, %ebx	call	7f	/* parse_number */	movl	%ebx, %edi	# save EBX to EDI	movl	$0, %ebx	# invalid file descriptor for CLOSE below	movl	$ABS(msg_invalid_number), %ecx	jc	4f	/* error */	cmpl	$0, %edi	je	4f	/* error */	movl	%edi, ABS(total_sectors)	jmp	1b3:	/* check --floppy= */	movl	$9, %ecx	movl	$ABS(option_floppy_partition), %esi	movl	%ebx, %edi	cld	repz cmpsb	jnz	3f	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$0xffffffff, ABS(floppy)	movl	$ABS(msg_option_floppy), %ecx	jnz	4f	/* error */	movl	$0xfe, %ebx	call	7f	/* parse_number */	movl	%ebx, %edi	# save EBX to EDI	movl	$0, %ebx	# invalid file descriptor for CLOSE below	movl	$ABS(msg_invalid_number), %ecx	jc	4f	/* error */	movl	%edi, ABS(floppy)	jmp	1b3:	/* check --read-only */	movl	$12, %ecx	movl	$ABS(option_read_only), %esi	movl	%ebx, %edi	cld	repz cmpsb	jnz	3f	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$2, ABS(read_only)	movl	$ABS(msg_option_read_only), %ecx	jnz	4f	/* error */	movl	$0, ABS(read_only)	jmp	1b3:	/* check --floppy */	movl	$9, %ecx	movl	$ABS(option_floppy), %esi	movl	%ebx, %edi	cld	repz cmpsb	jnz	3f	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$0xffffffff, ABS(floppy)	movl	$ABS(msg_option_floppy), %ecx	jnz	4f	/* error */	movl	$0xff, ABS(floppy)	jmp	1b3:	/* check --lba */	movl	$6, %ecx	movl	$ABS(option_lba), %esi	movl	%ebx, %edi	cld	repz cmpsb	jnz	3f	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$0xffffffff, ABS(lba)	movl	$ABS(msg_option_lba), %ecx	jnz	4f	/* error */	movl	$1, ABS(lba)	jmp	1b3:	/* check --chs */	movl	$6, %ecx	movl	$ABS(option_chs), %esi	movl	%ebx, %edi	cld	repz cmpsb	jnz	3f	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$0xffffffff, ABS(lba)	movl	$ABS(msg_option_lba), %ecx	jnz	4f	/* error */	movl	$0, ABS(lba)	jmp	1b3:	/* check --fat12 */	movl	$8, %ecx	movl	$ABS(option_fat12), %esi	movl	%ebx, %edi	cld	repz cmpsb	jnz	3f	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$0xfffffff7, ABS(fstypes)	jnz	2f	movl	$0, ABS(fstypes)2:	orb	$1, ABS(fstypes)	jmp	1b3:	/* check --fat16 */	movl	$8, %ecx	movl	$ABS(option_fat16), %esi	movl	%ebx, %edi	cld	repz cmpsb	jnz	3f	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$0xfffffff7, ABS(fstypes)	jnz	2f	movl	$0, ABS(fstypes)2:	orb	$2, ABS(fstypes)	jmp	1b3:	/* check --fat32 */	movl	$8, %ecx	movl	$ABS(option_fat32), %esi	movl	%ebx, %edi	cld	repz cmpsb	jnz	3f	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$0xfffffff7, ABS(fstypes)	jnz	2f	movl	$0, ABS(fstypes)2:	orb	$4, ABS(fstypes)	jmp	1b3:	/* check --ntfs */	movl	$7, %ecx	movl	$ABS(option_ntfs), %esi	movl	%ebx, %edi	cld	repz cmpsb	jnz	3f	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$0xfffffff7, ABS(fstypes)	jnz	2f	movl	$0, ABS(fstypes)2:	orb	$8, ABS(fstypes)	jmp	1b3:	/* check --ext2 */	movl	$7, %ecx	movl	$ABS(option_ext2), %esi	movl	%ebx, %edi	cld	repz cmpsb	jnz	3f	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$0xfffffff7, ABS(fstypes)	jnz	2f	movl	$0, ABS(fstypes)2:	orb	$0x10, ABS(fstypes)	jmp	1b3:	/* check --vfat */	movl	$7, %ecx	movl	$ABS(option_vfat), %esi	movl	%ebx, %edi	cld	repz cmpsb	jnz	3f	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$0xfffffff7, ABS(fstypes)	jnz	2f	movl	$0, ABS(fstypes)2:	orb	$7, ABS(fstypes)	jmp	1b3:	movl	$ABS(msg_invalid_option), %ecx	jmp	4f	/* error */1://----------------------------------------------------------------------------	/* end of arguments */	/* ECX=EBX=0 */	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		testl	%eax, %eax		# filename already specified?	//cmpl	$0, ABS(filename)	# filename already specified?	movl	$ABS(msg_no_file), %ecx	jz	4f	/* error */	xchgl	%eax, %ebx		# move EAX to EBX	//movl	ABS(filename), %ebx	# move filename to EBX	/* EBX points to the pathname of the file. */	/* check if preferred_partition matches preferred_drive */	movb	ABS(preferred_drive), %al	movb	ABS(preferred_partition), %ah	cmpb	$0xff, %al	jne	1f	movl	%ebx, %edi	# save EBX to EDI	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below	cmpb	$0xff, %ah	movl	$ABS(msg_partition_without_drive), %ecx	jne	4f	/* error */	movl	%edi, %ebx	# restore EBX from EDI1:	/* EBX points to the pathname of the file. */	movl	%ebx, %edi	# save EBX to EDI	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below		cmpl	$0xffffffff, ABS(floppy)	je	1f		# --floppy is not specified	/* if --floppy is specified, should not specify the options for MBR. */	cmpl	$1, ABS(backup_mbr)	movl	$ABS(msg_option_backup_mbr_with_floppy), %ecx	jnz	4f	/* error */	cmpl	$0, ABS(mbr_floppy)	movl	$ABS(msg_option_mbr_floppy_with_floppy), %ecx	jnz	4f	/* error */		cmpl	$0, ABS(mbr_osbr)	movl	$ABS(msg_option_mbr_osbr_with_floppy), %ecx	jnz	4f	/* error */		cmpl	$0, ABS(duce)	movl	$ABS(msg_option_duce_with_floppy), %ecx	jnz	4f	/* error */		cmpl	$0, ABS(boot_prevmbr)	movl	$ABS(msg_option_boot_prevmbr_with_floppy), %ecx	jnz	4f	/* error */		cmpl	$0xff, ABS(preferred_drive)	movl	$ABS(msg_option_preferred_drive_with_floppy), %ecx	jnz	4f	/* error */	cmpl	$0xff, ABS(preferred_partition)	movl	$ABS(msg_option_preferred_partition_with_floppy), %ecx	jnz	4f	/* error */	cmpl	$0xffffffff, ABS(install_partition)	movl	$ABS(msg_option_install_partition_with_floppy), %ecx	jnz	4f	/* error */	cmpl	$0xffffff05, ABS(time_out)	movl	$ABS(msg_option_time_out_with_floppy), %ecx	jnz	4f	/* error */	cmpl	$0xffff3920, ABS(hot_key)	movl	$ABS(msg_option_hot_key_with_floppy), %ecx	jnz	4f	/* error */		/* for a floppy, start_sector should be 0, and	 * for a partition, start_sector should be non-zero	 */	cmpl	$0xff, ABS(floppy)	je	2f		# a real floppy	/* a single partition */	cmpl	$0, ABS(start_sector)	movl	$ABS(msg_partition_start), %ecx	jz	4f	/* error */	jmp	3f	2:	/* a real floppy */	/* */	cmpl	$0xffffffff, ABS(start_sector)	je	3f	cmpl	$0, ABS(start_sector)	movl	$ABS(msg_floppy_start), %ecx	jnz	4f	/* error */3:	jmp	2f1:	/* EBX=0 */	cmpl	$0xffffffff, ABS(install_partition)	je	1f		# --install-partition is not specified	/* should not specify --install-partition with options for MBR. */	cmpl	$1, ABS(backup_mbr)	movl	$ABS(msg_option_backup_mbr_with_partition), %ecx	jnz	4f	/* error */	cmpl	$0, ABS(mbr_floppy)	movl	$ABS(msg_option_mbr_floppy_with_partition), %ecx	jnz	4f	/* error */		cmpl	$0, ABS(mbr_osbr)	movl	$ABS(msg_option_mbr_osbr_with_partition), %ecx	jnz	4f	/* error */		cmpl	$0, ABS(duce)	movl	$ABS(msg_option_duce_with_partition), %ecx	jnz	4f	/* error */		cmpl	$0, ABS(boot_prevmbr)	movl	$ABS(msg_option_boot_prevmbr_with_partition), %ecx	jnz	4f	/* error */		cmpl	$0xff, ABS(preferred_drive)	movl	$ABS(msg_option_preferred_drive_with_partition), %ecx	jnz	4f	/* error */	cmpl	$0xff, ABS(preferred_partition)	movl	$ABS(msg_option_preferred_partition_with_partition), %ecx	jnz	4f	/* error */	cmpl	$0xffffff05, ABS(time_out)	movl	$ABS(msg_option_time_out_with_partition), %ecx	jnz	4f	/* error */	cmpl	$0xffff3920, ABS(hot_key)	movl	$ABS(msg_option_hot_key_with_partition), %ecx	jnz	4f	/* error */	cmpl	$0xffffff3f, ABS(sectors_per_track)	movl	$ABS(msg_option_sectors_per_track_with_partition), %ecx	jnz	4f	/* error */	cmpl	$0xffff00ff, ABS(heads)	movl	$ABS(msg_option_heads_with_partition), %ecx	jnz	4f	/* error */	cmpl	$0xffffffff, ABS(start_sector)	movl	$ABS(msg_option_start_sector_with_partition), %ecx	jnz	4f	/* error */	cmpl	$0, ABS(total_sectors)	movl	$ABS(msg_option_total_sectors_with_partition), %ecx	jnz	4f	/* error */	jmp	2f1:	/* EBX=0 */	/* this is an MBR device. Should not specify floppy-specific options. */	testl	$1, ABS(boot_prevmbr)	/* --boot-prevmbr-first specified? */	jnz	2f			/* Yes, specified. Continue */	/* No, not specified. */	/* Should not specify --time-out without --boot-prevmbr-first. */	cmpl	$0xffffff05, ABS(time_out)	movl	$ABS(msg_option_time_out_without_prevmbr), %ecx	jne	4f	/* error */	/* Should not specify --hot-key without --boot-prevmbr-first. */	cmpl	$0xffff3920, ABS(hot_key)	movl	$ABS(msg_option_hot_key_without_prevmbr), %ecx	jne	4f	/* error */2:	/* EBX=0, EDI points to the pathname of the file. *///----------------------------------------------------------------------------	movl	%edi, %ebx	# restore EBX from EDI		/* EBX=EDI points to the pathname of the file. */#ifdef __DOS_16	xorl	%eax, %eax	//movl	%ebx, %edi	/* EBX points to the pathname of the file. */	movl	$0xfe, %ebx	call	7f	/* parse_number */	jc	2f	/* invalid number */	/* EBX holds the bios drive number */	movl	%ebx, ABS(bios_drive_number)	jmp	1f2:	//AH = 3Dh	//OPEN EXISTING FILE	//AL = access and sharing modes (see #01402)	//DS:DX -> ASCIZ filename	//CL = attribute mask of files to look for (server call only)	//Return:	//CF clear if successful AX = file handle	//CF set on error AX = error code (01h,02h,03h,04h,05h,0Ch,56h)	movzbl	ABS(read_only), %eax	movb	$0x3d, %ah	// open file for read/write	movl	%edi, %edx	// DS:DX points to ASCIZ filename	int	$0x21	jnc	1f	negl	%eax		/* EAX < 0 */1:#else	/* int open(const char *pathname, int flags, mode_t mode) */	movl	$5, %eax	# sys_open	movzbl	ABS(read_only), %ecx	# O_RDWR = 02	int	$0x80#endif	xorl	%ebx, %ebx	# invalid file descriptor for CLOSE below	movl	$ABS(msg_open_file_rw), %ecx	cmpw	$2, ABS(read_only)	je	1f	movl	$ABS(msg_open_file_ro), %ecx1:	testl	%eax, %eax	js	4f	/* error *///----------------------------------------------------------------------------	/* open file succeeded */	pushl	%eax		# file descriptor, or 0 if specified BIOS drive	movl	%eax, %ebx	/* EBX and the stack holds the file descriptor number or 0 */	#ifdef __DOS_16	xorl	%eax, %eax	cmpl	$0xff, ABS(bios_drive_number)	je	1f	movw	$0x204, %ax	# read 4 sectors of the MBR	movw	$ABS(mbr_63_sectors), %bx	movw	$1, %cx	movb	ABS(bios_drive_number), %dl	movb	$0, %dh	int	$0x13	jc	2f		# stop on error	movw	$0x201, %ax	# read 1 sector of track 1(the 2nd track)	movw	$ABS(mbr_63_sectors + 0x7E00), %bx	movw	$1, %cx	movb	ABS(bios_drive_number), %dl	movb	$1, %dh	int	$0x13	clc			# ignore error	jmp	2f1:	//READ FROM FILE OR DEVICE	//AH = 3Fh	//BX = file handle	//CX = number of bytes to read	//DS:DX -> buffer for data	//Return:	//CF clear if successful AX = number of bytes actually read (0 if at EOF before call)       	//CF set on error AX = error code (05h,06h) 	movl	$0x3f00, %eax	movl	$((63+1)*512), %ecx	movl	$ABS(mbr_63_sectors), %edx	int	$0x212:	jnc	1f	negl	%eax1:#else	/* ssize_t read(int fd, void *buf, size_t count) */	movl	$3, %eax	# sys_read	movl	$ABS(mbr_63_sectors), %ecx	movl	$((63+1)*512), %edx	# read 63+1 sectors	int	$0x80#endif	popl	%ebx		# file descriptor, or 0 if specified BIOS drive	testl	%eax, %eax	movl	$ABS(msg_read_file), %ecx	js	4f	/* error *///----------------------------------------------------------------------------	/* rewind the file for write! important! */	pushl	%ebx		# file descriptor, or 0 if specified BIOS drive#ifdef __DOS_16	xorl	%eax, %eax	cmpl	$0xff, ABS(bios_drive_number)	jne	1f	//LSEEK - SET CURRENT FILE POSITION	//AH = 42h	//AL = origin of move	//	00h start of file	//	01h current file position	//	02h end of file	//BX = file handle	//CX:DX = (signed) offset from origin of new file position	//Return:	//CF clear if successful DX:AX = new file position in bytes from start of file	//CF set on error AX = error code (01h,06h) 	movl	$0x4200, %eax	movl	$0, %ecx	movl	$0, %edx	int	$0x21	jnc	1f	negl	%eax1:#else	/* off_t lseek(int fildes, off_t offset, int whence) */	movl	$19, %eax	# sys_lseek	movl	$0, %ecx	movl	$0, %edx	# SEEK_SET = 0	int	$0x80#endif	popl	%ebx		# file descriptor, or 0 if specified BIOS drive	testl	%eax, %eax	movl	$ABS(msg_lseek_file), %ecx	js	4f	/* error *///----------------------------------------------------------------------------	/* remember EBX holds file descriptor number, and don't touch it */	/* check if the partition table is valid. */	movl	$ABS(mbr_63_sectors), %esi	cmpw	$0xAA55, 0x1fe(iSI)	movl	$ABS(msg_boot_signature_mbr), %ecx	//jne	4f	/* error */	clc	jne	2f	call	9f	/* probe_geometry */	jnc	1f2:	/* should be floppy since no partition table or no boot signature. */	/* CF=0 means no boot signature, CF=1 means no partition table. */	jnc	2f	movl	$ABS(msg_invalid_partition_table), %ecx2:	cmpl	$0xffffffff, ABS(floppy)	/* Is --floppy specified? */	je	4f	/* error */		/* Yes, --floppy is specified */	/* ESI points to ABS(mbr_63_sectors) */	call	5f	/* floppy routine */	movl	$0, %ecx	jc	4f	/* error */		jmp	2f	/* write file */1://----------------------------------------------------------------------------	/* the image type is MBR. So, should not specify --floppy */	cmpl	$0xffffffff, ABS(floppy)	movl	$ABS(msg_floppy_partition_table), %ecx	jne	4f	/* error */		cmpl	$0xffffff3f, ABS(sectors_per_track)	movl	$ABS(msg_option_sectors_per_track_for_mbr), %ecx	jnz	4f	/* error */	cmpl	$0xffff00ff, ABS(heads)	movl	$ABS(msg_option_heads_for_mbr), %ecx	jnz	4f	/* error */	cmpl	$0xffffffff, ABS(start_sector)	movl	$ABS(msg_option_start_sector_for_mbr), %ecx	jnz	4f	/* error */	cmpl	$0, ABS(total_sectors)	movl	$ABS(msg_option_total_sectors_for_mbr), %ecx	jnz	4f	/* error */	cmpl	$0xffffffff, ABS(lba)	movl	$ABS(msg_option_lba_for_mbr), %ecx	jnz	4f	/* error */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -