[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 09/12] cpuid: simplify CPUID flag search functio
From: |
Amit Shah |
Subject: |
Re: [Qemu-devel] [PATCH 09/12] cpuid: simplify CPUID flag search function |
Date: |
Mon, 14 Sep 2009 12:53:11 +0530 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
On (Fri) Sep 11 2009 [21:30:52], Andre Przywara wrote:
> Amit Shah wrote:
>> On (Fri) Sep 11 2009 [00:20:54], Andre Przywara wrote:
>>> avoid code duplication and handle the CPUID flag name search in a
>>> loop.
>>> --- a/target-i386/cpuid.c
>>> +++ b/target-i386/cpuid.c
>>> @@ -71,29 +71,22 @@ static void add_flagname_to_bitmaps(const char
>>> *flagname, uint32_t *features,
>>> uint32_t *ext2_features,
>>> uint32_t *ext3_features)
>>> {
> >>...
>>> + for (j = 0; j < 4; j++) {
>>> + for (i = 0; i < 32; i++) {
>>> + if (feature_names[j][i] &&
>>> + !strcmp(flagname, feature_names[j][i])) {
>>> + *feature_flags[j] |= 1 << i;
>>> + found = 1;
>>> + }
>>> + }
>>> if (!found) {
>>> fprintf(stderr, "CPU feature %s not found\n", flagname);
>>> }
>>
>> This just reports the entire string, right? Not just the feature as the
>> printf suggests.
> What makes you think so? flagname is just the single flag (being
> returned by strtok in the caller, wich null-terminates its results).
> Otherwise the strcmp() above would not work either...
> Unknown flags will be reported, but do not abort QEMU (I checked this
> myself by accident ;-)
strtok, right. It'd be good to remove that. Esp with QemuOpts it would
be easier
Amit
- [Qemu-devel] [PATCH 0/12] cpuid: cleanup and some enhancements, Andre Przywara, 2009/09/10
- [Qemu-devel] [PATCH 02/12] cpuid: fix over-long lines, Andre Przywara, 2009/09/10
- [Qemu-devel] [PATCH 01/12] cpuid: move CPUID functions into separate file, Andre Przywara, 2009/09/10
- [Qemu-devel] [PATCH 03/12] cpuid: replace magic number with named constant, Andre Przywara, 2009/09/10
- [Qemu-devel] [PATCH 05/12] cpuid: moved host_cpuid function and remove prototype, Andre Przywara, 2009/09/10
- [Qemu-devel] [PATCH 04/12] cpuid: fix comments, Andre Przywara, 2009/09/10
- [Qemu-devel] [PATCH 09/12] cpuid: simplify CPUID flag search function, Andre Przywara, 2009/09/10
- [Qemu-devel] [PATCH 06/12] cpuid: add missing CPUID feature flag names, Andre Przywara, 2009/09/10
- [Qemu-devel] [PATCH 11/12] cpuid: add TCG feature bit trimming, Andre Przywara, 2009/09/10
- [Qemu-devel] [PATCH 08/12] cpuid: remove unnecessary kvm_trim function, Andre Przywara, 2009/09/10
- [Qemu-devel] [PATCH 12/12] cpuid: decrease L2 cache for Intel and add comments, Andre Przywara, 2009/09/10
- [Qemu-devel] [PATCH 10/12] cpuid: propagate further CPUID leafs when -cpu host, Andre Przywara, 2009/09/10
- [Qemu-devel] [PATCH 07/12] cpuid: list all known x86 CPUID feature flags, Andre Przywara, 2009/09/10
- Re: [Qemu-devel] [PATCH 0/12] cpuid: cleanup and some enhancements, Amit Shah, 2009/09/11
- Re: [Qemu-devel] [PATCH 0/12] cpuid: cleanup and some enhancements, Anthony Liguori, 2009/09/14