Gentoo Archives: gentoo-commits

From: "Richard Yao (ryao)" <ryao@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/grub/0.97: 901_all_grub-0.97-fix-gcc46-reboot-issue.patch
Date: Tue, 29 May 2012 09:43:26
Message-Id: 20120529094312.D149A2004B@flycatcher.gentoo.org
1 ryao 12/05/29 09:43:12
2
3 Added: 901_all_grub-0.97-fix-gcc46-reboot-issue.patch
4 Log:
5 Add xarthisius' patch for bug #360513 to GRUB 0.97 patchset, reviewed by myself and jdhore, approved by Chainsaw
6
7 Revision Changes Path
8 1.1 src/patchsets/grub/0.97/901_all_grub-0.97-fix-gcc46-reboot-issue.patch
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/grub/0.97/901_all_grub-0.97-fix-gcc46-reboot-issue.patch?rev=1.1&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/grub/0.97/901_all_grub-0.97-fix-gcc46-reboot-issue.patch?rev=1.1&content-type=text/plain
12
13 Index: 901_all_grub-0.97-fix-gcc46-reboot-issue.patch
14 ===================================================================
15 Fix infinite boot loop with >=gcc-4.6
16
17 https://bugs.gentoo.org/show_bug.cgi?id=360513
18 http://code.google.com/p/grub4dos-chenall/source/browse/trunk/stage2/bios.c?spec=svn290&r=290
19
20 Patch is a part of grub4dos project
21
22 --- a/stage2/bios.c
23 +++ b/stage2/bios.c
24 @@ -60,7 +60,18 @@
25 unsigned short blocks;
26 unsigned long buffer;
27 unsigned long long block;
28 - } __attribute__ ((packed)) dap;
29 +
30 + /* This structure is passed in the stack. A buggy BIOS could write
31 + * garbage data to the tail of the struct and hang the machine. So
32 + * we need this protection. - Tinybit
33 + */
34 + unsigned char dummy[16];
35 + } __attribute__ ((packed)) *dap;
36 +
37 + /* Even the above protection is not enough to avoid stupid actions by
38 + * buggy BIOSes. So we do it in the 0040:0000 segment. - Tinybit
39 + */
40 + dap = (struct disk_address_packet *)0x580;
41
42 /* XXX: Don't check the geometry by default, because some buggy
43 BIOSes don't return the number of total sectors correctly,
44 @@ -72,15 +83,15 @@
45
46 /* FIXME: sizeof (DAP) must be 0x10. Should assert that the compiler
47 can't add any padding. */
48 - dap.length = sizeof (dap);
49 - dap.block = sector;
50 - dap.blocks = nsec;
51 - dap.reserved = 0;
52 + dap->length = 0x10;
53 + dap->block = sector;
54 + dap->blocks = nsec;
55 + dap->reserved = 0;
56 /* This is undocumented part. The address is formated in
57 SEGMENT:ADDRESS. */
58 - dap.buffer = segment << 16;
59 + dap->buffer = segment << 16;
60
61 - err = biosdisk_int13_extensions ((read + 0x42) << 8, drive, &dap);
62 + err = biosdisk_int13_extensions ((read + 0x42) << 8, drive, dap);
63
64 /* #undef NO_INT13_FALLBACK */
65 #ifndef NO_INT13_FALLBACK