1Index: grub/stage2/builtins.c 2=================================================================== 3--- grub.orig/stage2/builtins.c 2008-06-16 15:18:14.649009000 +0100 4+++ grub/stage2/builtins.c 2008-06-16 15:18:14.719009000 +0100 5@@ -45,8 +45,10 @@ 6 #ifdef GRUB_UTIL 7 # include <device.h> 8 #else /* ! GRUB_UTIL */ 9+#ifndef __MINIOS 10 # include <apic.h> 11 # include <smp-imps.h> 12+#endif 13 #endif /* ! GRUB_UTIL */ 14 15 #ifdef USE_MD5_PASSWORDS 16@@ -246,11 +248,13 @@ 17 boot_func (char *arg, int flags) 18 { 19 struct term_entry *prev_term = current_term; 20+#ifndef __MINIOS__ 21 /* Clear the int15 handler if we can boot the kernel successfully. 22 This assumes that the boot code never fails only if KERNEL_TYPE is 23 not KERNEL_TYPE_NONE. Is this assumption is bad? */ 24 if (kernel_type != KERNEL_TYPE_NONE) 25 unset_int15_handler (); 26+#endif 27 28 /* if our terminal needed initialization, we should shut it down 29 * before booting the kernel, but we want to save what it was so 30@@ -261,13 +265,21 @@ 31 current_term = term_table; /* assumption: console is first */ 32 } 33 34+#ifndef __MINIOS__ 35 #ifdef SUPPORT_NETBOOT 36 /* Shut down the networking. */ 37 cleanup_net (); 38 #endif 39+#endif 40 41 switch (kernel_type) 42 { 43+#ifdef __MINIOS__ 44+ case KERNEL_TYPE_PV: 45+ /* Paravirtualized */ 46+ pv_boot(); 47+ break; 48+#else 49 case KERNEL_TYPE_FREEBSD: 50 case KERNEL_TYPE_NETBSD: 51 /* *BSD */ 52@@ -319,6 +331,7 @@ 53 multi_boot ((int) entry_addr, (int) &mbi); 54 break; 55 56+#endif 57 default: 58 errnum = ERR_BOOT_COMMAND; 59 return 1; 60@@ -1123,6 +1136,7 @@ 61 }; 62 63 64+#ifndef __MINIOS__ 65 /* displayapm */ 66 static int 67 displayapm_func (char *arg, int flags) 68@@ -1163,8 +1177,10 @@ 69 "displayapm", 70 "Display APM BIOS information." 71 }; 72+#endif 73 74 75+#ifndef __MINIOS__ 76 /* displaymem */ 77 static int 78 displaymem_func (char *arg, int flags) 79@@ -1218,6 +1234,7 @@ 80 "Display what GRUB thinks the system address space map of the" 81 " machine is, including all regions of physical RAM installed." 82 }; 83+#endif 84 85 86 /* dump FROM TO */ 87@@ -1280,6 +1297,7 @@ 88 #endif /* GRUB_UTIL */ 89 90 91+#ifndef __MINIOS__ 92 static char embed_info[32]; 93 /* embed */ 94 /* Embed a Stage 1.5 in the first cylinder after MBR or in the 95@@ -1413,6 +1431,7 @@ 96 " is a drive, or in the \"bootloader\" area if DEVICE is a FFS partition." 97 " Print the number of sectors which STAGE1_5 occupies if successful." 98 }; 99+#endif 100 101 102 /* fallback */ 103@@ -1956,6 +1975,7 @@ 104 #endif /* SUPPORT_NETBOOT */ 105 106 107+#ifndef __MINIOS__ 108 /* impsprobe */ 109 static int 110 impsprobe_func (char *arg, int flags) 111@@ -1982,6 +2002,7 @@ 112 " configuration table and boot the various CPUs which are found into" 113 " a tight loop." 114 }; 115+#endif 116 117 118 /* initrd */ 119@@ -1992,6 +2013,7 @@ 120 { 121 case KERNEL_TYPE_LINUX: 122 case KERNEL_TYPE_BIG_LINUX: 123+ case KERNEL_TYPE_PV: 124 if (! load_initrd (arg)) 125 return 1; 126 break; 127@@ -2015,6 +2037,7 @@ 128 }; 129 130 131+#ifndef __MINIOS__ 132 /* install */ 133 static int 134 install_func (char *arg, int flags) 135@@ -2555,8 +2578,10 @@ 136 " for LBA mode. If the option `--stage2' is specified, rewrite the Stage" 137 " 2 via your OS's filesystem instead of the raw device." 138 }; 139+#endif 140 141 142+#ifndef __MINIOS__ 143 /* ioprobe */ 144 static int 145 ioprobe_func (char *arg, int flags) 146@@ -2598,6 +2623,7 @@ 147 "ioprobe DRIVE", 148 "Probe I/O ports used for the drive DRIVE." 149 }; 150+#endif 151 152 /* print */ 153 static int 154@@ -2910,6 +2910,7 @@ 155 switch (kernel_type) 156 { 157 case KERNEL_TYPE_MULTIBOOT: 158+ case KERNEL_TYPE_PV: 159 if (mb_cmdline + len + 1 > (char *) MB_CMDLINE_BUF + MB_CMDLINE_BUFLEN) 160 { 161 errnum = ERR_WONT_FIT; 162@@ -3776,6 +3802,7 @@ 163 }; 164 165 166+#ifndef __MINIOS__ 167 #ifdef SUPPORT_SERIAL 168 /* serial */ 169 static int 170@@ -3927,8 +3954,10 @@ 171 " default values are COM1, 9600, 8N1." 172 }; 173 #endif /* SUPPORT_SERIAL */ 174+#endif 175 176 177+#ifndef __MINIOS__ 178 /* setkey */ 179 struct keysym 180 { 181@@ -4174,8 +4203,10 @@ 182 " is a digit), and delete. If no argument is specified, reset key" 183 " mappings." 184 }; 185+#endif 186 187 188+#ifndef __MINIOS__ 189 /* setup */ 190 static int 191 setup_func (char *arg, int flags) 192@@ -4484,6 +4515,7 @@ 193 " partition where GRUB images reside, specify the option `--stage2'" 194 " to tell GRUB the file name under your OS." 195 }; 196+#endif 197 198 199 #if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS) 200@@ -4788,6 +4820,7 @@ 201 #endif /* SUPPORT_SERIAL */ 202 203 204+#ifndef __MINIOS__ 205 /* testload */ 206 static int 207 testload_func (char *arg, int flags) 208@@ -4874,8 +4907,10 @@ 209 " consistent offset error. If this test succeeds, then a good next" 210 " step is to try loading a kernel." 211 }; 212+#endif 213 214 215+#ifndef __MINIOS__ 216 /* testvbe MODE */ 217 static int 218 testvbe_func (char *arg, int flags) 219@@ -4979,6 +5014,7 @@ 220 "testvbe MODE", 221 "Test the VBE mode MODE. Hit any key to return." 222 }; 223+#endif 224 225 226 #ifdef SUPPORT_NETBOOT 227@@ -5075,6 +5111,7 @@ 228 }; 229 230 231+#ifndef __MINIOS__ 232 /* uppermem */ 233 static int 234 uppermem_func (char *arg, int flags) 235@@ -5095,8 +5132,10 @@ 236 "Force GRUB to assume that only KBYTES kilobytes of upper memory are" 237 " installed. Any system address range maps are discarded." 238 }; 239+#endif 240 241 242+#ifndef __MINIOS__ 243 /* vbeprobe */ 244 static int 245 vbeprobe_func (char *arg, int flags) 246@@ -5203,6 +5242,7 @@ 247 "Probe VBE information. If the mode number MODE is specified, show only" 248 " the information about only the mode." 249 }; 250+#endif 251 252 253 /* The table of builtin commands. Sorted in dictionary order. */ 254@@ -5233,12 +5273,16 @@ 255 #ifdef SUPPORT_NETBOOT 256 &builtin_dhcp, 257 #endif /* SUPPORT_NETBOOT */ 258+#ifndef __MINIOS__ 259 &builtin_displayapm, 260 &builtin_displaymem, 261+#endif 262 #ifdef GRUB_UTIL 263 &builtin_dump, 264 #endif /* GRUB_UTIL */ 265+#ifndef __MINIOS__ 266 &builtin_embed, 267+#endif 268 &builtin_fallback, 269 &builtin_find, 270 #ifdef SUPPORT_GRAPHICS 271@@ -5253,10 +5297,14 @@ 272 #ifdef SUPPORT_NETBOOT 273 &builtin_ifconfig, 274 #endif /* SUPPORT_NETBOOT */ 275+#ifndef __MINIOS__ 276 &builtin_impsprobe, 277+#endif 278 &builtin_initrd, 279+#ifndef __MINIOS__ 280 &builtin_install, 281 &builtin_ioprobe, 282+#endif 283 &builtin_kernel, 284 &builtin_lock, 285 &builtin_makeactive, 286@@ -5283,11 +5331,13 @@ 287 &builtin_root, 288 &builtin_rootnoverify, 289 &builtin_savedefault, 290+#ifndef __MINIOS__ 291 #ifdef SUPPORT_SERIAL 292 &builtin_serial, 293 #endif /* SUPPORT_SERIAL */ 294 &builtin_setkey, 295 &builtin_setup, 296+#endif 297 #ifdef SUPPORT_GRAPHICS 298 &builtin_shade, 299 &builtin_splashimage, 300@@ -5298,16 +5348,20 @@ 301 #ifdef SUPPORT_SERIAL 302 &builtin_terminfo, 303 #endif /* SUPPORT_SERIAL */ 304+#ifndef __MINIOS__ 305 &builtin_testload, 306 &builtin_testvbe, 307+#endif 308 #ifdef SUPPORT_NETBOOT 309 &builtin_tftpserver, 310 #endif /* SUPPORT_NETBOOT */ 311 &builtin_timeout, 312 &builtin_title, 313 &builtin_unhide, 314+#ifndef __MINIOS__ 315 &builtin_uppermem, 316 &builtin_vbeprobe, 317+#endif 318 #ifdef SUPPORT_GRAPHICS 319 &builtin_viewport, 320 #endif 321Index: grub/stage2/char_io.c 322=================================================================== 323--- grub.orig/stage2/char_io.c 2008-06-16 15:18:14.516009000 +0100 324+++ grub/stage2/char_io.c 2008-06-16 15:18:14.726009000 +0100 325@@ -20,6 +20,7 @@ 326 327 #include <shared.h> 328 #include <term.h> 329+#include <stdarg.h> 330 331 #ifdef SUPPORT_HERCULES 332 # include <hercules.h> 333@@ -36,6 +37,7 @@ 334 #ifndef STAGE1_5 335 struct term_entry term_table[] = 336 { 337+#ifdef SUPPORT_CONSOLE 338 { 339 "console", 340 0, 341@@ -52,6 +54,7 @@ 342 0, 343 0 344 }, 345+#endif 346 #ifdef SUPPORT_SERIAL 347 { 348 "serial", 349@@ -131,9 +134,9 @@ 350 } 351 352 char * 353-convert_to_ascii (char *buf, int c,...) 354+convert_to_ascii (char *buf, int c, int _num) 355 { 356- unsigned long num = *((&c) + 1), mult = 10; 357+ unsigned long num = _num, mult = 10; 358 char *ptr = buf; 359 360 #ifndef STAGE1_5 361@@ -182,11 +185,11 @@ 362 void 363 grub_printf (const char *format,...) 364 { 365- int *dataptr = (int *) &format; 366+ va_list ap; 367 char c, str[16]; 368- 369- dataptr++; 370 371+ va_start(ap, format); 372+ 373 while ((c = *(format++)) != 0) 374 { 375 if (c != '%') 376@@ -200,21 +203,32 @@ 377 case 'X': 378 #endif 379 case 'u': 380- *convert_to_ascii (str, c, *((unsigned long *) dataptr++)) = 0; 381+ { 382+ unsigned i = va_arg(ap, unsigned); 383+ *convert_to_ascii (str, c, i) = 0; 384 grub_putstr (str); 385 break; 386+ } 387 388 #ifndef STAGE1_5 389 case 'c': 390- grub_putchar ((*(dataptr++)) & 0xff); 391+ { 392+ int c = va_arg(ap, int); 393+ grub_putchar (c & 0xff); 394 break; 395+ } 396 397 case 's': 398- grub_putstr ((char *) *(dataptr++)); 399+ { 400+ char *s = va_arg(ap, char*); 401+ grub_putstr (s); 402 break; 403+ } 404 #endif 405 } 406 } 407+ 408+ va_end(ap); 409 } 410 411 #ifndef STAGE1_5 412@@ -223,11 +237,11 @@ 413 { 414 /* XXX hohmuth 415 ugly hack -- should unify with printf() */ 416- int *dataptr = (int *) &format; 417+ va_list ap; 418 char c, *ptr, str[16]; 419 char *bp = buffer; 420 421- dataptr++; 422+ va_start(ap, format); 423 424 while ((c = *format++) != 0) 425 { 426@@ -237,20 +251,27 @@ 427 switch (c = *(format++)) 428 { 429 case 'd': case 'u': case 'x': 430- *convert_to_ascii (str, c, *((unsigned long *) dataptr++)) = 0; 431+ { 432+ unsigned i = va_arg(ap, unsigned); 433+ *convert_to_ascii (str, c, i) = 0; 434 435 ptr = str; 436 437 while (*ptr) 438 *bp++ = *(ptr++); /* putchar(*(ptr++)); */ 439 break; 440+ } 441 442- case 'c': *bp++ = (*(dataptr++))&0xff; 443+ case 'c': 444+ { 445+ int c = va_arg(ap, int); 446+ *bp++ = c&0xff; 447 /* putchar((*(dataptr++))&0xff); */ 448 break; 449+ } 450 451 case 's': 452- ptr = (char *) (*(dataptr++)); 453+ ptr = va_arg(ap, char *); 454 455 while ((c = *ptr++) != 0) 456 *bp++ = c; /* putchar(c); */ 457@@ -258,6 +279,8 @@ 458 } 459 } 460 461+ va_end(ap); 462+ 463 *bp = 0; 464 return bp - buffer; 465 } 466@@ -1263,12 +1286,14 @@ 467 return ! errnum; 468 #endif /* GRUB_UTIL */ 469 470+#ifndef __MINIOS__ 471 if ((addr < RAW_ADDR (0x1000)) 472 || (addr < RAW_ADDR (0x100000) 473 && RAW_ADDR (mbi.mem_lower * 1024) < (addr + len)) 474 || (addr >= RAW_ADDR (0x100000) 475 && RAW_ADDR (mbi.mem_upper * 1024) < ((addr - 0x100000) + len))) 476 errnum = ERR_WONT_FIT; 477+#endif 478 479 return ! errnum; 480 } 481@@ -1342,7 +1367,7 @@ 482 } 483 #endif /* ! STAGE1_5 */ 484 485-#ifndef GRUB_UTIL 486+#if !defined(GRUB_UTIL) && !defined(__MINIOS__) 487 # undef memcpy 488 /* GCC emits references to memcpy() for struct copies etc. */ 489 void *memcpy (void *dest, const void *src, int n) __attribute__ ((alias ("grub_memmove"))); 490Index: grub/stage2/disk_io.c 491=================================================================== 492--- grub.orig/stage2/disk_io.c 2008-06-16 15:18:03.327932000 +0100 493+++ grub/stage2/disk_io.c 2008-06-16 15:18:14.733009000 +0100 494@@ -130,7 +130,14 @@ 495 static inline unsigned long 496 log2 (unsigned long word) 497 { 498- asm volatile ("bsfl %1,%0" 499+ asm volatile ("bsf" 500+#ifdef __i386__ 501+ "l" 502+#endif 503+#ifdef __x86_64__ 504+ "q" 505+#endif 506+ " %1,%0" 507 : "=r" (word) 508 : "r" (word)); 509 return word; 510Index: grub/stage2/fsys_fat.c 511=================================================================== 512--- grub.orig/stage2/fsys_fat.c 2008-06-16 15:18:03.337934000 +0100 513+++ grub/stage2/fsys_fat.c 2008-06-16 15:18:14.737009000 +0100 514@@ -57,7 +57,14 @@ 515 static __inline__ unsigned long 516 log2 (unsigned long word) 517 { 518- __asm__ ("bsfl %1,%0" 519+ __asm__ ("bsf" 520+#ifdef __i386__ 521+ "l" 522+#endif 523+#ifdef __x86_64__ 524+ "q" 525+#endif 526+ " %1,%0" 527 : "=r" (word) 528 : "r" (word)); 529 return word; 530Index: grub/stage2/pc_slice.h 531=================================================================== 532--- grub.orig/stage2/pc_slice.h 2008-06-16 15:18:03.347932000 +0100 533+++ grub/stage2/pc_slice.h 2008-06-16 15:18:14.746009000 +0100 534@@ -38,50 +38,50 @@ 535 */ 536 537 #define PC_MBR_CHECK_SIG(mbr_ptr) \ 538- ( *( (unsigned short *) (((int) mbr_ptr) + PC_MBR_SIG_OFFSET) ) \ 539+ ( *( (unsigned short *) (((long) mbr_ptr) + PC_MBR_SIG_OFFSET) ) \ 540 == PC_MBR_SIGNATURE ) 541 542 #define PC_MBR_SIG(mbr_ptr) \ 543- ( *( (unsigned short *) (((int) mbr_ptr) + PC_MBR_SIG_OFFSET) ) ) 544+ ( *( (unsigned short *) (((long) mbr_ptr) + PC_MBR_SIG_OFFSET) ) ) 545 546 #define PC_SLICE_FLAG(mbr_ptr, part) \ 547- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET \ 548+ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET \ 549 + (part << 4)) ) ) 550 551 #define PC_SLICE_HEAD(mbr_ptr, part) \ 552- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 1 \ 553+ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 1 \ 554 + (part << 4)) ) ) 555 556 #define PC_SLICE_SEC(mbr_ptr, part) \ 557- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 2 \ 558+ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 2 \ 559 + (part << 4)) ) ) 560 561 #define PC_SLICE_CYL(mbr_ptr, part) \ 562- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 3 \ 563+ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 3 \ 564 + (part << 4)) ) ) 565 566 #define PC_SLICE_TYPE(mbr_ptr, part) \ 567- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 4 \ 568+ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 4 \ 569 + (part << 4)) ) ) 570 571 #define PC_SLICE_EHEAD(mbr_ptr, part) \ 572- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 5 \ 573+ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 5 \ 574 + (part << 4)) ) ) 575 576 #define PC_SLICE_ESEC(mbr_ptr, part) \ 577- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 6 \ 578+ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 6 \ 579 + (part << 4)) ) ) 580 581 #define PC_SLICE_ECYL(mbr_ptr, part) \ 582- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 7 \ 583+ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 7 \ 584 + (part << 4)) ) ) 585 586 #define PC_SLICE_START(mbr_ptr, part) \ 587- ( *( (unsigned long *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 8 \ 588+ ( *( (unsigned long *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 8 \ 589 + (part << 4)) ) ) 590 591 #define PC_SLICE_LENGTH(mbr_ptr, part) \ 592- ( *( (unsigned long *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 12 \ 593+ ( *( (unsigned long *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 12 \ 594 + (part << 4)) ) ) 595 596 597Index: grub/stage2/shared.h 598=================================================================== 599--- grub.orig/stage2/shared.h 2008-06-16 15:18:14.537009000 +0100 600+++ grub/stage2/shared.h 2008-06-17 14:25:08.443906000 +0100 601@@ -39,6 +39,10 @@ 602 extern char *grub_scratch_mem; 603 # define RAW_ADDR(x) ((x) + (int) grub_scratch_mem) 604 # define RAW_SEG(x) (RAW_ADDR ((x) << 4) >> 4) 605+#elif defined(__MINIOS__) 606+extern char grub_scratch_mem[]; 607+# define RAW_ADDR(x) ((x) + (int) grub_scratch_mem) 608+# define RAW_SEG(x) (RAW_ADDR ((x) << 4) >> 4) 609 #else 610 # define RAW_ADDR(x) (x) 611 # define RAW_SEG(x) (x) 612@@ -707,7 +711,9 @@ 613 614 /* Halt the system, using APM if possible. If NO_APM is true, don't use 615 APM even if it is available. */ 616+#ifndef __MINIOS__ 617 void grub_halt (int no_apm) __attribute__ ((noreturn)); 618+#endif 619 620 /* Copy MAP to the drive map and set up int13_handler. */ 621 void set_int13_handler (unsigned short *map); 622@@ -857,7 +863,8 @@ 623 KERNEL_TYPE_BIG_LINUX, /* Big Linux. */ 624 KERNEL_TYPE_FREEBSD, /* FreeBSD. */ 625 KERNEL_TYPE_NETBSD, /* NetBSD. */ 626- KERNEL_TYPE_CHAINLOADER /* Chainloader. */ 627+ KERNEL_TYPE_CHAINLOADER, /* Chainloader. */ 628+ KERNEL_TYPE_PV /* Paravirtualized. */ 629 } 630 kernel_t; 631 632@@ -890,7 +897,7 @@ 633 int grub_strlen (const char *str); 634 char *grub_strcpy (char *dest, const char *src); 635 636-#ifndef GRUB_UTIL 637+#if !defined(GRUB_UTIL) && !defined(__MINIOS__) 638 typedef unsigned long grub_jmp_buf[6]; 639 #else 640 /* In the grub shell, use the libc jmp_buf instead. */ 641@@ -898,7 +905,7 @@ 642 # define grub_jmp_buf jmp_buf 643 #endif 644 645-#ifdef GRUB_UTIL 646+#if defined(GRUB_UTIL) || defined(__MINIOS__) 647 # define grub_setjmp setjmp 648 # define grub_longjmp longjmp 649 #else /* ! GRUB_UTIL */ 650@@ -914,7 +921,7 @@ 651 /* misc */ 652 void init_page (void); 653 void print_error (void); 654-char *convert_to_ascii (char *buf, int c, ...); 655+char *convert_to_ascii (char *buf, int c, int num); 656 int get_cmdline (char *prompt, char *cmdline, int maxlen, 657 int echo_char, int history); 658 int substring (const char *s1, const char *s2); 659Index: grub/netboot/etherboot.h 660=================================================================== 661--- grub.orig/netboot/etherboot.h 2008-06-16 15:18:03.446934000 +0100 662+++ grub/netboot/etherboot.h 2008-06-16 15:18:14.760009000 +0100 663@@ -246,7 +246,7 @@ 664 665 typedef struct 666 { 667- unsigned long s_addr; 668+ unsigned int s_addr; 669 } 670 in_addr; 671 672@@ -302,7 +302,7 @@ 673 char bp_htype; 674 char bp_hlen; 675 char bp_hops; 676- unsigned long bp_xid; 677+ unsigned int bp_xid; 678 unsigned short bp_secs; 679 unsigned short unused; 680 in_addr bp_ciaddr; 681@@ -411,25 +411,25 @@ 682 683 struct 684 { 685- long id; 686- long type; 687- long rpcvers; 688- long prog; 689- long vers; 690- long proc; 691- long data[1]; 692+ int id; 693+ int type; 694+ int rpcvers; 695+ int prog; 696+ int vers; 697+ int proc; 698+ int data[1]; 699 } 700 call; 701 702 struct 703 { 704- long id; 705- long type; 706- long rstatus; 707- long verifier; 708- long v2; 709- long astatus; 710- long data[1]; 711+ int id; 712+ int type; 713+ int rstatus; 714+ int verifier; 715+ int v2; 716+ int astatus; 717+ int data[1]; 718 } 719 reply; 720 } 721@@ -517,7 +517,9 @@ 722 723 /* misc.c */ 724 extern void twiddle (void); 725+#ifndef __MINIOS__ 726 extern void sleep (int secs); 727+#endif 728 extern int getdec (char **s); 729 extern void etherboot_printf (const char *, ...); 730 extern int etherboot_sprintf (char *, const char *, ...); 731Index: grub/stage2/common.c 732=================================================================== 733--- grub.orig/stage2/common.c 2008-06-16 15:18:03.366934000 +0100 734+++ grub/stage2/common.c 2008-06-16 15:18:14.764009000 +0100 735@@ -137,6 +137,7 @@ 736 } 737 #endif /* ! STAGE1_5 */ 738 739+#ifndef __MINIOS__ 740 /* This queries for BIOS information. */ 741 void 742 init_bios_info (void) 743@@ -335,3 +336,4 @@ 744 /* Start main routine here. */ 745 cmain (); 746 } 747+#endif 748Index: grub/stage2/serial.c 749=================================================================== 750--- grub.orig/stage2/serial.c 2008-06-16 15:18:03.376934000 +0100 751+++ grub/stage2/serial.c 2008-06-16 15:18:14.769009000 +0100 752@@ -37,7 +37,7 @@ 753 754 /* Hardware-dependent definitions. */ 755 756-#ifndef GRUB_UTIL 757+#if !defined(GRUB_UTIL) && !defined(__MINIOS__) 758 /* The structure for speed vs. divisor. */ 759 struct divisor 760 { 761@@ -222,6 +222,8 @@ 762 {('3' | ('~' << 8)), 4}, 763 {('5' | ('~' << 8)), 7}, 764 {('6' | ('~' << 8)), 3}, 765+ {('7' | ('~' << 8)), 1}, 766+ {('8' | ('~' << 8)), 5}, 767 }; 768 769 /* The buffer must start with ``ESC [''. */ 770Index: grub/stage2/tparm.c 771=================================================================== 772--- grub.orig/stage2/tparm.c 2008-06-16 15:18:03.390933000 +0100 773+++ grub/stage2/tparm.c 2008-06-16 15:18:14.774010000 +0100 774@@ -48,6 +48,7 @@ 775 #include "shared.h" 776 777 #include "tparm.h" 778+#include <stdarg.h> 779 780 /* 781 * Common/troublesome character definitions 782@@ -320,7 +321,7 @@ 783 #define isLOWER(c) ((c) >= 'a' && (c) <= 'z') 784 785 static inline char * 786-tparam_internal(const char *string, int *dataptr) 787+tparam_internal(const char *string, va_list ap) 788 { 789 #define NUM_VARS 26 790 char *p_is_s[9]; 791@@ -461,9 +462,9 @@ 792 * a char* and an int may not be the same size on the stack. 793 */ 794 if (p_is_s[i] != 0) { 795- p_is_s[i] = (char *)(*(dataptr++)); 796+ p_is_s[i] = va_arg(ap, char *); 797 } else { 798- param[i] = (int)(*(dataptr++)); 799+ param[i] = va_arg(ap, int); 800 } 801 } 802 803@@ -716,11 +717,13 @@ 804 grub_tparm(const char *string,...) 805 { 806 char *result; 807- int *dataptr = (int *) &string; 808+ va_list ap; 809 810- dataptr++; 811+ va_start(ap, string); 812 813- result = tparam_internal(string, dataptr); 814+ result = tparam_internal(string, ap); 815+ 816+ va_end(ap); 817 818 return result; 819 } 820Index: grub/stage2/fsys_iso9660.c 821=================================================================== 822--- grub.orig/stage2/fsys_iso9660.c 2008-06-16 15:18:03.400933000 +0100 823+++ grub/stage2/fsys_iso9660.c 2008-06-16 15:18:14.779009000 +0100 824@@ -59,7 +59,14 @@ 825 static inline unsigned long 826 log2 (unsigned long word) 827 { 828- asm volatile ("bsfl %1,%0" 829+ asm volatile ("bsf" 830+#ifdef __i386__ 831+ "l" 832+#endif 833+#ifdef __x86_64__ 834+ "q" 835+#endif 836+ " %1,%0" 837 : "=r" (word) 838 : "r" (word)); 839 return word; 840Index: grub/stage2/fsys_reiserfs.c 841=================================================================== 842--- grub.orig/stage2/fsys_reiserfs.c 2008-06-16 15:18:03.410933000 +0100 843+++ grub/stage2/fsys_reiserfs.c 2008-06-20 18:33:52.002100000 +0100 844@@ -224,8 +224,8 @@ 845 846 struct disk_child 847 { 848- unsigned long dc_block_number; /* Disk child's block number. */ 849- unsigned short dc_size; /* Disk child's used space. */ 850+ __u32 dc_block_number; /* Disk child's block number. */ 851+ __u16 dc_size; /* Disk child's used space. */ 852 }; 853 854 #define DC_SIZE (sizeof (struct disk_child)) 855@@ -369,7 +369,14 @@ 856 static __inline__ unsigned long 857 log2 (unsigned long word) 858 { 859- __asm__ ("bsfl %1,%0" 860+ __asm__ ("bsf" 861+#ifdef __i386__ 862+ "l" 863+#endif 864+#ifdef __x86_64__ 865+ "q" 866+#endif 867+ " %1,%0" 868 : "=r" (word) 869 : "r" (word)); 870 return word; 871Index: grub/netboot/misc.c 872=================================================================== 873--- grub.orig/netboot/misc.c 2008-06-16 15:18:03.456934000 +0100 874+++ grub/netboot/misc.c 2008-06-16 15:18:14.790009000 +0100 875@@ -21,7 +21,9 @@ 876 877 #define GRUB 1 878 #include <etherboot.h> 879+#include <stdarg.h> 880 881+#ifndef __MINIOS__ 882 void 883 sleep (int secs) 884 { 885@@ -30,6 +32,7 @@ 886 while (currticks () < tmo) 887 ; 888 } 889+#endif 890 891 void 892 twiddle (void) 893@@ -71,7 +74,7 @@ 894 Note: width specification not supported 895 **************************************************************************/ 896 static int 897-etherboot_vsprintf (char *buf, const char *fmt, const int *dp) 898+etherboot_vsprintf (char *buf, const char *fmt, va_list ap) 899 { 900 char *p, *s; 901 902@@ -86,7 +89,7 @@ 903 904 if (*++fmt == 's') 905 { 906- for (p = (char *) *dp++; *p != '\0'; p++) 907+ for (p = va_arg(ap, char *); *p != '\0'; p++) 908 buf ? *s++ = *p : grub_putchar (*p); 909 } 910 else 911@@ -121,11 +124,9 @@ 912 if ((*fmt | 0x20) == 'x') 913 { 914 /* With x86 gcc, sizeof(long) == sizeof(int) */ 915- const long *lp = (const long *) dp; 916- long h = *lp++; 917+ long h = va_arg(ap, int); 918 int ncase = (*fmt & 0x20); 919 920- dp = (const int *) lp; 921 if (alt) 922 { 923 *q++ = '0'; 924@@ -136,7 +137,7 @@ 925 } 926 else if (*fmt == 'd') 927 { 928- int i = *dp++; 929+ int i = va_arg(ap, int); 930 char *r; 931 932 if (i < 0) 933@@ -171,10 +172,8 @@ 934 unsigned char c[4]; 935 } 936 u; 937- const long *lp = (const long *) dp; 938 939- u.l = *lp++; 940- dp = (const int *) lp; 941+ u.l = va_arg(ap, int); 942 943 for (r = &u.c[0]; r < &u.c[4]; ++r) 944 q += etherboot_sprintf (q, "%d.", *r); 945@@ -184,7 +183,7 @@ 946 else if (*fmt == '!') 947 { 948 char *r; 949- p = (char *) *dp++; 950+ p = va_arg(ap, char *); 951 952 for (r = p + ETH_ALEN; p < r; ++p) 953 q += etherboot_sprintf (q, "%hhX:", *p); 954@@ -192,7 +191,7 @@ 955 --q; 956 } 957 else if (*fmt == 'c') 958- *q++ = *dp++; 959+ *q++ = va_arg(ap, int); 960 else 961 *q++ = *fmt; 962 963@@ -211,13 +210,21 @@ 964 int 965 etherboot_sprintf (char *buf, const char *fmt, ...) 966 { 967- return etherboot_vsprintf (buf, fmt, ((const int *) &fmt) + 1); 968+ va_list ap; 969+ int ret; 970+ va_start(ap, fmt); 971+ ret = etherboot_vsprintf (buf, fmt, ap); 972+ va_end(ap); 973+ return ret; 974 } 975 976 void 977 etherboot_printf (const char *fmt, ...) 978 { 979- (void) etherboot_vsprintf (0, fmt, ((const int *) &fmt) + 1); 980+ va_list ap; 981+ va_start(ap, fmt); 982+ etherboot_vsprintf (0, fmt, ap); 983+ va_end(ap); 984 } 985 986 int 987Index: grub/netboot/main.c 988=================================================================== 989--- grub.orig/netboot/main.c 2008-06-16 15:18:03.470932000 +0100 990+++ grub/netboot/main.c 2008-06-16 15:18:14.797009000 +0100 991@@ -55,7 +55,7 @@ 992 static int vendorext_isvalid; 993 static unsigned long netmask; 994 static struct bootpd_t bootp_data; 995-static unsigned long xid; 996+static unsigned int xid; 997 998 #define BOOTP_DATA_ADDR (&bootp_data) 999 1000@@ -778,7 +778,7 @@ 1001 1002 arpreply = (struct arprequest *) &nic.packet[ETH_HLEN]; 1003 1004- if (arpreply->opcode == htons (ARP_REPLY) 1005+ if (arpreply->opcode == htons (ARP_REPLY) && ptr 1006 && ! grub_memcmp (arpreply->sipaddr, ptr, sizeof (in_addr)) 1007 && type == AWAIT_ARP) 1008 { 1009@@ -827,7 +827,7 @@ 1010 { 1011 arpreply = (struct arprequest *) &nic.packet[ETH_HLEN]; 1012 1013- if (arpreply->opcode == htons (RARP_REPLY) 1014+ if (arpreply->opcode == htons (RARP_REPLY) && ptr 1015 && ! grub_memcmp (arpreply->thwaddr, ptr, ETH_ALEN)) 1016 { 1017 grub_memmove ((char *) arptable[ARP_SERVER].node, 1018@@ -1135,7 +1135,7 @@ 1019 long 1020 rfc2131_sleep_interval (int base, int exp) 1021 { 1022- static long seed = 0; 1023+ static unsigned seed = 0; 1024 long q; 1025 unsigned long tmo; 1026 1027Index: grub/stage2/graphics.c 1028=================================================================== 1029--- grub.orig/stage2/graphics.c 2008-06-16 15:18:14.524009000 +0100 1030+++ grub/stage2/graphics.c 2008-06-17 14:29:05.204328000 +0100 1031@@ -30,7 +30,29 @@ 1032 #include <shared.h> 1033 #include <graphics.h> 1034 1035+#ifdef __MINIOS__ 1036+#include <stdint.h> 1037+typedef uint8_t Bit8u; 1038+#include <vgafonts.h> 1039+#include <fbfront.h> 1040+#include <malloc.h> 1041+#define set_int1c_handler() (void)0 1042+#define unset_int1c_handler() (void)0 1043+static uint32_t *VIDEOMEM; 1044+static struct fbfront_dev *fb_dev; 1045+static uint32_t palette[17]; 1046+short cursorX, cursorY; 1047+/* TODO: blink */ 1048+uint32_t cursorBuf32[16*8]; 1049+#define WIDTH 640 1050+#define HEIGHT 480 1051+#define DEPTH 32 1052+#define RAMSIZE (WIDTH * HEIGHT * (DEPTH / 8)) 1053+#else 1054+#define fbfront_update(dev, x, y, w, h) (void)0 1055 int saved_videomode; 1056+#endif 1057+ 1058 unsigned char *font8x16; 1059 1060 int graphics_inited = 0; 1061@@ -38,11 +60,15 @@ 1062 1063 int shade = 1, no_cursor = 0; 1064 1065+#ifdef __MINIOS__ 1066+uint32_t VSHADOW[RAMSIZE]; 1067+#else 1068 #define VSHADOW VSHADOW1 1069 unsigned char VSHADOW1[38400]; 1070 unsigned char VSHADOW2[38400]; 1071 unsigned char VSHADOW4[38400]; 1072 unsigned char VSHADOW8[38400]; 1073+#endif 1074 1075 /* define the default viewable area */ 1076 int view_x0 = 0; 1077@@ -129,6 +155,8 @@ 1078 count_lines = k; 1079 1080 no_scroll = 0; 1081+ 1082+ fbfront_update(fb_dev, view_x0 * 8, view_y0 * 16, (view_x1 - view_x0) * 8, (view_y1 - view_y0) * 16); 1083 } 1084 1085 /* Set the splash image */ 1086@@ -154,17 +182,29 @@ 1087 int graphics_init() 1088 { 1089 if (!graphics_inited) { 1090+#ifdef __MINIOS__ 1091+ VIDEOMEM = memalign(PAGE_SIZE, RAMSIZE); 1092+ if (!(fb_dev = fb_open(VIDEOMEM, WIDTH, HEIGHT, DEPTH))) { 1093+ free(VIDEOMEM); 1094+ return 0; 1095+ } 1096+#else 1097 saved_videomode = set_videomode(0x12); 1098 if (get_videomode() != 0x12) { 1099 set_videomode(saved_videomode); 1100 return 0; 1101 } 1102+#endif 1103 graphics_inited = 1; 1104 } 1105 else 1106 return 1; 1107 1108+#ifdef __MINIOS__ 1109+ font8x16 = vgafont16; 1110+#else 1111 font8x16 = (unsigned char*)graphics_get_font(); 1112+#endif 1113 1114 /* make sure that the highlight color is set correctly */ 1115 graphics_highlight_color = ((graphics_normal_color >> 4) | 1116@@ -176,7 +216,11 @@ 1117 grub_printf("Failed to read splash image (%s)\n", splashimage); 1118 grub_printf("Press any key to continue..."); 1119 getkey(); 1120+#ifdef __MINIOS__ 1121+ fb_close(); 1122+#else 1123 set_videomode(saved_videomode); 1124+#endif 1125 graphics_inited = 0; 1126 return 0; 1127 } 1128@@ -190,8 +234,13 @@ 1129 void graphics_end(void) 1130 { 1131 if (graphics_inited) { 1132+#ifdef __MINIOS__ 1133+ fb_close(); 1134+ free(VIDEOMEM); 1135+#else 1136 unset_int1c_handler(); 1137 set_videomode(saved_videomode); 1138+#endif 1139 graphics_inited = 0; 1140 no_cursor = 0; 1141 } 1142@@ -204,15 +253,19 @@ 1143 graphics_cursor(0); 1144 1145 if (ch == '\n') { 1146+ fbfront_update(fb_dev, cursorX, cursorY, 8, 16); 1147 if (fonty + 1 < view_y1) 1148 graphics_setxy(fontx, fonty + 1); 1149 else 1150 graphics_scroll(); 1151 graphics_cursor(1); 1152+ fbfront_update(fb_dev, cursorX, cursorY, 8, 16); 1153 return; 1154 } else if (ch == '\r') { 1155+ fbfront_update(fb_dev, cursorX, cursorY, 8, 16); 1156 graphics_setxy(view_x0, fonty); 1157 graphics_cursor(1); 1158+ fbfront_update(fb_dev, cursorX, cursorY, 8, 16); 1159 return; 1160 } 1161 1162@@ -224,6 +277,7 @@ 1163 text[fonty * 80 + fontx] |= 0x100; 1164 1165 graphics_cursor(0); 1166+ fbfront_update(fb_dev, cursorX, cursorY, 8, 16); 1167 1168 if ((fontx + 1) >= view_x1) { 1169 graphics_setxy(view_x0, fonty); 1170@@ -232,13 +286,16 @@ 1171 else 1172 graphics_scroll(); 1173 graphics_cursor(1); 1174+ fbfront_update(fb_dev, cursorX, cursorY, 8, 16); 1175 do_more (); 1176 graphics_cursor(0); 1177+ fbfront_update(fb_dev, cursorX, cursorY, 8, 16); 1178 } else { 1179 graphics_setxy(fontx + 1, fonty); 1180 } 1181 1182 graphics_cursor(1); 1183+ fbfront_update(fb_dev, cursorX, cursorY, 8, 16); 1184 } 1185 1186 /* get the current location of the cursor */ 1187@@ -248,10 +305,12 @@ 1188 1189 void graphics_gotoxy(int x, int y) { 1190 graphics_cursor(0); 1191+ fbfront_update(fb_dev, cursorX, cursorY, 8, 16); 1192 1193 graphics_setxy(x, y); 1194 1195 graphics_cursor(1); 1196+ fbfront_update(fb_dev, cursorX, cursorY, 8, 16); 1197 } 1198 1199 void graphics_cls(void) { 1200@@ -262,15 +321,21 @@ 1201 graphics_gotoxy(view_x0, view_y0); 1202 1203 mem = (unsigned char*)VIDEOMEM; 1204+#ifndef __MINIOS__ 1205 s1 = (unsigned char*)VSHADOW1; 1206 s2 = (unsigned char*)VSHADOW2; 1207 s4 = (unsigned char*)VSHADOW4; 1208 s8 = (unsigned char*)VSHADOW8; 1209+#endif 1210 1211 for (i = 0; i < 80 * 30; i++) 1212 text[i] = ' '; 1213 graphics_cursor(1); 1214 1215+#ifdef __MINIOS__ 1216+ memcpy(mem, VSHADOW, RAMSIZE); 1217+ fbfront_update(fb_dev, 0, 0, 640, 480); 1218+#else 1219 BitMask(0xff); 1220 1221 /* plane 1 */ 1222@@ -290,6 +355,7 @@ 1223 grub_memcpy(mem, s8, 38400); 1224 1225 MapMask(15); 1226+#endif 1227 1228 if (no_cursor) { 1229 no_cursor = 0; 1230@@ -337,6 +403,11 @@ 1231 return 0; 1232 } 1233 1234+void graphics_set_palette(int idx, int red, int green, int blue) 1235+{ 1236+ palette[idx] = (red << (16 + 2)) | (green << (8 + 2)) | (blue << 2); 1237+} 1238+ 1239 /* Read in the splashscreen image and set the palette up appropriately. 1240 * Format of splashscreen is an xpm (can be gzipped) with 16 colors and 1241 * 640x480. */ 1242@@ -413,18 +484,19 @@ 1243 } 1244 1245 if (len == 6 && idx < 15) { 1246- int r = ((hex(buf[0]) << 4) | hex(buf[1])) >> 2; 1247- int g = ((hex(buf[2]) << 4) | hex(buf[3])) >> 2; 1248- int b = ((hex(buf[4]) << 4) | hex(buf[5])) >> 2; 1249+ int r = ((hex(buf[0]) << 4) | hex(buf[1])); 1250+ int g = ((hex(buf[2]) << 4) | hex(buf[3])); 1251+ int b = ((hex(buf[4]) << 4) | hex(buf[5])); 1252 1253 pal[idx] = base; 1254- graphics_set_palette(idx, r, g, b); 1255+ graphics_set_palette(idx, r / 4, g / 4, b / 4); 1256 ++idx; 1257 } 1258 } 1259 1260 x = y = len = 0; 1261 1262+#ifndef __MINIOS__ 1263 s1 = (unsigned char*)VSHADOW1; 1264 s2 = (unsigned char*)VSHADOW2; 1265 s4 = (unsigned char*)VSHADOW4; 1266@@ -432,6 +504,7 @@ 1267 1268 for (i = 0; i < 38400; i++) 1269 s1[i] = s2[i] = s4[i] = s8[i] = 0; 1270+#endif 1271 1272 /* parse xpm data */ 1273 while (y < height) { 1274@@ -451,6 +524,9 @@ 1275 break; 1276 } 1277 1278+#ifdef __MINIOS__ 1279+ VSHADOW[x + y * 640] = palette[i]; 1280+#else 1281 mask = 0x80 >> (x & 7); 1282 if (c & 1) 1283 s1[len + (x >> 3)] |= mask; 1284@@ -460,6 +536,7 @@ 1285 s4[len + (x >> 3)] |= mask; 1286 if (c & 8) 1287 s8[len + (x >> 3)] |= mask; 1288+#endif 1289 1290 if (++x >= 640) { 1291 x = 0; 1292@@ -494,7 +571,13 @@ 1293 } 1294 1295 void graphics_cursor(int set) { 1296- unsigned char *pat, *mem, *ptr, chr[16 << 2]; 1297+ unsigned char *pat; 1298+#ifdef __MINIOS__ 1299+ uint32_t *mem, *ptr, chr[16 * 8]; 1300+ int j; 1301+#else 1302+ unsigned char *mem, *ptr, chr[16 << 2]; 1303+#endif 1304 int i, ch, invert, offset; 1305 1306 if (set && (no_cursor || no_scroll)) 1307@@ -505,71 +588,127 @@ 1308 invert = (text[fonty * 80 + fontx] & 0xff00) != 0; 1309 pat = font8x16 + (ch << 4); 1310 1311- mem = (unsigned char*)VIDEOMEM + offset; 1312+ mem = (unsigned char*)VIDEOMEM + offset 1313+#ifdef __MINIOS__ 1314+ * 8 * 4 1315+#endif 1316+ ; 1317 1318 if (!set) { 1319 for (i = 0; i < 16; i++) { 1320 unsigned char mask = pat[i]; 1321 1322 if (!invert) { 1323+#ifdef __MINIOS__ 1324+ memcpy(chr + i * 8, VSHADOW + offset * 8, 8 * 4); 1325+#else 1326 chr[i ] = ((unsigned char*)VSHADOW1)[offset]; 1327 chr[16 + i] = ((unsigned char*)VSHADOW2)[offset]; 1328 chr[32 + i] = ((unsigned char*)VSHADOW4)[offset]; 1329 chr[48 + i] = ((unsigned char*)VSHADOW8)[offset]; 1330+#endif 1331 1332 if (shade) { 1333 if (ch == DISP_VERT || ch == DISP_LL || 1334 ch == DISP_UR || ch == DISP_LR) { 1335 unsigned char pmask = ~(pat[i] >> 1); 1336 1337+#ifdef __MINIOS__ 1338+ for (j = 0; j < 8; j++) 1339+ if (!(pmask & (1U << j))) 1340+ chr[i * 8 + (7 - j)] = palette[0]; 1341+#else 1342 chr[i ] &= pmask; 1343 chr[16 + i] &= pmask; 1344 chr[32 + i] &= pmask; 1345 chr[48 + i] &= pmask; 1346+#endif 1347 } 1348 if (i > 0 && ch != DISP_VERT) { 1349 unsigned char pmask = ~(pat[i - 1] >> 1); 1350 1351+#ifdef __MINIOS__ 1352+ for (j = 0; j < 8; j++) 1353+ if (!(pmask & (1U << j))) 1354+ chr[i * 8 + (7 - j)] = palette[0]; 1355+#else 1356 chr[i ] &= pmask; 1357 chr[16 + i] &= pmask; 1358 chr[32 + i] &= pmask; 1359 chr[48 + i] &= pmask; 1360+#endif 1361 if (ch == DISP_HORIZ || ch == DISP_UR || ch == DISP_LR) { 1362 pmask = ~pat[i - 1]; 1363 1364+#ifdef __MINIOS__ 1365+ for (j = 0; j < 8; j++) 1366+ if (!(pmask & (1U << j))) 1367+ chr[i * 8 + (7 - j)] = palette[0]; 1368+#else 1369 chr[i ] &= pmask; 1370 chr[16 + i] &= pmask; 1371 chr[32 + i] &= pmask; 1372 chr[48 + i] &= pmask; 1373+#endif 1374 } 1375 } 1376 } 1377+#ifdef __MINIOS__ 1378+ for (j = 0; j < 8; j++) 1379+ if (mask & (1U << j)) 1380+ chr[i * 8 + (7 - j)] = palette[15]; 1381+#else 1382 chr[i ] |= mask; 1383 chr[16 + i] |= mask; 1384 chr[32 + i] |= mask; 1385 chr[48 + i] |= mask; 1386+#endif 1387 1388 offset += 80; 1389 } 1390 else { 1391+#ifdef __MINIOS__ 1392+ for (j = 0; j < 8; j++) 1393+ if (mask & (1U << j)) 1394+ chr[i * 8 + (7 - j)] = palette[15]; 1395+ else 1396+ chr[i * 8 + (7 - j)] = palette[0]; 1397+#else 1398 chr[i ] = mask; 1399 chr[16 + i] = mask; 1400 chr[32 + i] = mask; 1401 chr[48 + i] = mask; 1402+#endif 1403 } 1404 } 1405 } 1406 else { 1407+#ifdef __MINIOS__ 1408+ ptr = mem; 1409+ for (i = 0; i < 16; i++, ptr += 80 * 8) 1410+ for (j = 0; j < 8; j++) { 1411+ if (pat[i] & (1U << (7 - j))) 1412+ cursorBuf32[i * 8 + j] = ptr[j] = palette[0]; 1413+ else 1414+ cursorBuf32[i * 8 + j] = ptr[j] = palette[15]; 1415+ } 1416+#else 1417 MapMask(15); 1418 ptr = mem; 1419 for (i = 0; i < 16; i++, ptr += 80) { 1420 cursorBuf[i] = pat[i]; 1421 *ptr = ~pat[i]; 1422 } 1423+#endif 1424 return; 1425 } 1426 1427 offset = 0; 1428+#ifdef __MINIOS__ 1429+ ptr = mem; 1430+ for (j = 0; j < 16; j++, ptr += 80 * 8) 1431+ memcpy(ptr, chr + j * 8 + offset * 8, 8 * 4); 1432+#else 1433 for (i = 1; i < 16; i <<= 1, offset += 16) { 1434 int j; 1435 1436@@ -580,6 +719,7 @@ 1437 } 1438 1439 MapMask(15); 1440+#endif 1441 } 1442 1443 #endif /* SUPPORT_GRAPHICS */ 1444Index: grub/stage2/graphics.h 1445=================================================================== 1446--- grub.orig/stage2/graphics.h 2008-06-16 15:18:14.527010000 +0100 1447+++ grub/stage2/graphics.h 2008-06-16 15:18:14.805010000 +0100 1448@@ -21,8 +21,10 @@ 1449 #ifndef GRAPHICS_H 1450 #define GRAPHICS_H 1451 1452+#ifndef __MINIOS__ 1453 /* magic constant */ 1454 #define VIDEOMEM 0xA0000 1455+#endif 1456 1457 /* function prototypes */ 1458 char *graphics_get_splash(void); 1459Index: grub/stage2/stage2.c 1460=================================================================== 1461--- grub.orig/stage2/stage2.c 2008-06-17 11:06:47.873523000 +0100 1462+++ grub/stage2/stage2.c 2008-06-17 11:07:05.225628000 +0100 1463@@ -31,10 +31,10 @@ 1464 #if defined(PRESET_MENU_STRING) || defined(SUPPORT_DISKLESS) 1465 1466 # if defined(PRESET_MENU_STRING) 1467-static const char *preset_menu = PRESET_MENU_STRING; 1468+const char *preset_menu = PRESET_MENU_STRING; 1469 # elif defined(SUPPORT_DISKLESS) 1470 /* Execute the command "bootp" automatically. */ 1471-static const char *preset_menu = "bootp\n"; 1472+const char *preset_menu = "bootp\n"; 1473 # endif /* SUPPORT_DISKLESS */ 1474 1475 static int preset_menu_offset; 1476Index: grub/stage2/fsys_xfs.c 1477=================================================================== 1478RCS file: /sources/grub/grub/stage2/fsys_xfs.c,v 1479retrieving revision 1.5 1480diff -u -p -r1.5 fsys_xfs.c 1481--- grub/stage2/fsys_xfs.c 8 May 2005 02:18:14 -0000 1.5 1482+++ grub/stage2/fsys_xfs.c 10 Jul 2008 13:09:50 -0000 1483@@ -101,7 +101,7 @@ static inline __const__ xfs_uint16_t 1484 le16 (xfs_uint16_t x) 1485 { 1486 __asm__("xchgb %b0,%h0" \ 1487- : "=q" (x) \ 1488+ : "=Q" (x) \ 1489 : "0" (x)); \ 1490 return x; 1491 } 1492@@ -109,9 +109,9 @@ le16 (xfs_uint16_t x) 1493 static inline __const__ xfs_uint32_t 1494 le32 (xfs_uint32_t x) 1495 { 1496-#if 0 1497+#if 1 1498 /* 386 doesn't have bswap. */ 1499- __asm__("bswap %0" : "=r" (x) : "0" (x)); 1500+ __asm__("bswapl %k0" : "=r" (x) : "0" (x)); 1501 #else 1502 /* This is slower but this works on all x86 architectures. */ 1503 __asm__("xchgb %b0, %h0" \ 1504--- grub.orig/stage2/gunzip.c 2010-03-07 23:03:34.000000000 +0100 1505+++ grub/stage2/gunzip.c 2010-03-07 23:05:36.000000000 +0100 1506@@ -141,7 +141,7 @@ 1507 static int gzip_filemax; 1508 static int gzip_fsmax; 1509 static int saved_filepos; 1510-static unsigned long gzip_crc; 1511+static unsigned int gzip_crc; 1512 1513 /* internal extra variables for use of inflate code */ 1514 static int block_type; 1515@@ -157,7 +157,7 @@ 1516 * Linear allocator. 1517 */ 1518 1519-static unsigned long linalloc_topaddr; 1520+static unsigned int linalloc_topaddr; 1521 1522 static void * 1523 linalloc (int size) 1524@@ -253,7 +253,7 @@ 1525 1526 typedef unsigned char uch; 1527 typedef unsigned short ush; 1528-typedef unsigned long ulg; 1529+typedef unsigned int ulg; 1530 1531 /* 1532 * Window Size 1533@@ -316,8 +316,8 @@ 1534 return 0; 1535 } 1536 1537- gzip_crc = *((unsigned long *) buf); 1538- gzip_fsmax = gzip_filemax = *((unsigned long *) (buf + 4)); 1539+ gzip_crc = *((unsigned int *) buf); 1540+ gzip_fsmax = gzip_filemax = *((unsigned int *) (buf + 4)); 1541 1542 initialize_tables (); 1543 1544diff -ur grub.orig/stage2/fsys_iso9660.c grub-upstream/stage2/fsys_iso9660.c 1545--- grub.orig/stage2/fsys_iso9660.c 2010-03-07 23:39:00.000000000 +0100 1546+++ grub/stage2/fsys_iso9660.c 2010-03-07 23:39:56.000000000 +0100 1547@@ -43,7 +43,7 @@ 1548 1549 /* iso fs inode data in memory */ 1550 struct iso_inode_info { 1551- unsigned long file_start; 1552+ unsigned int file_start; 1553 }; 1554 1555 #define ISO_SUPER \ 1556@@ -88,12 +88,12 @@ 1557 if (byte_len <= 0) 1558 return 1; 1559 1560- sector += (byte_offset >> sector_size_lg2); 1561- byte_offset &= (buf_geom.sector_size - 1); 1562 asm volatile ("shl%L0 %1,%0" 1563 : "=r"(sector) 1564 : "Ic"((int8_t)(ISO_SECTOR_BITS - sector_size_lg2)), 1565 "0"(sector)); 1566+ sector += (byte_offset >> sector_size_lg2); 1567+ byte_offset &= (buf_geom.sector_size - 1); 1568 1569 #if !defined(STAGE1_5) 1570 if (disk_read_hook && debug) 1571