[coreboot] [coreinfo] [PATCH] fix cpu flags overwrite

Ulf Jordan jordan at chalmers.se
Thu Sep 18 21:08:56 CEST 2008


On Thu, 18 Sep 2008, Stefan Reinauer wrote:

> See patch
>
> -- 
>
> After dumping the ecx flags, decode_flags starts in the same line for 
> the edx flags if less than 16 flags were decoded. Some flags could not 
> be read because they're overwritten. This patch fixes the problem by 
> forcing a new line for each decode.
>
> Signed-off-by: Stefan Reinauer <stepan at coresystems.de>

With the two comments below addressed, this patch is

Acked-by: Ulf Jordan <jordan at chalmers.se>


> Index: coreinfo/cpuinfo_module.c
> ===================================================================
> --- coreinfo/cpuinfo_module.c   (revision 3569)
> +++ coreinfo/cpuinfo_module.c   (working copy)
> @@ -97,6 +97,7 @@
>  {
>         int i;
>         int lrow = *row;
> +       int output_available=0;
>
>         wmove(win, lrow, 2);
>
> @@ -104,8 +105,10 @@
>                 if (flags[i] == NULL)
>                         continue;
> 
> -               if (reg & (1 << i))
> +               if (reg & (1 << i)) {
>                         wprintw(win, "%s ", flags[i]);
> +                       output_available=1;
> +               }
>
>                 if (i && (i % 16) == 0) {
>                         lrow++;
> @@ -113,6 +116,8 @@
>                 }
>         }
> 
> +       lrow += output_available;
> +
>         *row = lrow;
>  }
> 
> @@ -131,7 +136,7 @@
>
>         switch (vendor) {
>         case VENDOR_AMD:
> -               wmove(win, lrow++, 1);
> +               wmove(win, lrow, 1);
>                 wprintw(win, "AMD Extended Flags: ");

This hunk will make the decoded flags overwrite the heading, please 
remove.

>                 decode_flags(win, ecx, amd_cap_generic_ecx_flags, &lrow);
>                 docpuid(0x80000001, &eax, &ebx, &ecx, &edx);
> @@ -139,7 +144,7 @@
>                 decode_flags(win, ecx, amd_cap_extended_ecx_flags, &lrow);
>                 break;
>         case VENDOR_INTEL:
> -               wmove(win, lrow++, 1);
> +               wmove(win, lrow, 1);
>                 wprintw(win, "Intel Extended Flags: ");

Ditto.

>                 decode_flags(win, ecx, intel_cap_generic_ecx_flags, &lrow);
>                 docpuid(0x80000001, &eax, &ebx, &ecx, &edx);


/ulf




More information about the coreboot mailing list