On Tue, Jan 08, 2008 at 11:13:08AM -0800, Dave Hansen wrote: > On Tue, 2008-01-08 at 12:12 +0530, Amit Shah wrote: > > > BIOS-provided physical RAM map: > > > BIOS-e820: 0000000000000000 - 000000000009fc00 (usable) > > > BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved) > > > BIOS-e820: 00000000000e8000 - 0000000000100000 (reserved) > > > BIOS-e820: 0000000000100000 - 00000000fffbd000 (usable) > > > BIOS-e820: 00000000fffbd000 - 00000000ffff0000 (reserved) > > > > > > Note that this is with '-m 1G'!! It looks to me like one of those > > > > And there lies the problem. qemu doesn't understand suffixes like 'G'. > > If you > > pass -m 1024, you'll boot just fine. > > > > This is really annoying of qemu (it should either accept that input > > properly > > or bail out); a patch is welcome! > > OK. Here's a function stolen blatantly from the kernel. Seems to work
What license was this under originally ? The kernel is typically GPLv2, while QEMU's core infrastructure is BSD (only some device emulation is GPL). So not a good idea if you want this to go into upstream QEMU. > --- orig/qemu-0.9.1/vl.c 2008-01-06 11:38:42.000000000 -0800 > +++ qemu-0.9.1/vl.c 2008-01-08 11:23:29.000000000 -0800 > @@ -8052,6 +8052,47 @@ > } > #endif > > +/** > + * memparse - parse a string with mem suffixes into a number of bytes > + * @ptr: Where parse begins > + * > + * Parses a string into a number. The number stored at @ptr is > + * potentially suffixed with %M (for megabytes, or 1048576 bytes) > + * or %G (for gigabytes, or 1073741824). If the number is > + * suffixed with M or G, then the return value is the number > + * multiplied by one megabyte or one gigabyte, respectively. No > + * suffix implies megabytes. > + */ > + > +unsigned long long memparse (const char *ptr) > +{ > + char *endptr; > + unsigned long ret = strtoull(ptr, &endptr, 0); 32-bit overflow here on i686. Should be unsigned long long if you want to support > 2 G on a 32-bit platform. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=| ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel