ia64/xen-unstable

view stubdom/grub.patches/99minios @ 18393:2397555ebcc2

mini-os: Fix build failure with void* arithmetic.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Aug 27 13:31:01 2008 +0100 (2008-08-27)
parents 40b2048bd809
children
line source
1 Index: 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 */
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
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 }
34 +#ifndef __MINIOS__
35 #ifdef SUPPORT_NETBOOT
36 /* Shut down the networking. */
37 cleanup_net ();
38 #endif
39 +#endif
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;
56 +#endif
57 default:
58 errnum = ERR_BOOT_COMMAND;
59 return 1;
60 @@ -1123,6 +1136,7 @@
61 };
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
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
86 /* dump FROM TO */
87 @@ -1280,6 +1297,7 @@
88 #endif /* GRUB_UTIL */
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
102 /* fallback */
103 @@ -1956,6 +1975,7 @@
104 #endif /* SUPPORT_NETBOOT */
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
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 };
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
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
152 /* print */
153 static int
154 @@ -3776,6 +3802,7 @@
155 };
158 +#ifndef __MINIOS__
159 #ifdef SUPPORT_SERIAL
160 /* serial */
161 static int
162 @@ -3927,8 +3954,10 @@
163 " default values are COM1, 9600, 8N1."
164 };
165 #endif /* SUPPORT_SERIAL */
166 +#endif
169 +#ifndef __MINIOS__
170 /* setkey */
171 struct keysym
172 {
173 @@ -4174,8 +4203,10 @@
174 " is a digit), and delete. If no argument is specified, reset key"
175 " mappings."
176 };
177 +#endif
180 +#ifndef __MINIOS__
181 /* setup */
182 static int
183 setup_func (char *arg, int flags)
184 @@ -4484,6 +4515,7 @@
185 " partition where GRUB images reside, specify the option `--stage2'"
186 " to tell GRUB the file name under your OS."
187 };
188 +#endif
191 #if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS)
192 @@ -4788,6 +4820,7 @@
193 #endif /* SUPPORT_SERIAL */
196 +#ifndef __MINIOS__
197 /* testload */
198 static int
199 testload_func (char *arg, int flags)
200 @@ -4874,8 +4907,10 @@
201 " consistent offset error. If this test succeeds, then a good next"
202 " step is to try loading a kernel."
203 };
204 +#endif
207 +#ifndef __MINIOS__
208 /* testvbe MODE */
209 static int
210 testvbe_func (char *arg, int flags)
211 @@ -4979,6 +5014,7 @@
212 "testvbe MODE",
213 "Test the VBE mode MODE. Hit any key to return."
214 };
215 +#endif
218 #ifdef SUPPORT_NETBOOT
219 @@ -5075,6 +5111,7 @@
220 };
223 +#ifndef __MINIOS__
224 /* uppermem */
225 static int
226 uppermem_func (char *arg, int flags)
227 @@ -5095,8 +5132,10 @@
228 "Force GRUB to assume that only KBYTES kilobytes of upper memory are"
229 " installed. Any system address range maps are discarded."
230 };
231 +#endif
234 +#ifndef __MINIOS__
235 /* vbeprobe */
236 static int
237 vbeprobe_func (char *arg, int flags)
238 @@ -5203,6 +5242,7 @@
239 "Probe VBE information. If the mode number MODE is specified, show only"
240 " the information about only the mode."
241 };
242 +#endif
245 /* The table of builtin commands. Sorted in dictionary order. */
246 @@ -5233,12 +5273,16 @@
247 #ifdef SUPPORT_NETBOOT
248 &builtin_dhcp,
249 #endif /* SUPPORT_NETBOOT */
250 +#ifndef __MINIOS__
251 &builtin_displayapm,
252 &builtin_displaymem,
253 +#endif
254 #ifdef GRUB_UTIL
255 &builtin_dump,
256 #endif /* GRUB_UTIL */
257 +#ifndef __MINIOS__
258 &builtin_embed,
259 +#endif
260 &builtin_fallback,
261 &builtin_find,
262 #ifdef SUPPORT_GRAPHICS
263 @@ -5253,10 +5297,14 @@
264 #ifdef SUPPORT_NETBOOT
265 &builtin_ifconfig,
266 #endif /* SUPPORT_NETBOOT */
267 +#ifndef __MINIOS__
268 &builtin_impsprobe,
269 +#endif
270 &builtin_initrd,
271 +#ifndef __MINIOS__
272 &builtin_install,
273 &builtin_ioprobe,
274 +#endif
275 &builtin_kernel,
276 &builtin_lock,
277 &builtin_makeactive,
278 @@ -5283,11 +5331,13 @@
279 &builtin_root,
280 &builtin_rootnoverify,
281 &builtin_savedefault,
282 +#ifndef __MINIOS__
283 #ifdef SUPPORT_SERIAL
284 &builtin_serial,
285 #endif /* SUPPORT_SERIAL */
286 &builtin_setkey,
287 &builtin_setup,
288 +#endif
289 #ifdef SUPPORT_GRAPHICS
290 &builtin_shade,
291 &builtin_splashimage,
292 @@ -5298,16 +5348,20 @@
293 #ifdef SUPPORT_SERIAL
294 &builtin_terminfo,
295 #endif /* SUPPORT_SERIAL */
296 +#ifndef __MINIOS__
297 &builtin_testload,
298 &builtin_testvbe,
299 +#endif
300 #ifdef SUPPORT_NETBOOT
301 &builtin_tftpserver,
302 #endif /* SUPPORT_NETBOOT */
303 &builtin_timeout,
304 &builtin_title,
305 &builtin_unhide,
306 +#ifndef __MINIOS__
307 &builtin_uppermem,
308 &builtin_vbeprobe,
309 +#endif
310 #ifdef SUPPORT_GRAPHICS
311 &builtin_viewport,
312 #endif
313 Index: grub/stage2/char_io.c
314 ===================================================================
315 --- grub.orig/stage2/char_io.c 2008-06-16 15:18:14.516009000 +0100
316 +++ grub/stage2/char_io.c 2008-06-16 15:18:14.726009000 +0100
317 @@ -20,6 +20,7 @@
319 #include <shared.h>
320 #include <term.h>
321 +#include <stdarg.h>
323 #ifdef SUPPORT_HERCULES
324 # include <hercules.h>
325 @@ -36,6 +37,7 @@
326 #ifndef STAGE1_5
327 struct term_entry term_table[] =
328 {
329 +#ifdef SUPPORT_CONSOLE
330 {
331 "console",
332 0,
333 @@ -52,6 +54,7 @@
334 0,
335 0
336 },
337 +#endif
338 #ifdef SUPPORT_SERIAL
339 {
340 "serial",
341 @@ -131,9 +134,9 @@
342 }
344 char *
345 -convert_to_ascii (char *buf, int c,...)
346 +convert_to_ascii (char *buf, int c, int _num)
347 {
348 - unsigned long num = *((&c) + 1), mult = 10;
349 + unsigned long num = _num, mult = 10;
350 char *ptr = buf;
352 #ifndef STAGE1_5
353 @@ -182,11 +185,11 @@
354 void
355 grub_printf (const char *format,...)
356 {
357 - int *dataptr = (int *) &format;
358 + va_list ap;
359 char c, str[16];
360 -
361 - dataptr++;
363 + va_start(ap, format);
364 +
365 while ((c = *(format++)) != 0)
366 {
367 if (c != '%')
368 @@ -200,21 +203,32 @@
369 case 'X':
370 #endif
371 case 'u':
372 - *convert_to_ascii (str, c, *((unsigned long *) dataptr++)) = 0;
373 + {
374 + unsigned i = va_arg(ap, unsigned);
375 + *convert_to_ascii (str, c, i) = 0;
376 grub_putstr (str);
377 break;
378 + }
380 #ifndef STAGE1_5
381 case 'c':
382 - grub_putchar ((*(dataptr++)) & 0xff);
383 + {
384 + int c = va_arg(ap, int);
385 + grub_putchar (c & 0xff);
386 break;
387 + }
389 case 's':
390 - grub_putstr ((char *) *(dataptr++));
391 + {
392 + char *s = va_arg(ap, char*);
393 + grub_putstr (s);
394 break;
395 + }
396 #endif
397 }
398 }
399 +
400 + va_end(ap);
401 }
403 #ifndef STAGE1_5
404 @@ -223,11 +237,11 @@
405 {
406 /* XXX hohmuth
407 ugly hack -- should unify with printf() */
408 - int *dataptr = (int *) &format;
409 + va_list ap;
410 char c, *ptr, str[16];
411 char *bp = buffer;
413 - dataptr++;
414 + va_start(ap, format);
416 while ((c = *format++) != 0)
417 {
418 @@ -237,20 +251,27 @@
419 switch (c = *(format++))
420 {
421 case 'd': case 'u': case 'x':
422 - *convert_to_ascii (str, c, *((unsigned long *) dataptr++)) = 0;
423 + {
424 + unsigned i = va_arg(ap, unsigned);
425 + *convert_to_ascii (str, c, i) = 0;
427 ptr = str;
429 while (*ptr)
430 *bp++ = *(ptr++); /* putchar(*(ptr++)); */
431 break;
432 + }
434 - case 'c': *bp++ = (*(dataptr++))&0xff;
435 + case 'c':
436 + {
437 + int c = va_arg(ap, int);
438 + *bp++ = c&0xff;
439 /* putchar((*(dataptr++))&0xff); */
440 break;
441 + }
443 case 's':
444 - ptr = (char *) (*(dataptr++));
445 + ptr = va_arg(ap, char *);
447 while ((c = *ptr++) != 0)
448 *bp++ = c; /* putchar(c); */
449 @@ -258,6 +279,8 @@
450 }
451 }
453 + va_end(ap);
454 +
455 *bp = 0;
456 return bp - buffer;
457 }
458 @@ -1263,12 +1286,14 @@
459 return ! errnum;
460 #endif /* GRUB_UTIL */
462 +#ifndef __MINIOS__
463 if ((addr < RAW_ADDR (0x1000))
464 || (addr < RAW_ADDR (0x100000)
465 && RAW_ADDR (mbi.mem_lower * 1024) < (addr + len))
466 || (addr >= RAW_ADDR (0x100000)
467 && RAW_ADDR (mbi.mem_upper * 1024) < ((addr - 0x100000) + len)))
468 errnum = ERR_WONT_FIT;
469 +#endif
471 return ! errnum;
472 }
473 @@ -1342,7 +1367,7 @@
474 }
475 #endif /* ! STAGE1_5 */
477 -#ifndef GRUB_UTIL
478 +#if !defined(GRUB_UTIL) && !defined(__MINIOS__)
479 # undef memcpy
480 /* GCC emits references to memcpy() for struct copies etc. */
481 void *memcpy (void *dest, const void *src, int n) __attribute__ ((alias ("grub_memmove")));
482 Index: grub/stage2/disk_io.c
483 ===================================================================
484 --- grub.orig/stage2/disk_io.c 2008-06-16 15:18:03.327932000 +0100
485 +++ grub/stage2/disk_io.c 2008-06-16 15:18:14.733009000 +0100
486 @@ -130,7 +130,14 @@
487 static inline unsigned long
488 log2 (unsigned long word)
489 {
490 - asm volatile ("bsfl %1,%0"
491 + asm volatile ("bsf"
492 +#ifdef __i386__
493 + "l"
494 +#endif
495 +#ifdef __x86_64__
496 + "q"
497 +#endif
498 + " %1,%0"
499 : "=r" (word)
500 : "r" (word));
501 return word;
502 Index: grub/stage2/fsys_fat.c
503 ===================================================================
504 --- grub.orig/stage2/fsys_fat.c 2008-06-16 15:18:03.337934000 +0100
505 +++ grub/stage2/fsys_fat.c 2008-06-16 15:18:14.737009000 +0100
506 @@ -57,7 +57,14 @@
507 static __inline__ unsigned long
508 log2 (unsigned long word)
509 {
510 - __asm__ ("bsfl %1,%0"
511 + __asm__ ("bsf"
512 +#ifdef __i386__
513 + "l"
514 +#endif
515 +#ifdef __x86_64__
516 + "q"
517 +#endif
518 + " %1,%0"
519 : "=r" (word)
520 : "r" (word));
521 return word;
522 Index: grub/stage2/pc_slice.h
523 ===================================================================
524 --- grub.orig/stage2/pc_slice.h 2008-06-16 15:18:03.347932000 +0100
525 +++ grub/stage2/pc_slice.h 2008-06-16 15:18:14.746009000 +0100
526 @@ -38,50 +38,50 @@
527 */
529 #define PC_MBR_CHECK_SIG(mbr_ptr) \
530 - ( *( (unsigned short *) (((int) mbr_ptr) + PC_MBR_SIG_OFFSET) ) \
531 + ( *( (unsigned short *) (((long) mbr_ptr) + PC_MBR_SIG_OFFSET) ) \
532 == PC_MBR_SIGNATURE )
534 #define PC_MBR_SIG(mbr_ptr) \
535 - ( *( (unsigned short *) (((int) mbr_ptr) + PC_MBR_SIG_OFFSET) ) )
536 + ( *( (unsigned short *) (((long) mbr_ptr) + PC_MBR_SIG_OFFSET) ) )
538 #define PC_SLICE_FLAG(mbr_ptr, part) \
539 - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET \
540 + ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET \
541 + (part << 4)) ) )
543 #define PC_SLICE_HEAD(mbr_ptr, part) \
544 - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 1 \
545 + ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 1 \
546 + (part << 4)) ) )
548 #define PC_SLICE_SEC(mbr_ptr, part) \
549 - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 2 \
550 + ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 2 \
551 + (part << 4)) ) )
553 #define PC_SLICE_CYL(mbr_ptr, part) \
554 - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 3 \
555 + ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 3 \
556 + (part << 4)) ) )
558 #define PC_SLICE_TYPE(mbr_ptr, part) \
559 - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 4 \
560 + ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 4 \
561 + (part << 4)) ) )
563 #define PC_SLICE_EHEAD(mbr_ptr, part) \
564 - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 5 \
565 + ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 5 \
566 + (part << 4)) ) )
568 #define PC_SLICE_ESEC(mbr_ptr, part) \
569 - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 6 \
570 + ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 6 \
571 + (part << 4)) ) )
573 #define PC_SLICE_ECYL(mbr_ptr, part) \
574 - ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 7 \
575 + ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 7 \
576 + (part << 4)) ) )
578 #define PC_SLICE_START(mbr_ptr, part) \
579 - ( *( (unsigned long *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 8 \
580 + ( *( (unsigned long *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 8 \
581 + (part << 4)) ) )
583 #define PC_SLICE_LENGTH(mbr_ptr, part) \
584 - ( *( (unsigned long *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 12 \
585 + ( *( (unsigned long *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 12 \
586 + (part << 4)) ) )
589 Index: grub/stage2/shared.h
590 ===================================================================
591 --- grub.orig/stage2/shared.h 2008-06-16 15:18:14.537009000 +0100
592 +++ grub/stage2/shared.h 2008-06-17 14:25:08.443906000 +0100
593 @@ -39,6 +39,10 @@
594 extern char *grub_scratch_mem;
595 # define RAW_ADDR(x) ((x) + (int) grub_scratch_mem)
596 # define RAW_SEG(x) (RAW_ADDR ((x) << 4) >> 4)
597 +#elif defined(__MINIOS__)
598 +extern char grub_scratch_mem[];
599 +# define RAW_ADDR(x) ((x) + (int) grub_scratch_mem)
600 +# define RAW_SEG(x) (RAW_ADDR ((x) << 4) >> 4)
601 #else
602 # define RAW_ADDR(x) (x)
603 # define RAW_SEG(x) (x)
604 @@ -707,7 +711,9 @@
606 /* Halt the system, using APM if possible. If NO_APM is true, don't use
607 APM even if it is available. */
608 +#ifndef __MINIOS__
609 void grub_halt (int no_apm) __attribute__ ((noreturn));
610 +#endif
612 /* Copy MAP to the drive map and set up int13_handler. */
613 void set_int13_handler (unsigned short *map);
614 @@ -857,7 +863,8 @@
615 KERNEL_TYPE_BIG_LINUX, /* Big Linux. */
616 KERNEL_TYPE_FREEBSD, /* FreeBSD. */
617 KERNEL_TYPE_NETBSD, /* NetBSD. */
618 - KERNEL_TYPE_CHAINLOADER /* Chainloader. */
619 + KERNEL_TYPE_CHAINLOADER, /* Chainloader. */
620 + KERNEL_TYPE_PV /* Paravirtualized. */
621 }
622 kernel_t;
624 @@ -890,7 +897,7 @@
625 int grub_strlen (const char *str);
626 char *grub_strcpy (char *dest, const char *src);
628 -#ifndef GRUB_UTIL
629 +#if !defined(GRUB_UTIL) && !defined(__MINIOS__)
630 typedef unsigned long grub_jmp_buf[6];
631 #else
632 /* In the grub shell, use the libc jmp_buf instead. */
633 @@ -898,7 +905,7 @@
634 # define grub_jmp_buf jmp_buf
635 #endif
637 -#ifdef GRUB_UTIL
638 +#if defined(GRUB_UTIL) || defined(__MINIOS__)
639 # define grub_setjmp setjmp
640 # define grub_longjmp longjmp
641 #else /* ! GRUB_UTIL */
642 @@ -914,7 +921,7 @@
643 /* misc */
644 void init_page (void);
645 void print_error (void);
646 -char *convert_to_ascii (char *buf, int c, ...);
647 +char *convert_to_ascii (char *buf, int c, int num);
648 int get_cmdline (char *prompt, char *cmdline, int maxlen,
649 int echo_char, int history);
650 int substring (const char *s1, const char *s2);
651 Index: grub/netboot/etherboot.h
652 ===================================================================
653 --- grub.orig/netboot/etherboot.h 2008-06-16 15:18:03.446934000 +0100
654 +++ grub/netboot/etherboot.h 2008-06-16 15:18:14.760009000 +0100
655 @@ -246,7 +246,7 @@
657 typedef struct
658 {
659 - unsigned long s_addr;
660 + unsigned int s_addr;
661 }
662 in_addr;
664 @@ -302,7 +302,7 @@
665 char bp_htype;
666 char bp_hlen;
667 char bp_hops;
668 - unsigned long bp_xid;
669 + unsigned int bp_xid;
670 unsigned short bp_secs;
671 unsigned short unused;
672 in_addr bp_ciaddr;
673 @@ -411,25 +411,25 @@
675 struct
676 {
677 - long id;
678 - long type;
679 - long rpcvers;
680 - long prog;
681 - long vers;
682 - long proc;
683 - long data[1];
684 + int id;
685 + int type;
686 + int rpcvers;
687 + int prog;
688 + int vers;
689 + int proc;
690 + int data[1];
691 }
692 call;
694 struct
695 {
696 - long id;
697 - long type;
698 - long rstatus;
699 - long verifier;
700 - long v2;
701 - long astatus;
702 - long data[1];
703 + int id;
704 + int type;
705 + int rstatus;
706 + int verifier;
707 + int v2;
708 + int astatus;
709 + int data[1];
710 }
711 reply;
712 }
713 @@ -517,7 +517,9 @@
715 /* misc.c */
716 extern void twiddle (void);
717 +#ifndef __MINIOS__
718 extern void sleep (int secs);
719 +#endif
720 extern int getdec (char **s);
721 extern void etherboot_printf (const char *, ...);
722 extern int etherboot_sprintf (char *, const char *, ...);
723 Index: grub/stage2/common.c
724 ===================================================================
725 --- grub.orig/stage2/common.c 2008-06-16 15:18:03.366934000 +0100
726 +++ grub/stage2/common.c 2008-06-16 15:18:14.764009000 +0100
727 @@ -137,6 +137,7 @@
728 }
729 #endif /* ! STAGE1_5 */
731 +#ifndef __MINIOS__
732 /* This queries for BIOS information. */
733 void
734 init_bios_info (void)
735 @@ -335,3 +336,4 @@
736 /* Start main routine here. */
737 cmain ();
738 }
739 +#endif
740 Index: grub/stage2/serial.c
741 ===================================================================
742 --- grub.orig/stage2/serial.c 2008-06-16 15:18:03.376934000 +0100
743 +++ grub/stage2/serial.c 2008-06-16 15:18:14.769009000 +0100
744 @@ -37,7 +37,7 @@
746 /* Hardware-dependent definitions. */
748 -#ifndef GRUB_UTIL
749 +#if !defined(GRUB_UTIL) && !defined(__MINIOS__)
750 /* The structure for speed vs. divisor. */
751 struct divisor
752 {
753 @@ -222,6 +222,8 @@
754 {('3' | ('~' << 8)), 4},
755 {('5' | ('~' << 8)), 7},
756 {('6' | ('~' << 8)), 3},
757 + {('7' | ('~' << 8)), 1},
758 + {('8' | ('~' << 8)), 5},
759 };
761 /* The buffer must start with ``ESC [''. */
762 Index: grub/stage2/tparm.c
763 ===================================================================
764 --- grub.orig/stage2/tparm.c 2008-06-16 15:18:03.390933000 +0100
765 +++ grub/stage2/tparm.c 2008-06-16 15:18:14.774010000 +0100
766 @@ -48,6 +48,7 @@
767 #include "shared.h"
769 #include "tparm.h"
770 +#include <stdarg.h>
772 /*
773 * Common/troublesome character definitions
774 @@ -320,7 +321,7 @@
775 #define isLOWER(c) ((c) >= 'a' && (c) <= 'z')
777 static inline char *
778 -tparam_internal(const char *string, int *dataptr)
779 +tparam_internal(const char *string, va_list ap)
780 {
781 #define NUM_VARS 26
782 char *p_is_s[9];
783 @@ -461,9 +462,9 @@
784 * a char* and an int may not be the same size on the stack.
785 */
786 if (p_is_s[i] != 0) {
787 - p_is_s[i] = (char *)(*(dataptr++));
788 + p_is_s[i] = va_arg(ap, char *);
789 } else {
790 - param[i] = (int)(*(dataptr++));
791 + param[i] = va_arg(ap, int);
792 }
793 }
795 @@ -716,11 +717,13 @@
796 grub_tparm(const char *string,...)
797 {
798 char *result;
799 - int *dataptr = (int *) &string;
800 + va_list ap;
802 - dataptr++;
803 + va_start(ap, string);
805 - result = tparam_internal(string, dataptr);
806 + result = tparam_internal(string, ap);
807 +
808 + va_end(ap);
810 return result;
811 }
812 Index: grub/stage2/fsys_iso9660.c
813 ===================================================================
814 --- grub.orig/stage2/fsys_iso9660.c 2008-06-16 15:18:03.400933000 +0100
815 +++ grub/stage2/fsys_iso9660.c 2008-06-16 15:18:14.779009000 +0100
816 @@ -59,7 +59,14 @@
817 static inline unsigned long
818 log2 (unsigned long word)
819 {
820 - asm volatile ("bsfl %1,%0"
821 + asm volatile ("bsf"
822 +#ifdef __i386__
823 + "l"
824 +#endif
825 +#ifdef __x86_64__
826 + "q"
827 +#endif
828 + " %1,%0"
829 : "=r" (word)
830 : "r" (word));
831 return word;
832 Index: grub/stage2/fsys_reiserfs.c
833 ===================================================================
834 --- grub.orig/stage2/fsys_reiserfs.c 2008-06-16 15:18:03.410933000 +0100
835 +++ grub/stage2/fsys_reiserfs.c 2008-06-20 18:33:52.002100000 +0100
836 @@ -224,8 +224,8 @@
838 struct disk_child
839 {
840 - unsigned long dc_block_number; /* Disk child's block number. */
841 - unsigned short dc_size; /* Disk child's used space. */
842 + __u32 dc_block_number; /* Disk child's block number. */
843 + __u16 dc_size; /* Disk child's used space. */
844 };
846 #define DC_SIZE (sizeof (struct disk_child))
847 @@ -369,7 +369,14 @@
848 static __inline__ unsigned long
849 log2 (unsigned long word)
850 {
851 - __asm__ ("bsfl %1,%0"
852 + __asm__ ("bsf"
853 +#ifdef __i386__
854 + "l"
855 +#endif
856 +#ifdef __x86_64__
857 + "q"
858 +#endif
859 + " %1,%0"
860 : "=r" (word)
861 : "r" (word));
862 return word;
863 Index: grub/netboot/misc.c
864 ===================================================================
865 --- grub.orig/netboot/misc.c 2008-06-16 15:18:03.456934000 +0100
866 +++ grub/netboot/misc.c 2008-06-16 15:18:14.790009000 +0100
867 @@ -21,7 +21,9 @@
869 #define GRUB 1
870 #include <etherboot.h>
871 +#include <stdarg.h>
873 +#ifndef __MINIOS__
874 void
875 sleep (int secs)
876 {
877 @@ -30,6 +32,7 @@
878 while (currticks () < tmo)
879 ;
880 }
881 +#endif
883 void
884 twiddle (void)
885 @@ -71,7 +74,7 @@
886 Note: width specification not supported
887 **************************************************************************/
888 static int
889 -etherboot_vsprintf (char *buf, const char *fmt, const int *dp)
890 +etherboot_vsprintf (char *buf, const char *fmt, va_list ap)
891 {
892 char *p, *s;
894 @@ -86,7 +89,7 @@
896 if (*++fmt == 's')
897 {
898 - for (p = (char *) *dp++; *p != '\0'; p++)
899 + for (p = va_arg(ap, char *); *p != '\0'; p++)
900 buf ? *s++ = *p : grub_putchar (*p);
901 }
902 else
903 @@ -121,11 +124,9 @@
904 if ((*fmt | 0x20) == 'x')
905 {
906 /* With x86 gcc, sizeof(long) == sizeof(int) */
907 - const long *lp = (const long *) dp;
908 - long h = *lp++;
909 + long h = va_arg(ap, int);
910 int ncase = (*fmt & 0x20);
912 - dp = (const int *) lp;
913 if (alt)
914 {
915 *q++ = '0';
916 @@ -136,7 +137,7 @@
917 }
918 else if (*fmt == 'd')
919 {
920 - int i = *dp++;
921 + int i = va_arg(ap, int);
922 char *r;
924 if (i < 0)
925 @@ -171,10 +172,8 @@
926 unsigned char c[4];
927 }
928 u;
929 - const long *lp = (const long *) dp;
931 - u.l = *lp++;
932 - dp = (const int *) lp;
933 + u.l = va_arg(ap, int);
935 for (r = &u.c[0]; r < &u.c[4]; ++r)
936 q += etherboot_sprintf (q, "%d.", *r);
937 @@ -184,7 +183,7 @@
938 else if (*fmt == '!')
939 {
940 char *r;
941 - p = (char *) *dp++;
942 + p = va_arg(ap, char *);
944 for (r = p + ETH_ALEN; p < r; ++p)
945 q += etherboot_sprintf (q, "%hhX:", *p);
946 @@ -192,7 +191,7 @@
947 --q;
948 }
949 else if (*fmt == 'c')
950 - *q++ = *dp++;
951 + *q++ = va_arg(ap, int);
952 else
953 *q++ = *fmt;
955 @@ -211,13 +210,21 @@
956 int
957 etherboot_sprintf (char *buf, const char *fmt, ...)
958 {
959 - return etherboot_vsprintf (buf, fmt, ((const int *) &fmt) + 1);
960 + va_list ap;
961 + int ret;
962 + va_start(ap, fmt);
963 + ret = etherboot_vsprintf (buf, fmt, ap);
964 + va_end(ap);
965 + return ret;
966 }
968 void
969 etherboot_printf (const char *fmt, ...)
970 {
971 - (void) etherboot_vsprintf (0, fmt, ((const int *) &fmt) + 1);
972 + va_list ap;
973 + va_start(ap, fmt);
974 + etherboot_vsprintf (0, fmt, ap);
975 + va_end(ap);
976 }
978 int
979 Index: grub/netboot/main.c
980 ===================================================================
981 --- grub.orig/netboot/main.c 2008-06-16 15:18:03.470932000 +0100
982 +++ grub/netboot/main.c 2008-06-16 15:18:14.797009000 +0100
983 @@ -55,7 +55,7 @@
984 static int vendorext_isvalid;
985 static unsigned long netmask;
986 static struct bootpd_t bootp_data;
987 -static unsigned long xid;
988 +static unsigned int xid;
990 #define BOOTP_DATA_ADDR (&bootp_data)
992 @@ -778,7 +778,7 @@
994 arpreply = (struct arprequest *) &nic.packet[ETH_HLEN];
996 - if (arpreply->opcode == htons (ARP_REPLY)
997 + if (arpreply->opcode == htons (ARP_REPLY) && ptr
998 && ! grub_memcmp (arpreply->sipaddr, ptr, sizeof (in_addr))
999 && type == AWAIT_ARP)
1001 @@ -827,7 +827,7 @@
1003 arpreply = (struct arprequest *) &nic.packet[ETH_HLEN];
1005 - if (arpreply->opcode == htons (RARP_REPLY)
1006 + if (arpreply->opcode == htons (RARP_REPLY) && ptr
1007 && ! grub_memcmp (arpreply->thwaddr, ptr, ETH_ALEN))
1009 grub_memmove ((char *) arptable[ARP_SERVER].node,
1010 @@ -1135,7 +1135,7 @@
1011 long
1012 rfc2131_sleep_interval (int base, int exp)
1014 - static long seed = 0;
1015 + static unsigned seed = 0;
1016 long q;
1017 unsigned long tmo;
1019 Index: grub/stage2/graphics.c
1020 ===================================================================
1021 --- grub.orig/stage2/graphics.c 2008-06-16 15:18:14.524009000 +0100
1022 +++ grub/stage2/graphics.c 2008-06-17 14:29:05.204328000 +0100
1023 @@ -30,7 +30,29 @@
1024 #include <shared.h>
1025 #include <graphics.h>
1027 +#ifdef __MINIOS__
1028 +#include <stdint.h>
1029 +typedef uint8_t Bit8u;
1030 +#include <vgafonts.h>
1031 +#include <fbfront.h>
1032 +#include <malloc.h>
1033 +#define set_int1c_handler() (void)0
1034 +#define unset_int1c_handler() (void)0
1035 +static uint32_t *VIDEOMEM;
1036 +static struct fbfront_dev *fb_dev;
1037 +static uint32_t palette[17];
1038 +short cursorX, cursorY;
1039 +/* TODO: blink */
1040 +uint32_t cursorBuf32[16*8];
1041 +#define WIDTH 640
1042 +#define HEIGHT 480
1043 +#define DEPTH 32
1044 +#define RAMSIZE (WIDTH * HEIGHT * (DEPTH / 8))
1045 +#else
1046 +#define fbfront_update(dev, x, y, w, h) (void)0
1047 int saved_videomode;
1048 +#endif
1050 unsigned char *font8x16;
1052 int graphics_inited = 0;
1053 @@ -38,11 +60,15 @@
1055 int shade = 1, no_cursor = 0;
1057 +#ifdef __MINIOS__
1058 +uint32_t VSHADOW[RAMSIZE];
1059 +#else
1060 #define VSHADOW VSHADOW1
1061 unsigned char VSHADOW1[38400];
1062 unsigned char VSHADOW2[38400];
1063 unsigned char VSHADOW4[38400];
1064 unsigned char VSHADOW8[38400];
1065 +#endif
1067 /* define the default viewable area */
1068 int view_x0 = 0;
1069 @@ -129,6 +155,8 @@
1070 count_lines = k;
1072 no_scroll = 0;
1074 + fbfront_update(fb_dev, view_x0 * 8, view_y0 * 16, (view_x1 - view_x0) * 8, (view_y1 - view_y0) * 16);
1077 /* Set the splash image */
1078 @@ -154,17 +182,29 @@
1079 int graphics_init()
1081 if (!graphics_inited) {
1082 +#ifdef __MINIOS__
1083 + VIDEOMEM = memalign(PAGE_SIZE, RAMSIZE);
1084 + if (!(fb_dev = fb_open(VIDEOMEM, WIDTH, HEIGHT, DEPTH))) {
1085 + free(VIDEOMEM);
1086 + return 0;
1087 + }
1088 +#else
1089 saved_videomode = set_videomode(0x12);
1090 if (get_videomode() != 0x12) {
1091 set_videomode(saved_videomode);
1092 return 0;
1094 +#endif
1095 graphics_inited = 1;
1097 else
1098 return 1;
1100 +#ifdef __MINIOS__
1101 + font8x16 = vgafont16;
1102 +#else
1103 font8x16 = (unsigned char*)graphics_get_font();
1104 +#endif
1106 /* make sure that the highlight color is set correctly */
1107 graphics_highlight_color = ((graphics_normal_color >> 4) |
1108 @@ -176,7 +216,11 @@
1109 grub_printf("Failed to read splash image (%s)\n", splashimage);
1110 grub_printf("Press any key to continue...");
1111 getkey();
1112 +#ifdef __MINIOS__
1113 + fb_close();
1114 +#else
1115 set_videomode(saved_videomode);
1116 +#endif
1117 graphics_inited = 0;
1118 return 0;
1120 @@ -190,8 +234,13 @@
1121 void graphics_end(void)
1123 if (graphics_inited) {
1124 +#ifdef __MINIOS__
1125 + fb_close();
1126 + free(VIDEOMEM);
1127 +#else
1128 unset_int1c_handler();
1129 set_videomode(saved_videomode);
1130 +#endif
1131 graphics_inited = 0;
1132 no_cursor = 0;
1134 @@ -204,15 +253,19 @@
1135 graphics_cursor(0);
1137 if (ch == '\n') {
1138 + fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
1139 if (fonty + 1 < view_y1)
1140 graphics_setxy(fontx, fonty + 1);
1141 else
1142 graphics_scroll();
1143 graphics_cursor(1);
1144 + fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
1145 return;
1146 } else if (ch == '\r') {
1147 + fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
1148 graphics_setxy(view_x0, fonty);
1149 graphics_cursor(1);
1150 + fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
1151 return;
1154 @@ -224,6 +277,7 @@
1155 text[fonty * 80 + fontx] |= 0x100;
1157 graphics_cursor(0);
1158 + fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
1160 if ((fontx + 1) >= view_x1) {
1161 graphics_setxy(view_x0, fonty);
1162 @@ -232,13 +286,16 @@
1163 else
1164 graphics_scroll();
1165 graphics_cursor(1);
1166 + fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
1167 do_more ();
1168 graphics_cursor(0);
1169 + fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
1170 } else {
1171 graphics_setxy(fontx + 1, fonty);
1174 graphics_cursor(1);
1175 + fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
1178 /* get the current location of the cursor */
1179 @@ -248,10 +305,12 @@
1181 void graphics_gotoxy(int x, int y) {
1182 graphics_cursor(0);
1183 + fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
1185 graphics_setxy(x, y);
1187 graphics_cursor(1);
1188 + fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
1191 void graphics_cls(void) {
1192 @@ -262,15 +321,21 @@
1193 graphics_gotoxy(view_x0, view_y0);
1195 mem = (unsigned char*)VIDEOMEM;
1196 +#ifndef __MINIOS__
1197 s1 = (unsigned char*)VSHADOW1;
1198 s2 = (unsigned char*)VSHADOW2;
1199 s4 = (unsigned char*)VSHADOW4;
1200 s8 = (unsigned char*)VSHADOW8;
1201 +#endif
1203 for (i = 0; i < 80 * 30; i++)
1204 text[i] = ' ';
1205 graphics_cursor(1);
1207 +#ifdef __MINIOS__
1208 + memcpy(mem, VSHADOW, RAMSIZE);
1209 + fbfront_update(fb_dev, 0, 0, 640, 480);
1210 +#else
1211 BitMask(0xff);
1213 /* plane 1 */
1214 @@ -290,6 +355,7 @@
1215 grub_memcpy(mem, s8, 38400);
1217 MapMask(15);
1218 +#endif
1220 if (no_cursor) {
1221 no_cursor = 0;
1222 @@ -337,6 +403,11 @@
1223 return 0;
1226 +void graphics_set_palette(int idx, int red, int green, int blue)
1227 +{
1228 + palette[idx] = (red << (16 + 2)) | (green << (8 + 2)) | (blue << 2);
1229 +}
1231 /* Read in the splashscreen image and set the palette up appropriately.
1232 * Format of splashscreen is an xpm (can be gzipped) with 16 colors and
1233 * 640x480. */
1234 @@ -413,18 +484,19 @@
1237 if (len == 6 && idx < 15) {
1238 - int r = ((hex(buf[0]) << 4) | hex(buf[1])) >> 2;
1239 - int g = ((hex(buf[2]) << 4) | hex(buf[3])) >> 2;
1240 - int b = ((hex(buf[4]) << 4) | hex(buf[5])) >> 2;
1241 + int r = ((hex(buf[0]) << 4) | hex(buf[1]));
1242 + int g = ((hex(buf[2]) << 4) | hex(buf[3]));
1243 + int b = ((hex(buf[4]) << 4) | hex(buf[5]));
1245 pal[idx] = base;
1246 - graphics_set_palette(idx, r, g, b);
1247 + graphics_set_palette(idx, r / 4, g / 4, b / 4);
1248 ++idx;
1252 x = y = len = 0;
1254 +#ifndef __MINIOS__
1255 s1 = (unsigned char*)VSHADOW1;
1256 s2 = (unsigned char*)VSHADOW2;
1257 s4 = (unsigned char*)VSHADOW4;
1258 @@ -432,6 +504,7 @@
1260 for (i = 0; i < 38400; i++)
1261 s1[i] = s2[i] = s4[i] = s8[i] = 0;
1262 +#endif
1264 /* parse xpm data */
1265 while (y < height) {
1266 @@ -451,6 +524,9 @@
1267 break;
1270 +#ifdef __MINIOS__
1271 + VSHADOW[x + y * 640] = palette[i];
1272 +#else
1273 mask = 0x80 >> (x & 7);
1274 if (c & 1)
1275 s1[len + (x >> 3)] |= mask;
1276 @@ -460,6 +536,7 @@
1277 s4[len + (x >> 3)] |= mask;
1278 if (c & 8)
1279 s8[len + (x >> 3)] |= mask;
1280 +#endif
1282 if (++x >= 640) {
1283 x = 0;
1284 @@ -494,7 +571,13 @@
1287 void graphics_cursor(int set) {
1288 - unsigned char *pat, *mem, *ptr, chr[16 << 2];
1289 + unsigned char *pat;
1290 +#ifdef __MINIOS__
1291 + uint32_t *mem, *ptr, chr[16 * 8];
1292 + int j;
1293 +#else
1294 + unsigned char *mem, *ptr, chr[16 << 2];
1295 +#endif
1296 int i, ch, invert, offset;
1298 if (set && (no_cursor || no_scroll))
1299 @@ -505,71 +588,127 @@
1300 invert = (text[fonty * 80 + fontx] & 0xff00) != 0;
1301 pat = font8x16 + (ch << 4);
1303 - mem = (unsigned char*)VIDEOMEM + offset;
1304 + mem = (unsigned char*)VIDEOMEM + offset
1305 +#ifdef __MINIOS__
1306 + * 8 * 4
1307 +#endif
1308 + ;
1310 if (!set) {
1311 for (i = 0; i < 16; i++) {
1312 unsigned char mask = pat[i];
1314 if (!invert) {
1315 +#ifdef __MINIOS__
1316 + memcpy(chr + i * 8, VSHADOW + offset * 8, 8 * 4);
1317 +#else
1318 chr[i ] = ((unsigned char*)VSHADOW1)[offset];
1319 chr[16 + i] = ((unsigned char*)VSHADOW2)[offset];
1320 chr[32 + i] = ((unsigned char*)VSHADOW4)[offset];
1321 chr[48 + i] = ((unsigned char*)VSHADOW8)[offset];
1322 +#endif
1324 if (shade) {
1325 if (ch == DISP_VERT || ch == DISP_LL ||
1326 ch == DISP_UR || ch == DISP_LR) {
1327 unsigned char pmask = ~(pat[i] >> 1);
1329 +#ifdef __MINIOS__
1330 + for (j = 0; j < 8; j++)
1331 + if (!(pmask & (1U << j)))
1332 + chr[i * 8 + (7 - j)] = palette[0];
1333 +#else
1334 chr[i ] &= pmask;
1335 chr[16 + i] &= pmask;
1336 chr[32 + i] &= pmask;
1337 chr[48 + i] &= pmask;
1338 +#endif
1340 if (i > 0 && ch != DISP_VERT) {
1341 unsigned char pmask = ~(pat[i - 1] >> 1);
1343 +#ifdef __MINIOS__
1344 + for (j = 0; j < 8; j++)
1345 + if (!(pmask & (1U << j)))
1346 + chr[i * 8 + (7 - j)] = palette[0];
1347 +#else
1348 chr[i ] &= pmask;
1349 chr[16 + i] &= pmask;
1350 chr[32 + i] &= pmask;
1351 chr[48 + i] &= pmask;
1352 +#endif
1353 if (ch == DISP_HORIZ || ch == DISP_UR || ch == DISP_LR) {
1354 pmask = ~pat[i - 1];
1356 +#ifdef __MINIOS__
1357 + for (j = 0; j < 8; j++)
1358 + if (!(pmask & (1U << j)))
1359 + chr[i * 8 + (7 - j)] = palette[0];
1360 +#else
1361 chr[i ] &= pmask;
1362 chr[16 + i] &= pmask;
1363 chr[32 + i] &= pmask;
1364 chr[48 + i] &= pmask;
1365 +#endif
1369 +#ifdef __MINIOS__
1370 + for (j = 0; j < 8; j++)
1371 + if (mask & (1U << j))
1372 + chr[i * 8 + (7 - j)] = palette[15];
1373 +#else
1374 chr[i ] |= mask;
1375 chr[16 + i] |= mask;
1376 chr[32 + i] |= mask;
1377 chr[48 + i] |= mask;
1378 +#endif
1380 offset += 80;
1382 else {
1383 +#ifdef __MINIOS__
1384 + for (j = 0; j < 8; j++)
1385 + if (mask & (1U << j))
1386 + chr[i * 8 + (7 - j)] = palette[15];
1387 + else
1388 + chr[i * 8 + (7 - j)] = palette[0];
1389 +#else
1390 chr[i ] = mask;
1391 chr[16 + i] = mask;
1392 chr[32 + i] = mask;
1393 chr[48 + i] = mask;
1394 +#endif
1398 else {
1399 +#ifdef __MINIOS__
1400 + ptr = mem;
1401 + for (i = 0; i < 16; i++, ptr += 80 * 8)
1402 + for (j = 0; j < 8; j++) {
1403 + if (pat[i] & (1U << (7 - j)))
1404 + cursorBuf32[i * 8 + j] = ptr[j] = palette[0];
1405 + else
1406 + cursorBuf32[i * 8 + j] = ptr[j] = palette[15];
1407 + }
1408 +#else
1409 MapMask(15);
1410 ptr = mem;
1411 for (i = 0; i < 16; i++, ptr += 80) {
1412 cursorBuf[i] = pat[i];
1413 *ptr = ~pat[i];
1415 +#endif
1416 return;
1419 offset = 0;
1420 +#ifdef __MINIOS__
1421 + ptr = mem;
1422 + for (j = 0; j < 16; j++, ptr += 80 * 8)
1423 + memcpy(ptr, chr + j * 8 + offset * 8, 8 * 4);
1424 +#else
1425 for (i = 1; i < 16; i <<= 1, offset += 16) {
1426 int j;
1428 @@ -580,6 +719,7 @@
1431 MapMask(15);
1432 +#endif
1435 #endif /* SUPPORT_GRAPHICS */
1436 Index: grub/stage2/graphics.h
1437 ===================================================================
1438 --- grub.orig/stage2/graphics.h 2008-06-16 15:18:14.527010000 +0100
1439 +++ grub/stage2/graphics.h 2008-06-16 15:18:14.805010000 +0100
1440 @@ -21,8 +21,10 @@
1441 #ifndef GRAPHICS_H
1442 #define GRAPHICS_H
1444 +#ifndef __MINIOS__
1445 /* magic constant */
1446 #define VIDEOMEM 0xA0000
1447 +#endif
1449 /* function prototypes */
1450 char *graphics_get_splash(void);
1451 Index: grub/stage2/stage2.c
1452 ===================================================================
1453 --- grub.orig/stage2/stage2.c 2008-06-17 11:06:47.873523000 +0100
1454 +++ grub/stage2/stage2.c 2008-06-17 11:07:05.225628000 +0100
1455 @@ -31,10 +31,10 @@
1456 #if defined(PRESET_MENU_STRING) || defined(SUPPORT_DISKLESS)
1458 # if defined(PRESET_MENU_STRING)
1459 -static const char *preset_menu = PRESET_MENU_STRING;
1460 +const char *preset_menu = PRESET_MENU_STRING;
1461 # elif defined(SUPPORT_DISKLESS)
1462 /* Execute the command "bootp" automatically. */
1463 -static const char *preset_menu = "bootp\n";
1464 +const char *preset_menu = "bootp\n";
1465 # endif /* SUPPORT_DISKLESS */
1467 static int preset_menu_offset;
1468 Index: grub/stage2/fsys_xfs.c
1469 ===================================================================
1470 RCS file: /sources/grub/grub/stage2/fsys_xfs.c,v
1471 retrieving revision 1.5
1472 diff -u -p -r1.5 fsys_xfs.c
1473 --- grub/stage2/fsys_xfs.c 8 May 2005 02:18:14 -0000 1.5
1474 +++ grub/stage2/fsys_xfs.c 10 Jul 2008 13:09:50 -0000
1475 @@ -101,7 +101,7 @@ static inline __const__ xfs_uint16_t
1476 le16 (xfs_uint16_t x)
1478 __asm__("xchgb %b0,%h0" \
1479 - : "=q" (x) \
1480 + : "=Q" (x) \
1481 : "0" (x)); \
1482 return x;
1484 @@ -109,9 +109,9 @@ le16 (xfs_uint16_t x)
1485 static inline __const__ xfs_uint32_t
1486 le32 (xfs_uint32_t x)
1488 -#if 0
1489 +#if 1
1490 /* 386 doesn't have bswap. */
1491 - __asm__("bswap %0" : "=r" (x) : "0" (x));
1492 + __asm__("bswapl %k0" : "=r" (x) : "0" (x));
1493 #else
1494 /* This is slower but this works on all x86 architectures. */
1495 __asm__("xchgb %b0, %h0" \