Skip to contentSkip to conversation

x86: fix early option scanning

PATCH New Jan Beulich 1 participant 1 message Jun 19, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: fix early option scanning

Make sure command lines like
... vgaxyz vga=
... console=vga vga=
mistakenly ignore the vga= option due to finding 'vga' earlier on the line.

xen/arch/x86/boot/cmdline.S +10 -8
Index: 2007-06-18/xen/arch/x86/boot/cmdline.S
===================================================================
@@ -119,9 +119,11 @@
         ret
 
 .Lfind_option:
+        mov     4(%esp),%eax
         push    %ebx
-        push    4+8(%esp)
-        push    4+8(%esp)
+0:
+        pushl   4+8(%esp)
+        push    %eax
         call    .Lstrstr
         add     $8,%esp
         test    %eax,%eax
@@ -129,20 +131,20 @@
         cmp     %eax,4+4(%esp)
         je      1f
         cmpb    $' ',-1(%eax)
-        jne     2f
+        je      1f
+2:      inc     %eax
+        jmp     0b
 1:      mov     %eax,%ebx
-        push    4+8(%esp)
+        pushl   4+8(%esp)
         call    .Lstrlen
         add     $4,%esp
-        xchg    %eax,%ebx
-        add     %eax,%ebx
+        xadd    %eax,%ebx
         cmpb    $'\0',(%ebx)
         je      3f
         cmpb    $' ',(%ebx)
         je      3f
         cmpb    $'=',(%ebx)
-        je      3f
-2:      xor     %eax,%eax
+        jne     2b
 3:      pop     %ebx
         ret