grub-0.93-diff

来自「从linux移植到dos下的grub」· 93-DIFF 代码 · 共 1,926 行 · 第 1/4 页

93-DIFF
1,926
字号
+	movw	$0x0020, %si	/* DS:SI points to int 08 */+	lodsl+	movl	%eax, %ebx+	movl	%eax, %edx+	movw	$7, %cx+1:+	lodsl+	addw	$6, %bx+	jc	failed_check_freedos+	cmpl	%eax, %ebx+	jnz	failed_check_freedos+	loop	1b+	+	movw	$0x01c0, %si	/* DS:SI points to int 70 */+	movw	$8, %cx+1:+	lodsl+	addw	$6, %bx+	jc	failed_check_freedos+	cmpl	%eax, %ebx+	jnz	failed_check_freedos+	loop	1b+	+	movw	%dx, %si+	shrl	$16, %edx+	movw	%dx, %ds	/* DS:SI points to int 08 routine */++	movw	$16, %cx+	xorw	%bx, %bx+	xorw	%dx, %dx+1:+	lodsw+	cmpw	$0xbb53, %ax	/* 0x53="pushw %bx",0xbb="movw $????,%bx" */+	jnz	failed_check_freedos+	lodsw+	cmpw	%ax, %bx+	jnz	failed_check_freedos+	addw	$4, %bx+	cmpw	$1, %cx+	jz	2f+	lodsb+	cmpb	$0xeb, %al	/* 0xeb="jmp ????" */+	jnz	failed_check_freedos+	lodsb+	orw	%dx, %dx+	jnz	3f+	movw	%si, %dx+	xorb	%ah, %ah+	addw	%ax, %dx+	jc	failed_check_freedos+	jmp	2f+3:+	xorb	%ah, %ah+	addw	%si, %ax+	jc	failed_check_freedos+	cmpw	%ax, %dx+	jnz	failed_check_freedos+2:+	loop	1b++	addw	$0x0025, %si+	lodsb+	cmpb	$0x9c, %al	/* 0x9c="pushfw" */+	jnz	failed_check_freedos+	lodsw+	cmpw	$0x9fff, %ax	/* 0x9fff="call far [bx+????]" */+	jnz	failed_check_freedos+	lodsw+	/*xorl	%esi, %esi*/+	movw	%ax, %si	/* DS:SI begins old int 08-0f,70-77 vectors */+	movw	%ds, %ax+	orb	%ah, %ah+	jnz	failed_check_freedos+	shlw	$4, %ax+	addw	%ax, %si	/* 0000:SI begins the above int08-77vectors */+	jc	failed_check_freedos+	+	+	xorw	%ax, %ax+	movw	%ax, %ds+	/*movw	$0x08a4, %si*/	/* int 08-0f,70-77 begins here */+	movw	$0x0010, %cx /* 16 vectors to check */+	pushw	%si+	call	check_a_range_of_ROM_vectors+	popw	%si+	jc	failed_check_freedos++	pushw	%si+	call	restore_BDA_EBDA+	popw	%si+	cli+	xorw	%ax, %ax+	movw	%ax, %es+	movw	%ax, %ds+	/*movw	$0x08a4, %si*/+	movw	$0x0020, %di	/* int 08 to 0f */+	movw	$0x0010, %cx	/* 16 words to move */+	cld+	repz movsw+	movw	$0x01c0, %di	/* int 70 to 77 */+	movw	$0x0010, %cx	/* 16 words to move */+	cld+	repz movsw+	+	/*+	 * MS himem.sys takes over int 15, so try to restore it+	 */+	+	movw	$0x0054, %di+	movl	(%di), %eax		/* int 15 vector in table */+	cmpl	$0xc0000000, %eax	/* is it a valid BIOS vector? */+	jnb	1f			/* yes, do nothing */+	movw	$0x3086, %si		/* no, take one from himem */+	movl	(%si), %eax+	cmpl	$0xe0000000, %eax	/* is it a system BIOS vector? */+	jb	1f			/* no, do nothing */+	movl	%eax, (%di)		/* yes, write it to the table */+1:+	jmp	move_stage2_image++failed_check_freedos:+	movw	%cs, %ax+	movw	%ax, %ds+	movw	$ABS_START(dos_unsupport_string), %dx+	jmp	message_exit++restore_BDA_EBDA:+	cli+	cld+	xorw	%ax, %ax+	movw	%ax, %ds+	movw	$0x040e, %si	/* points to EBDA segment */+	lodsw+	orw	%ax, %ax	/* is EBDA segment? */+	jz	invalid_EBDA	/* no EBDA exists */+	movw	%ax, %cx+	movw	$0x0413, %si	/* points to conventional memory size in KB */+	lodsw+	cmpw	$0x0280, %ax	/* 0x280 == 640 */+	ja	invalid_EBDA	/* too much conventional memory */+	shlw	$0x06, %ax+	movw	%ax, %dx	/* conventional memory size in sections */+	movw	%cx, %ds	/* DOS currently used EBDA segment */+	xorw	%si, %si	/* the first byte of the EBDA ... */+	lodsb			/* 	...is the EBDA size in KB */+	cmpb	$0x08, %al	/* EBDA size greater than 8K ? */+	ja	invalid_EBDA	/* EBDA too large */+	orb	%al, %al	/* EBDA size is 0 ? */+	jz	invalid_EBDA	/* EBDA should not be 0 in length */+	movw	$0x0280, %bx+	subb	%al, %bl	/* BX is the calculated low mem in K */+	shlw	$0x06, %bx	/* BX is the calculated EBDA segment */+	cmpw	%bx, %cx	/* CX is currently used EBDA segment */+	jb	1f		/* jump if below the normal address */++	/* restore vectors in the range from DX:0 to BX:0, +	 * EBDA need not be restored+	 */+	movw	%cs, %ax+	movw	%ax, %es+	movw	$ABS_START(mapped_int13_vector_BIOS), %di+	movw	%dx, %ax+	stosw+	movw	%bx, %ax+	shrw	$6, %ax+	stosw+	movw	%di, %bp+	movw	%dx, %es+	xorw	%di, %di+	movw	$0x0400, %cx+	movb	$0x9a, %al	/* 0x9a == lcall */+3:+	repnz scasb+	jcxz	2f+	cmpl	$0x9a006e8b, %es:-4(%di) /* movw (%bp), %bp; lcall */+	jnz	3b+	movw	%di, %si+	movw	%bp, %di+	movw	%es, %ax+	movw	%ax, %ds+	movw	%cs, %ax+	movw	%ax, %es+	lodsl+	cmpl	$0xc0000000, %eax+	jb	2f+	stosl+	+2:+	ret+	+1:+	/* Restore vectors in the range from DX:0 to A000:0 +	 * No vectors need to be restored because DX seems always be 0xA000+	 */+	movw	%bx, %es	/* ES is the calculated EBDA segment */+	shlw	$9, %ax		/* AX *= 512 */+	movw	%ax, %cx	/* EBDA size in words */+	decw	%ax+	shlw	$1, %ax		/* points to the last word in EBDA */+	movw	%ax, %si	/* DS holds the currently used EBDA segment */+	movw	%ax, %di	/* ES holds the calculated EBDA segment */+	std			/* move higher word first */+	repz movsw		/* move to BIOS EBDA */+	cld+	xorw	%ax, %ax+	movw	%ax, %ds+	movw	%bx, %ax+	movw	$0x040e, %di+	stosw			/* restore the BDA pointer of EBDA segment */+	movw	$0x0413, %di+	shrw	$6, %ax+	stosw			/* restore the BDA field of low mem size */+	ret++invalid_EBDA:+	xorw	%ax, %ax	/* AX == 0 means invalid EBDA segment */+	movw	%ax, %es	/* DI string operations use ES == 0 */+	movw	$0x040e, %di	/* let EBDA segment be invalid */+	stosw			/* store 0 to 0000:040e */+	movw	$0x0413, %di	/* let lower memory size at 0x413 ... */+	movw	$0x0280, %ax	/* 	... be 640K (0x280 == 640) */+	stosw			/* store 640 to 0000:0413 */+	ret++move_stage2_image:++	movw	%cs, %ax+	movw	%ax, %ds+	+	/* restore mapped int13 */+	+	movw	$ABS_START(mapped_int13_vector_BIOS), %si+	+	xorw	%ax, %ax+	movw	%ax, %es+	lodsl+	movl	%eax, %ecx+	lodsl+	testl	%eax, %eax+	jz	1f+	movw	$0x004c, %di	/* int13 */+	movl	%es:(%di), %ebx+	testw	%bx, %bx+	jnz	1f+	shrl	$16, %ebx+	cmpw	%cx, %bx+	jnz	1f+	stosl+	shrl	$16, %ecx+	movw	$0x0413, %di+	movw	%cx, %ax+	stosw++1:+	/* movw	$ABS_START(stage2_64K_pages), %si */+	movw	(%si), %cx++	movw	%cs, %ax+	addw	$(ABS_START(end_dosstart-0x200)/0x10), %ax+	movw	%ax, %bx	/* save the final stage2 segment to %bx */+	cmpw	$0x0800, %ax+	ja	2f+1:+	xorw	%ax, %ax+	movb	%cl, %ah+	decb	%ah+	shlb	$0x04, %ah+	movw	%bx, %dx+	addw	%ax, %dx+	movw	%dx, %ds+	addb	$0x08, %ah	/* addw $0x0800, %ax */+	movw	%ax, %es+	movw	$0xfffe, %si+	movw	%si, %di+	movw	%cx, %dx	/* save %cx to %dx */+	movw	$0x8000, %cx	/* 0x8000 words == 64K bytes */+	cmpw	$0x0001, %dx	/* do not move the sector containing this+					code, to ensure no overlap */+	ja	3f+	decb	%ch		/* %cx == 0x7f00 */+3:+	cli+	std			/* move from higher end to lower end */+	repz movsw+	movw	%dx, %cx	/* restore %cx from %dx */+	loop	1b++	jmp	launch_stage2_code+	+2:+	xorw	%si, %si+	xorw	%di, %di+	movw	$0x07e0, %ax /* use 7e0 other than 800 to ensure no overlap */+	movw	%ax, %es+	movw	%bx, %ds+	movw	%cx, %dx	/* save %cx to %dx */+	movw	$0x0100, %cx	/* move the sector containing this code */+	cli+	xorw	%ax, %ax+	movw	%ax, %ss+	movw	$0x2000, %sp+	cld+	repz movsw+	movw	%dx, %cx	/* restore %cx from %dx */+	ljmp	$0x07e0, $ABS_FINAL(just_here)+	+	. = (DOSSTART_SIZE - 0x0100)++	/* room for stack, 0x80 bytes */++	. = (DOSSTART_SIZE - 0x0080)+just_here:	/* from here on, code must be in the FINAL sector */++	movw	$0x0800, %ax+	movw	%ax, %es+	movw	%bx, %ds+1:+	xorw	%si, %si+	xorw	%di, %di+	movw	%cx, %dx	/* save %cx to %dx */+	movw	$0x8000, %cx	/* 0x8000 words == 64K bytes */+	cld+	repz movsw+	movw	%dx, %cx	/* restore %cx from %dx */+	addw	$0x1000, %ax	/* move the next 64K-byte page */+	movw	%ax, %es+	addw	$0x1000, %bx+	movw	%bx, %ds+	loop	1b++launch_stage2_code:+	cli+	cld+	xorw	%ax, %ax+	movw	%ax, %ds+	movw	%ax, %es+	movw	%ax, %ss+	movw	$0x2000, %sp+	movw	%ax, %dx	/* %dl == 0 means floppy, thus save-default-+				config-file-entry-number will do nothing */+	xorl	%ebp, %ebp+	xorl	%esi, %esi+	sti		/* safe now, just before transferring control */+	ljmp	$0, $0x8200+	+	. = (DOSSTART_SIZE - 1)+	.ascii	"$" /* no use, just stops a possible endless DOS string */+end_dosstart:+diff -Naur grub-0.93/stage2/Makefile.in grub-0.93_dos/stage2/Makefile.in--- grub-0.93/stage2/Makefile.in	2002-11-29 20:28:45.000000000 +0000+++ grub-0.93_dos/stage2/Makefile.in	2003-09-23 14:50:13.000000000 +0000@@ -129,18 +129,18 @@ @DISKLESS_SUPPORT_FALSE@	jfs_stage1_5 minix_stage1_5 reiserfs_stage1_5 vstafs_stage1_5 \ @DISKLESS_SUPPORT_FALSE@	xfs_stage1_5 -@DISKLESS_SUPPORT_TRUE@noinst_DATA = pre_stage2 start nbloader pxeloader diskless-@DISKLESS_SUPPORT_FALSE@noinst_DATA = pre_stage2 start+@DISKLESS_SUPPORT_TRUE@noinst_DATA = pre_stage2 start nbloader pxeloader diskless dosstart grub.exe+@DISKLESS_SUPPORT_FALSE@noinst_DATA = pre_stage2 start dosstart grub.exe @DISKLESS_SUPPORT_TRUE@noinst_PROGRAMS = pre_stage2.exec start.exec e2fs_stage1_5.exec \ @DISKLESS_SUPPORT_TRUE@	fat_stage1_5.exec ffs_stage1_5.exec jfs_stage1_5.exec \ @DISKLESS_SUPPORT_TRUE@	minix_stage1_5.exec reiserfs_stage1_5.exec \ @DISKLESS_SUPPORT_TRUE@	vstafs_stage1_5.exec xfs_stage1_5.exec nbloader.exec \-@DISKLESS_SUPPORT_TRUE@	pxeloader.exec diskless.exec+@DISKLESS_SUPPORT_TRUE@	pxeloader.exec diskless.exec dosstart.exec  @DISKLESS_SUPPORT_FALSE@noinst_PROGRAMS = pre_stage2.exec start.exec e2fs_stage1_5.exec \ @DISKLESS_SUPPORT_FALSE@	fat_stage1_5.exec ffs_stage1_5.exec jfs_stage1_5.exec \ @DISKLESS_SUPPORT_FALSE@	minix_stage1_5.exec reiserfs_stage1_5.exec \-@DISKLESS_SUPPORT_FALSE@	vstafs_stage1_5.exec xfs_stage1_5.exec+@DISKLESS_SUPPORT_FALSE@	vstafs_stage1_5.exec xfs_stage1_5.exec dosstart.exec  MOSTLYCLEANFILES = $(noinst_PROGRAMS) @@ -187,6 +187,10 @@ start_exec_ASFLAGS = $(STAGE2_COMPILE) start_exec_LDFLAGS = $(START_LINK) +dosstart_exec_SOURCES = dosstart.S+dosstart_exec_ASFLAGS = $(STAGE2_COMPILE)+dosstart_exec_LDFLAGS = $(START_LINK)+ # For e2fs_stage1_5 target. e2fs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ 	stage1_5.c fsys_ext2fs.c bios.c@@ -337,7 +341,7 @@ @DISKLESS_SUPPORT_TRUE@	xfs_stage1_5.exec$(EXEEXT) \ @DISKLESS_SUPPORT_TRUE@	nbloader.exec$(EXEEXT) \ @DISKLESS_SUPPORT_TRUE@	pxeloader.exec$(EXEEXT) \-@DISKLESS_SUPPORT_TRUE@	diskless.exec$(EXEEXT)+@DISKLESS_SUPPORT_TRUE@	diskless.exec$(EXEEXT) dosstart.exec$(EXEEXT) @DISKLESS_SUPPORT_FALSE@noinst_PROGRAMS = pre_stage2.exec$(EXEEXT) \ @DISKLESS_SUPPORT_FALSE@	start.exec$(EXEEXT) \ @DISKLESS_SUPPORT_FALSE@	e2fs_stage1_5.exec$(EXEEXT) \@@ -347,7 +351,7 @@ @DISKLESS_SUPPORT_FALSE@	minix_stage1_5.exec$(EXEEXT) \ @DISKLESS_SUPPORT_FALSE@	reiserfs_stage1_5.exec$(EXEEXT) \ @DISKLESS_SUPPORT_FALSE@	vstafs_stage1_5.exec$(EXEEXT) \-@DISKLESS_SUPPORT_FALSE@	xfs_stage1_5.exec$(EXEEXT)+@DISKLESS_SUPPORT_FALSE@	xfs_stage1_5.exec$(EXEEXT) dosstart.exec$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS)  am_diskless_exec_OBJECTS = diskless_exec-asm.$(OBJEXT) \@@ -476,6 +480,10 @@ start_exec_OBJECTS = $(am_start_exec_OBJECTS) start_exec_LDADD = $(LDADD) start_exec_DEPENDENCIES =+am_dosstart_exec_OBJECTS = dosstart_exec-dosstart.$(OBJEXT)+dosstart_exec_OBJECTS = $(am_dosstart_exec_OBJECTS)+dosstart_exec_LDADD = $(LDADD)+dosstart_exec_DEPENDENCIES = am_vstafs_stage1_5_exec_OBJECTS = vstafs_stage1_5_exec-start.$(OBJEXT) \ 	vstafs_stage1_5_exec-asm.$(OBJEXT) \ 	vstafs_stage1_5_exec-common.$(OBJEXT) \@@ -635,13 +643,13 @@ 	$(minix_stage1_5_exec_SOURCES) $(nbloader_exec_SOURCES) \ 	$(pre_stage2_exec_SOURCES) $(pxeloader_exec_SOURCES) \ 	$(reiserfs_stage1_5_exec_SOURCES) $(start_exec_SOURCES) \-	$(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES)+	$(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES) $(dosstart_exec_SOURCES) DATA = $(noinst_DATA) $(pkgdata_DATA)  HEADERS = $(noinst_HEADERS)  DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in-SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) $(jfs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) $(nbloader_exec_SOURCES) $(pre_stage2_exec_SOURCES) $(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) $(start_exec_SOURCES) $(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES)+SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) $(jfs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) $(nbloader_exec_SOURCES) $(pre_stage2_exec_SOURCES) $(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) $(start_exec_SOURCES) $(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES) $(dosstart_exec_SOURCES)  all: $(BUILT_SOURCES) 	$(MAKE) $(AM_MAKEFLAGS) all-am@@ -821,6 +829,10 @@ start.exec$(EXEEXT): $(start_exec_OBJECTS) $(start_exec_DEPENDENCIES)  	@rm -f start.exec$(EXEEXT) 	$(LINK) $(start_exec_LDFLAGS) $(start_exec_OBJECTS) $(start_exec_LDADD) $(LIBS)+dosstart_exec-dosstart.$(OBJEXT): dosstart.S+dosstart.exec$(EXEEXT): $(dosstart_exec_OBJECTS) $(dosstart_exec_DEPENDENCIES) +	@rm -f dosstart.exec$(EXEEXT)+	$(LINK) $(dosstart_exec_LDFLAGS) $(dosstart_exec_OBJECTS) $(dosstart_exec_LDADD) $(LIBS) vstafs_stage1_5_exec-start.$(OBJEXT): start.S vstafs_stage1_5_exec-asm.$(OBJEXT): asm.S vstafs_stage1_5_exec-common.$(OBJEXT): common.c@@ -1078,6 +1090,12 @@ start_exec-start.obj: start.S 	$(AS) $(start_exec_ASFLAGS) $(ASFLAGS) -c -o start_exec-start.obj `cygpath -w start.S` +dosstart_exec-dosstart.o: dosstart.S+	$(AS) $(dosstart_exec_ASFLAGS) $(ASFLAGS) -c -o dosstart_exec-dosstart.o `test -f dosstart.S || echo '$(srcdir)/'`dosstart.S++dosstart_exec-dosstart.obj: dosstart.S+	$(AS) $(dosstart_exec_ASFLAGS) $(ASFLAGS) -c -o dosstart_exec-dosstart.obj `cygpath -w dosstart.S`+ vstafs_stage1_5_exec-start.o: start.S 	$(AS) $(vstafs_stage1_5_exec_ASFLAGS) $(ASFLAGS) -c -o vstafs_stage1_5_exec-start.o `test -f start.S || echo '$(srcdir)/'`start.S @@ -2732,6 +2750,12 @@ 	-rm -f stage2 	cat start pre_stage2 > stage2 +dosstart_exec-dosstart.$(OBJEXT): stage2_size.h++grub.exe: pre_stage2 dosstart+	-rm -f grub.exe+	cat dosstart pre_stage2 > grub.exe+ diskless_size.h: diskless 	-rm -f $@ 	set dummy `ls -l $^`; \diff -Naur grub-0.93/stage2/shared.h grub-0.93_dos/stage2/shared.h--- grub-0.93/stage2/shared.h	2002-12-02 23:15:12.000000000 +0000+++ grub-0.93_dos/stage2/shared.h	2003-09-23 14:50:13.000000000 +0000@@ -533,6 +533,7 @@   ERR_DEV_NEED_INIT,   ERR_NO_DISK_SPACE,   ERR_NUMBER_OVERFLOW,+  ERR_NON_CONTIGUOUS,    MAX_ERR_NUM } grub_error_t;

⌨️ 快捷键说明

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