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

📄 grub-0.97-patch4-emulation

📁 grub for dos ,people can use it in dos for calling linux
💻 97-PATCH4-EMULATION
📖 第 1 页 / 共 5 页
字号:
diff -Naur grub-0.97_ntfs/ChangeLog grub-0.97_emulation/ChangeLog--- grub-0.97_ntfs/ChangeLog	2006-10-24 12:28:51.000000000 +0800+++ grub-0.97_emulation/ChangeLog	2006-10-24 12:28:51.000000000 +0800@@ -1,5 +1,19 @@ 2005-05-11 +	From Tinybit  <tinybit@163.net>:+	For disk drive emulation:+	* stage2/asm.S (int13_handler, etc): floppy and harddisk emulation++	* grub/asmstub.c: floppy and harddisk emulation++	* stage2/builtins.c: floppy and harddisk emulation++	* stage2/common.c: floppy and harddisk emulation++	* stage2/disk_io.c: floppy and harddisk emulation++	* stage2/shared.h: floppy and harddisk emulation+ 	From Gandalf  <f22_storm@163.com>: 	NTFS support diff -Naur grub-0.97_ntfs/grub/asmstub.c grub-0.97_emulation/grub/asmstub.c--- grub-0.97_ntfs/grub/asmstub.c	2005-02-17 04:45:14.000000000 +0800+++ grub-0.97_emulation/grub/asmstub.c	2006-10-24 12:28:51.000000000 +0800@@ -313,6 +313,7 @@   stop (); } +#if 0 /* sets it to linear or wired A20 operation */ void gateA20 (int linear)@@ -333,18 +334,12 @@ {   /* Nothing to do in the simulator.  */ }+#endif  /* The key map.  */ unsigned short bios_key_map[KEY_MAP_SIZE + 1]; unsigned short ascii_key_map[KEY_MAP_SIZE + 1]; -/* Copy MAP to the drive map and set up the int13 handler.  */-void-set_int13_handler (unsigned short *map)-{-  /* Nothing to do in the simulator.  */-}- int get_code_end (void) {@@ -605,7 +600,7 @@    ncurses-1.9.9g is still used in the world and its ungetch is    completely broken.  */ #ifdef HAVE_LIBCURSES-static int save_char = ERR;+//static int save_char = ERR; #endif  static int@@ -649,15 +644,20 @@     {       int c; -      /* Check for SAVE_CHAR. This should not be true, because this-	 means checkkey is called twice continuously.  */-      if (save_char != ERR)-	return save_char;+//      /* Check for SAVE_CHAR. This should not be true, because this+//	 means checkkey is called twice continuously.  */+//      if (save_char != ERR)+//	return save_char; +      wtimeout (stdscr, 0);	/* returns ERR if no input is waiting */       c = getch ();-      /* If C is not ERR, then put it back in the input queue.  */+      wtimeout (stdscr, 100);+//      /* If C is not ERR, then put it back in the input queue.  */+//      if (c != ERR)+//	save_char = c;       if (c != ERR)-	save_char = c;+        ungetch(c);+       return console_translate_key (c);     } #endif@@ -676,15 +676,15 @@ #ifdef HAVE_LIBCURSES   if (use_curses)     {-      /* If checkkey has already got a character, then return it.  */-      if (save_char != ERR)-	{-	  c = save_char;-	  save_char = ERR;-	  return console_translate_key (c);-	}+//      /* If checkkey has already got a character, then return it.  */+//      if (save_char != ERR)+//	{+//	  c = save_char;+//	  save_char = ERR;+//	  return console_translate_key (c);+//	} -      wtimeout (stdscr, -1);+      wtimeout (stdscr, -1);	/* waits indefinitely for input */       c = getch ();       wtimeout (stdscr, 100);     }diff -Naur grub-0.97_ntfs/stage2/asm.S grub-0.97_emulation/stage2/asm.S--- grub-0.97_ntfs/stage2/asm.S	2004-06-20 00:55:22.000000000 +0800+++ grub-0.97_emulation/stage2/asm.S	2006-10-24 12:28:51.000000000 +0800@@ -89,7 +89,23 @@ 	.long	0xFFFFFF /* This variable is here only because of a historical reason.  */ VARIABLE(saved_entryno)+#if defined(STAGE1_5) /* || ! defined(PRESET_MENU_STRING) */ 	.long	0+#else++/* Note: GRUB for DOS uses this for the commandline preset_menu.+ * A preset_menu can be embedded in the commandline of GRUB.EXE.+ * This new preset_menu overrides the built-in preset_menu.+ * If the variable is not touched, and the first byte at config_file is 0,+ * then the new menu at 0x0800 will work.+ * If the variable here is cleared to 0, or the first byte at config_file is+ * not 0, then the built-in preset_menu will work.+ *+ * Do NOT change this variable to other value than 0.+ */+ +	.long	preset_menu+#endif VARIABLE(stage2_id) 	.byte	STAGE2_ID VARIABLE(force_lba)@@ -117,9 +133,69 @@ 	/* set up %ds, %ss, and %es */ 	xorw	%ax, %ax 	movw	%ax, %ds-	movw	%ax, %ss 	movw	%ax, %es+	movw	%ax, %ss+	movl	$STACKOFF, %esp++#ifndef STAGE1_5+	movb	0x0410, %al+	movb	%al, ABS(floppies_orig)+	movb	0x0475, %al+	movb	%al, ABS(harddrives_orig)++	//movb	$((int13_handler_end - int13_handler + 0x3ff) / 0x400), ABS(int13_handler)++	movl	0x4C, %eax+	movl	%eax, ABS(int13_offset)+	cmpl	$0xC0000000, %eax+	jnb	1f+	cmpl	$0x9A000000, %eax+	jb	1f+	andl	$0x3FFFFF, %eax+	cmpl	$0x100, %eax+	jnz	1f+	movw	0x413, %ax+	shlw	$6, %ax+	cmpw	0x4E, %ax+	jne	1f++	movw	%ax, %ds			/* DS=old int13 code segment */+	movl	0x1C, %eax			/* ROM int 13 vector */+	cmpl	$0x9A000000, %eax+	jb	2f++	movl	0x0C, %eax			/* ROM int 15 vector */+	cmpl	$0x9A000000, %eax+	jb	2f++	/* restore old emu data, except the first byte of handler size. */+	movw	$0xFF, %cx+	movw	$1, %si+	movw	$ABS(int13_handler + 1), %di+	cld+	repz movsb+2:+	xorw	%ax, %ax+	movw	%ax, %ds			/* DS=0 */+1:+	movl	ABS(ROM_int15), %eax+	cmpl	$0x9A000000, %eax+	jnb	1f+	movl	0x0054, %eax+	movl	%eax, ABS(ROM_int15)+1:+	/* check the BIOS type (currently only for Bochs) */+	movw	$0xF000, %ax+	movw	%ax, %es			/* ES=0xF000 */+	movw	$0xFF00, %di+	movw	$ABS(bochs_copygrght_string), %si+	movw	$0x22, %cx+	repz cmpsw+	setz	ABS(bios_id)	/* 1 for bochs, 0 for unknown. */+	xorw	%ax, %ax+	movw	%ax, %es			/* ES=0 */ +#endif  /* STAGE1_5 */ #ifndef SUPPORT_DISKLESS 	/* 	 * Save the sector number of the second sector (i.e. this sector)@@ -128,18 +204,143 @@ 	ADDR32	movl	%ebp, EXT_C(install_second_sector) #endif 	-	/* set up the real mode/BIOS stack */-	movl	$STACKOFF, %ebp-	movl	%ebp, %esp+	///* set up the real mode/BIOS stack */+	//movl	$STACKOFF, %ebp+	//movl	%ebp, %esp++	/* for usb keyboard hack here, disable interrupt */+	//sti		/* we're safe again */++	/* the active mouse will hang the machine */++#if 0+	cli+	pushal+	pushw	%ds+	pushw	%es+	pushw	%cs+	call	1f+	popw	%es+	popw	%ds+	popal+	jmp	2f+1:+	pushw	$0xADDA+	//ljmp	$0xF000, $0x98E1+	ljmp	$0xF000, $0xA5F2++2:+	ljmp	$0xF000, $0xFFF0+#endif++	pushw	%dx++	/* qemu-0.8.0 could hang on mouse init here. */++#if 0+	/* reset mouse */+	movw	$0xC201, %ax+	int	$0x15+#endif++#if 0+	/* disable mouse */+	movw	$0xC200, %ax+	xorw	%bx, %bx	/* BH=0 means disable */+	int	$0x15+#endif++#if 0+	/* set mouse handler address */+	movw	$0xC207, %ax+	xorw	%bx, %bx	/* ES:BX=0000:0000 to cancel the handler */+	int	$0x15+#endif++#if 1+	/* disable monitor clock (Watch-Dog) */+	movw	$0xC300, %ax+	int	$0x15+#endif++#if 0+	/* restart all adaptors */+	movb	$0xFF, %al+	outb	%al, $0x96+	xorw	%cx, %cx+1:	loop	1b+	movb	$0xF0, %al+	outb	%al, $0x96+	xorw	%cx, %cx+1:	loop	1b+	movb	$0x00, %al+	outb	%al, $0x96+	xorw	%cx, %cx+1:	loop	1b++	/* initialize all adaptors */+	movw	$0xC000, %bx+2:+	movw	%bx, %ds+	xorw	%si, %si+	lodsw+	cmpw	$0xAA55, %ax+	jne	1f+	xorw	%ax, %ax+	lodsb			#; ROM size in sectors+	addw	$3, %ax+	andw	$0xFFFC, %ax+	subw	$4, %ax+	shlw	$5, %ax+	pushaw+	pushw	%bx+	pushw	$3+	movw	%sp, %bp+	lcall	*(%bp)+	popw	%bx+	popw	%bx+	popaw+1:+	addw	$0x80, %ax+	addw	%ax, %bx+	cmpw	$0xF000, %bx+	jb	2b+	+#endif++	xorw	%ax, %ax+	movw	%ax, %ds+	movw	%ax, %es+	popw	%dx++#if 1+	/* cancel alarm clock */+	movb	$0x07, %ah+	int	$0x1A+#endif++	/* clear VDS */+	andb	$0xD7, 0x47B -	sti		/* we're safe again */+	cli  #ifndef SUPPORT_DISKLESS 	/* save boot drive reference */ 	ADDR32	movb	%dl, EXT_C(boot_drive) +	movw	$ABS(reset_disk_string),%si+	call	print_message	/* will not change DX */++	xorw	%ax, %ax 	/* reset disk system (%ah = 0) */+#if 1 	int	$0x13+#else+	movl	$0x04000000, %ecx+1:	addr32 loop	1b+#endif+	movw	$ABS(reset_disk_ok_string),%si+	call	print_message	/* will not change DX */ #endif  	/* transition to protected mode */@@ -157,6 +358,8 @@ 	movl	$_edata, %edi #elif defined(HAVE_EDATA_SYMBOL) 	movl	$edata, %edi+#else+#error no bss starting address #endif  	/* set %ecx to the bss end */	@@ -164,6 +367,8 @@ 	movl	$end, %ecx #elif defined(HAVE_USCORE_END_SYMBOL) 	movl	$_end, %ecx+#else+#error no bss ending address #endif  	/* compute the bss length */@@ -179,6 +384,17 @@ 	rep 	stosb 	+	/* setup the new preset_menu */+	//movb	config_file, %al+	//testb	%al, %al+	cmpb	%al, config_file	/* AL == 0 */+	jnz	1f+	movl	saved_entryno, %ebx+	testl	%ebx, %ebx+	jz	1f+	movl	$0x0800, (%ebx)+1:+	 	/* 	 *  Call the start of main body of C code, which does some 	 *  of it's own initialization before transferring to "cmain".@@ -200,9 +416,47 @@ 	 * mode, so think about it before changing it. 	 */ -ENTRY(hard_stop)+	/* No external program ever calls HARD_STOP. HARD_STOP is only called+	 * by the asm.S itself, and all calls are from real mode. So we+	 * could(and should) use .code16 here clearly.+	 */++	.code16++//ENTRY(hard_stop)+hard_stop:+	sti 	hlt-	jmp EXT_C(hard_stop)+	//jmp EXT_C(hard_stop)+	jmp hard_stop++	.code16++	/* real mode print string */++/* prints string DS:SI (modifies AX BX SI) */++print_message:+1:+	cld+	lodsb	(%si), %al	/* get token */+	xorw	%bx, %bx	/* video page 0 */+	movb	$0x0e, %ah	/* print it */+	int	$0x10		/* via TTY mode */+	cmpb	$0, %al		/* end of string? */+	jne	1b		/* until done */+	ret++reset_disk_string:+	.ascii	"\r\nAbout to reset the boot drive. Report bug if the machine hangs here.\r\n\0"+reset_disk_ok_string:+	.ascii	"\r\nReturn from int13/AH=0. The reset of the boot drive is OK.\r\n\0"++bochs_copygrght_string:+	.ascii	"(c) 2002 MandrakeSoft S.A. Written by Kevin Lawton & the Bochs team.\0"+ENTRY(bios_id)+	.long	0	/* 1 for bochs, 0 for unknown. */+	.code32  #ifndef STAGE1_5 /*@@ -229,11 +483,17 @@  */ ENTRY(grub_reboot) 	call	EXT_C(prot_to_real)+ 	.code16+ 	/* cold boot */++	//sti		/* needn't enable interrupt here. comment it out */+ 	movw	$0x0472, %di 	movw	%ax, (%di) 	ljmp	$0xFFFF, $0x0000+ 	.code32 	 /*@@ -251,13 +511,17 @@ 	jnz	EXT_C(stop)  	call	EXT_C(prot_to_real)+ 	.code16 	+	//sti		/* this is not needed here, so comment it out. */+ 	/* detect APM */ 	movw	$0x5300, %ax 	xorw	%bx, %bx 	int	$0x15-	jc	EXT_C(hard_stop)+	//jc	EXT_C(hard_stop)+	jc	hard_stop 	/* don't check %bx for buggy BIOSes... */  	/* disconnect APM first */@@ -269,14 +533,16 @@ 	movw	$0x5301, %ax 	xorw	%bx, %bx 	int	$0x15-	jc	EXT_C(hard_stop)+	//jc	EXT_C(hard_stop)+	jc	hard_stop  	/* set APM protocol level - 1.1 or bust. (this covers APM 1.2 also) */ 	movw	$0x530E, %ax 	xorw	%bx, %bx 	movw	$0x0101, %cx 	int	$0x15-	jc	EXT_C(hard_stop)+	//jc	EXT_C(hard_stop)+	jc	hard_stop 	 	/* set the power state to off */ 	movw	$0x5307, %ax@@ -285,7 +551,9 @@ 	int	$0x15  	/* shouldn't reach here */-	jmp	EXT_C(hard_stop)+	//jmp	EXT_C(hard_stop)+	jmp	hard_stop+ 	.code32 	 /*@@ -315,8 +583,11 @@ 	movb	8(%ebp), %dl 	 	call	EXT_C(prot_to_real)+ 	.code16 +	//sti		/* it is not bad keeping interrupt off */+ 	movw	$SCRATCHSEG, %ax 	movw	%ax, %es 	xorw	%bx, %bx@@ -510,229 +781,4715 @@ 	cmpw	%ax, 2(%edi) 	jne	1f -	/* restore the original */-	movw	ABS(int15_offset), %ax-	movw	%ax, (%edi)-	movw	ABS(int15_segment), %ax-	movw	%ax, 2(%edi)+	/* restore the original */+	movw	ABS(int15_offset), %ax+	movw	%ax, (%edi)+	movw	ABS(int15_segment), %ax+	movw	%ax, 2(%edi)++1:+	popl	%edi+	ret+++/*+ * Translate a key code to another.+ *+ * Note: This implementation cannot handle more than one length+ * scancodes (such as Right Ctrl).+ */+	.code16+int15_handler:+	/* if non-carrier, ignore it */+	jnc	1f+	/* check if AH=4F */+	cmpb	$0x4F, %ah+	jne	1f++	/* E0 and E1 are special */+	cmpb	$0xE1, %al+	je	4f+	cmpb	$0xE0, %al+	/* this flag is actually the machine code (je or jmp) */+int15_skip_flag:	+	je	4f+	+	pushw	%bp+	movw	%sp, %bp+	+	pushw	%bx+	pushw	%dx+	pushw	%ds+	pushw	%si+

⌨️ 快捷键说明

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