From: Pavel Machek <pavel@ucw.cz>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/boot: This program cannot be run in DOS mode.$
Date: Mon, 8 Apr 2019 23:25:06 +0200 [thread overview]
Message-ID: <20190408212506.GA6428@amd> (raw)
In-Reply-To: <20190408180809.myjp5zaviuibj5uf@pali>
[-- Attachment #1: Type: text/plain, Size: 2318 bytes --]
On Mon 2019-04-08 20:08:09, Pali Rohár wrote:
> On Monday 08 April 2019 20:04:22 Pavel Machek wrote:
> > On Mon 2019-04-01 12:24:34, Pali Rohár wrote:
> > > Every EFI binary is in PE format. And we know that PE format needs to have
> > > MZ MS-DOS header as there is written offset to PE header.
> > >
> > > Therefore generated bzImage binary with CONFIG_EFI_STUB option is MS-DOS
> > > executable binary.
> > >
> > > We already know the "requirement" that Windows PE executable started in
> > > MS-DOS must print legendary and famous message to computer screen:
> > > "This program cannot be run in DOS mode."
> > >
> > > But trying to run that bzImage of Linux kernel with MZ header just cause
> > > freezing whole MS-DOS instead of writing "the correct message" to user.
> > > This is not the compliant behavior of PE executables!
> > >
> > > This patch fixes this problem. When Linux kernel compiled with
> > > CONFIG_EFI_STUB is started in MS-DOS then it prints message:
> > >
> > > This program cannot be run in DOS mode.
> > > To load Linux kernel from DOS mode use LOADLIN.EXE.
> > >
> > > So it also helps MS-DOS users how to "correctly" start this bzImage binary
> > > by mentioning LOADLIN.EXE. Note that MS-DOS strings are not null-terminated
> > > but rather dollar-terminated.
> > >
> > > To have error message unified bugger_off_msg for BIOS boot block code was
> > > changed to:
> > >
> > > This program cannot be run in BIOS mode.
> > >
> > > So if you copy generated bzImage directly to boot sector and try to boot it
> > > by BIOS you get this new updated message.
> > >
> > > Due to fixed offset of setup header (0x1f1), PE header was moved after
> > > entrytext section. bstext and bsdata sections where is full MZ header and
> > > MS-DOS code is now bigger.
> >
> > Hehe, I guess the patch may have been dropped due to april's fools?
>
> Yea, it was mean as first April patch :-) I tested it with MS-DOS 7.0
> and DOSBox and it worked.
>
> > You may want to retransmit?
>
> Do you really think it can be useful? :-)
Dunno. It is quite simple, and quite a nice hack ;-).
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2019-04-08 21:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-01 10:24 [PATCH] x86/boot: This program cannot be run in DOS mode.$ Pali Rohár
2019-04-08 18:04 ` Pavel Machek
2019-04-08 18:08 ` Pali Rohár
2019-04-08 21:25 ` Pavel Machek [this message]
2019-04-18 11:27 ` Ingo Molnar
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=20190408212506.GA6428@amd \
--to=pavel@ucw.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=pali.rohar@gmail.com \
--cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox