public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Bill Rieske <BRIESKE@novell.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] bios: resolve memory device roll over reporting issues with >32G guests
Date: Sun, 09 Nov 2008 15:15:33 +0200	[thread overview]
Message-ID: <4916E275.2000802@redhat.com> (raw)
In-Reply-To: <491456C7.860B.008B.3@novell.com>

Bill Rieske wrote:
> The field within the Memory Device type 17 is only a word with the MSB being used to report MB/KB.  Thereby, a guest with 32G and greater would report incorrect memory device information rolling over to 0.
>
> This presents more than one memory device and associated memory structures if the memory is larger than 16G
>
> Signed-off-by: Bill Rieske <brieske@@novell.com>
>
>   
> diff --git a/bios/rombios32.c b/bios/rombios32.c
> index a91b155..bc69945 100755
> --- a/bios/rombios32.c
> +++ b/bios/rombios32.c
> @@ -173,6 +173,26 @@ static inline int isdigit(int c)
>      return c >= '0' && c <= '9';
>  }
>  
> +char *itoa(char *a, unsigned int i)
> +{
> +    unsigned int _i = i, x = 0;
> +
> +    do {
> +        x++;
> +        _i /= 10;
> +    } while ( _i != 0 );
> +
> +    a += x;
> +    *a-- = '\0';
> +
> +    do {
> +        *a-- = (i % 10) + '0';
> +        i /= 10;
> +    } while ( i != 0 );
> +
> +    return a + 1;
> +}
> +
>   

Instead of this, can you add an snprintf() (in a separate patch) and use 
it?  There's already a vsnprintf() so all the heavy machinery is in place.

>  void *memset(void *d1, int val, size_t len)
>  {
>      uint8_t *d = d1;
> @@ -220,6 +240,16 @@ size_t strlen(const char *s)
>      return s1 - s;
>  }
>  
> +char *
> +strcpy(char *dest, const char *src)
> +{
> +    char *p = dest;
> +    while ( *src )
> +        *p++ = *src++;
> +    *p = 0;
> +    return dest;
> +}
> +
>   

This would eliminate the need for strcpy(), I think.


-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2008-11-09 13:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-07 21:55 [PATCH] bios: resolve memory device roll over reporting issues with >32G guests Bill Rieske
2008-11-09 13:15 ` Avi Kivity [this message]
2008-11-10 16:31   ` Bill Rieske
2008-11-16 16:09     ` Avi Kivity

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=4916E275.2000802@redhat.com \
    --to=avi@redhat.com \
    --cc=BRIESKE@novell.com \
    --cc=kvm@vger.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