All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Joseph Parmelee <jparmele@wildbear.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: Old version of lilo fails to boot 2.6.23
Date: Thu, 25 Oct 2007 14:53:52 -0700	[thread overview]
Message-ID: <47211070.4090502@zytor.com> (raw)
In-Reply-To: <20071025014746.96e5e776.akpm@linux-foundation.org>

[-- Attachment #1: Type: text/plain, Size: 97 bytes --]

[Ancient LILO boot problem]

Joseph, could you try this patch on your ancient-LILO setup?

	-hpa

[-- Attachment #2: newsetup-ancient-lilo.patch --]
[-- Type: text/x-patch, Size: 1140 bytes --]

diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 8353c81..295f9b9 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -242,11 +242,31 @@ setup2:
 	movw	%ax, %es
 	cld
 
+# Apparently some ancient versions of LILO invoked the kernel
+# with %ss != %ds, which happened to work by accident for the
+# old code.  If the CAN_USE_HEAP flag is set in loadflags, or
+# %ss != %ds, then adjust the stack pointer.
+	testb	$CAN_USE_HEAP, loadflags
+	jnz 2f
+
+	# No CAN_USE_HEAP
+	movw	%ss, %dx
+	cmpw	%ax, %dx	# %ds == %ss?
+	je	3f		# If so, assume %sp is valid
+
+	# If not, use the default value from heap_end_ptr
+	# as the %sp value -- it's the best we can do with an
+	# impossible situation.
+2:
+	movw	%ax, %ss
+	movw	heap_end_ptr, %sp
+	
 # Stack paranoia: align the stack and make sure it is good
 # for both 16- and 32-bit references.  In particular, if we
 # were meant to have been using the full 16-bit segment, the
 # caller might have set %sp to zero, which breaks %esp-based
 # references.
+3:	
 	andw	$~3, %sp	# dword align (might as well...)
 	jnz	1f
 	movw	$0xfffc, %sp	# Make sure we're not zero

  parent reply	other threads:[~2007-10-25 21:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-16  7:07 Old version of lilo fails to boot 2.6.23 Joseph Parmelee
2007-10-25  8:47 ` Andrew Morton
2007-10-25  9:08   ` H. Peter Anvin
2007-10-25 21:53   ` H. Peter Anvin [this message]
2007-10-25 22:31     ` H. Peter Anvin
2007-10-26 18:25       ` Joseph Parmelee
2007-10-26 18:37         ` H. Peter Anvin

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=47211070.4090502@zytor.com \
    --to=hpa@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=jparmele@wildbear.com \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.