* [PATCH v2] xen/arch/x86: Fix early boot command line parsing
@ 2013-12-03 20:28 Daniel Kiper
2013-12-03 20:32 ` Andrew Cooper
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Kiper @ 2013-12-03 20:28 UTC (permalink / raw)
To: andrew.cooper3, jbeulich, keir, xen-devel; +Cc: Daniel Kiper
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] xen/arch/x86: Fix early boot command line parsing
2013-12-03 20:28 [PATCH v2] xen/arch/x86: Fix early boot command line parsing Daniel Kiper
@ 2013-12-03 20:32 ` Andrew Cooper
2013-12-04 7:16 ` Keir Fraser
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2013-12-03 20:32 UTC (permalink / raw)
To: Daniel Kiper; +Cc: xen-devel, keir, jbeulich
On 03/12/13 20:28, Daniel Kiper wrote:
> 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>
I was thinking more along the lines of /* NULL check (as $'\0' == 0x30
in GAS) */
Either way, at least it is obvious.
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] xen/arch/x86: Fix early boot command line parsing
2013-12-03 20:32 ` Andrew Cooper
@ 2013-12-04 7:16 ` Keir Fraser
0 siblings, 0 replies; 3+ messages in thread
From: Keir Fraser @ 2013-12-04 7:16 UTC (permalink / raw)
To: Andrew Cooper, Daniel Kiper; +Cc: xen-devel, keir, jbeulich
On 03/12/2013 20:32, "Andrew Cooper" <andrew.cooper3@citrix.com> wrote:
> On 03/12/13 20:28, Daniel Kiper wrote:
>> 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>
>
> I was thinking more along the lines of /* NULL check (as $'\0' == 0x30
> in GAS) */
>
> Either way, at least it is obvious.
>
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
>> ---
>> 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
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-04 7:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-03 20:28 [PATCH v2] xen/arch/x86: Fix early boot command line parsing Daniel Kiper
2013-12-03 20:32 ` Andrew Cooper
2013-12-04 7:16 ` Keir Fraser
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).