xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Kiper <daniel.kiper@oracle.com>
To: andrew.cooper3@citrix.com, jbeulich@suse.com, keir@xen.org,
	xen-devel@lists.xensource.com
Cc: Daniel Kiper <daniel.kiper@oracle.com>
Subject: [PATCH v2] xen/arch/x86: Fix early boot command line parsing
Date: Tue,  3 Dec 2013 21:28:57 +0100	[thread overview]
Message-ID: <1386102537-16527-1-git-send-email-daniel.kiper@oracle.com> (raw)

There is no reliable way to encode NUL character as a character so encode
it as a number. Read: http://sourceware.org/binutils/docs/as/Characters.html.
Octal and hex encoding do not work on at least one system (GNU assembler
version 2.22 (x86_64-linux-gnu) using BFD version (GNU Binutils for Debian) 2.22).
Without this fix e.g. no-real-mode option at the end of xen.gz command line
is not detected.

v2 - suggestions/fixes:
   - add relevant comment to assembly file
     (suggested by Andrew Cooper),
   - leave encoding of other characters as is for readability
     (suggested by Jan Beulich).

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 xen/arch/x86/boot/cmdline.S |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/boot/cmdline.S b/xen/arch/x86/boot/cmdline.S
index 05ffb94..b83975e 100644
--- a/xen/arch/x86/boot/cmdline.S
+++ b/xen/arch/x86/boot/cmdline.S
@@ -138,7 +138,15 @@
         call    .Lstrlen
         add     $4,%esp
         xadd    %eax,%ebx
-        cmpb    $'\0',(%ebx)
+        /*
+         * There is no reliable way to encode NUL character as a character so encode
+         * it as a number. Read: http://sourceware.org/binutils/docs/as/Characters.html.
+         * Octal and hex encoding do not work on at least one system (GNU assembler
+         * version 2.22 (x86_64-linux-gnu) using BFD version (GNU Binutils for Debian) 2.22).
+         * Without this fix e.g. no-real-mode option at the end of xen.gz command line
+         * is not detected.
+         */
+        cmpb    $0,(%ebx)
         je      3f
         cmpb    $' ',(%ebx)
         je      3f
-- 
1.7.10.4

             reply	other threads:[~2013-12-03 20:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 20:28 Daniel Kiper [this message]
2013-12-03 20:32 ` [PATCH v2] xen/arch/x86: Fix early boot command line parsing Andrew Cooper
2013-12-04  7:16   ` Keir Fraser

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=1386102537-16527-1-git-send-email-daniel.kiper@oracle.com \
    --to=daniel.kiper@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xensource.com \
    /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).