From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: grub-devel@gnu.org
Subject: Re: reed solomon breaks larger pxe images
Date: Mon, 27 Dec 2010 06:06:57 +0100 [thread overview]
Message-ID: <4D181EF1.5040909@gmail.com> (raw)
In-Reply-To: <alpine.GSO.2.00.1012262027490.228356@oretfbsg>
[-- Attachment #1.1: Type: text/plain, Size: 1332 bytes --]
On 12/27/2010 05:30 AM, Seth Goldberg wrote:
> Hi,
>
> While trying to test pxe booting, I noticed that creating a pxe
> image larger than around 100k causes the system hard-hang after
> control is transferred to pxegrub. I narrowed it down to an unknown
> problem in grub_reed_solomon_recover (called from startup.S).
> Unconditionally jumping over the call allows the system to continue to
> proceed to the menu. So, if you're trying to build a pxe image with a
> lot of modules, and you get a hard hang, try this:
>
Attached patch should fix the problem.
> === modified file 'grub-core/kern/i386/pc/startup.S'
> --- grub-core/kern/i386/pc/startup.S 2010-12-24 06:29:28 +0000
> +++ grub-core/kern/i386/pc/startup.S 2010-12-27 04:26:25 +0000
> @@ -147,6 +147,8 @@
> incl %eax
> call grub_gate_a20
>
> + jmp post_reed_solomon
> +
> movl EXT_C(grub_compressed_size), %edx
> addl $(GRUB_KERNEL_MACHINE_RAW_SIZE -
> GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART), %edx
> movl reed_solomon_redundancy, %ecx
>
>
>
> --S
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: rs.diff --]
[-- Type: text/x-diff; name="rs.diff", Size: 1700 bytes --]
=== modified file 'grub-core/kern/i386/pc/startup.S'
--- grub-core/kern/i386/pc/startup.S 2010-12-04 16:19:26 +0000
+++ grub-core/kern/i386/pc/startup.S 2010-12-27 04:51:59 +0000
@@ -151,8 +151,6 @@
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART), %edx
movl reed_solomon_redundancy, %ecx
leal _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART, %eax
- testl %edx, %edx
- jz post_reed_solomon
call EXT_C (grub_reed_solomon_recover)
jmp post_reed_solomon
=== modified file 'grub-core/lib/reed_solomon.c'
--- grub-core/lib/reed_solomon.c 2010-12-21 16:51:08 +0000
+++ grub-core/lib/reed_solomon.c 2010-12-27 05:06:01 +0000
@@ -372,6 +372,10 @@
grub_size_t rr = (rs + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
gf_single_t m[ds + rr];
+ /* Nothing to do. */
+ if (!ds || !rr)
+ continue;
+
for (j = 0; j < (int) ds; j++)
m[j] = ptr[SECTOR_SIZE * j + i];
for (j = 0; j < (int) rr; j++)
@@ -414,6 +418,10 @@
gf_single_t *ptr = buffer;
gf_single_t *rptr = ptr + s;
+ /* Nothing to do. */
+ if (!rs)
+ return;
+
while (s > 0)
{
grub_size_t tt;
@@ -441,6 +449,10 @@
gf_single_t *ptr = ptr_;
gf_single_t *rptr = ptr + s;
+ /* Nothing to do. */
+ if (!rs)
+ return;
+
#if defined (STANDALONE)
init_inverts ();
#endif
@@ -454,8 +466,8 @@
tt = cs + crs;
if (tt > MAX_BLOCK_SIZE)
{
- cs = cs * MAX_BLOCK_SIZE / tt;
- crs = crs * MAX_BLOCK_SIZE / tt;
+ cs = (cs * MAX_BLOCK_SIZE) / tt;
+ crs = (crs * MAX_BLOCK_SIZE) / tt;
}
decode_block (ptr, cs, rptr, crs);
ptr += cs;
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
prev parent reply other threads:[~2010-12-27 5:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-27 4:30 reed solomon breaks larger pxe images Seth Goldberg
2010-12-27 5:06 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D181EF1.5040909@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).