This is an automated notification sent by Savannah. It relates to: bugs #9984, project GNU GRUB
============================================================================== OVERVIEW of bugs #9984: ============================================================================== URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=9984> Summary: Run DiskEMU1x.bin from Grub Project: GNU GRUB Submitted by: f22_storm Submitted on: Wed 08/11/04 at 21:15 Category: Booting Severity: Major Priority: 5 - Normal Item Group: None Status: None Privacy: Public Assigned to: None Originator Name: Originator Email: [EMAIL PROTECTED] Open/Closed: Open Release: 0.95 Reproducibility: Every Time Planned Release: _______________________________________________________ * For MultiBoot Support * Since Grub can be loaded from CD, we may want it load some binary boot file from system, such as DiskEMU.bin, xpboot.bin, or bootsect.dat, and so on. Yes, here are functions for this: 1). builtins.c static int run_func(char *arg, int flags) { int ret; unsigned long run_drv; struct term_entry *prev_term = current_term; run_drv = saved_drive; if(run_drv == cdrom_drive) { if (cdrom_drive != 0xe0) { grub_printf("\n Please init CD-ROM 1st. \n"); return 1; } } if (! grub_open (arg)) { grub_printf("\n incorect parameter. \n"); return 1; } /* Read whole file. */ ret = grub_read ((char *) RAW_ADDR (0x60000), -1); grub_close(); if (current_term->shutdown) { (*current_term->shutdown)(); current_term = term_table; /* assumption: console is first */ } gateA20 (0); run_jump(0x7c0, 0, run_drv); /* if we get back here, we should go back to what our term was before */ current_term = prev_term; if (current_term->startup) /* if our terminal fails to initialize, fall back to console since * it should always work */ if ((*current_term->startup)() == 0) current_term = term_table; /* we know that console is first */ return 0; } static struct builtin builtin_run= { "run", run_func, BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, "run FILE", "Run a NO-Emul Boot Sector file for CD-ROM Boot", }; struct builtin *builtin_table[] = { ... ... &builtin_run, ... ... } _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Wed 08/11/04 at 21:26 By: Gandalf <f22_storm> something comments for codes in asm.S ==================================== Because Grub's stage2 lays on 0000:8000, we have to read file to 6000:0000; In asm.S, we have 2 thing to do, one is move boot codes from 6000:0000 to 7c0:0000; and another one is move the 1st one from Grub's body to 0000:6000, and run it. ;-) ------------------------------------------------------- Date: Wed 08/11/04 at 21:21 By: Gandalf <f22_storm> 4). asm.S /* void run_jump (segment, offset, drv_num) * Jump to 0:7c00. by Gandalf */ ENTRY(run_jump) movl 0xc(%esp), %eax mov %ax, drv_num pushw %es pushw %ds pusha call EXT_C(prot_to_real) .code16 /* copy stub to 0:6000*/ movw $0x6000, %di xorw %ax, %ax push %ax pop %es movw $(RUN_MAIN), %si movw $(END_OF_RUN_MAIN - RUN_MAIN), %cx cld rep movsb /* OK, transfer Done! */ movw drv_num, %dx mov $(run_address_off), %di lcall *(%di) /* run 0:6000 */ RUN_MAIN: /* copy stub to 07c0:0000*/ pushw %dx /* Boot Drv Num */ movw $0x0, %di movw $0x7c0, %ax pushw %ax popw %es movw $0x0, %si movw $0x6000, %ax pushw %ax popw %ds movw $0x8000, %cx /* only support 32kb */ cld rep movsb /* OK, transfer Done! */ xorw %ax, %ax pushw %ax popw %ds popw %dx /* Boot Drv Num */ movw $0x7c0, %ax movw %ax, (0x5002) xorw %bx, %bx movw %bx, (0x5000) /* 0x07c0:0 */ movw $0x5000, %di lcall *(%di) END_OF_RUN_MAIN: DATA32 call EXT_C(real_to_prot) .code32 popa popw %ds popw %es ret ENTRY(RUN_DATA) .code16 run_address_off: .word 0x6000 run_address_seg: .word 0x0000 drv_num: .word 0x0000 ------------------------------------------------------- Date: Wed 08/11/04 at 21:19 By: Gandalf <f22_storm> 2). shared.h void run_jump (unsigned long segment, unsigned long offset, int drv_num) __attribute__ ((noreturn)); 3). asmstub.c void run_jump (unsigned long segment, unsigned long offset, int drv_num) { stop(); } ============================================================================== This item URL is: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=9984> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub