mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-02 11:21:12 +00:00
8806c0db63
So far, CPUID data were stored in two different data structures. First of them was a structure allowing direct access for CPUID data according to function number and the second was a plain array of struct cpuX86cpuid. This was a silly design which resulted in converting data from one type to the other and back again or implementing similar functionality for both data structures. The patch leaves only the direct access structure. This makes the code both smaller and more maintainable since operations on different objects can use common low-level operations. All 57 tests for cpu subsystem still pass after this rewrite.
48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
/*
|
|
* cpu_x86_data.h: x86 specific CPU data
|
|
*
|
|
* Copyright (C) 2009-2010 Red Hat, Inc.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
* Authors:
|
|
* Jiri Denemark <jdenemar@redhat.com>
|
|
*/
|
|
|
|
#ifndef __VIR_CPU_X86_DATA_H__
|
|
# define __VIR_CPU_X86_DATA_H__
|
|
|
|
# include <stdint.h>
|
|
|
|
struct cpuX86cpuid {
|
|
uint32_t function;
|
|
uint32_t eax;
|
|
uint32_t ebx;
|
|
uint32_t ecx;
|
|
uint32_t edx;
|
|
};
|
|
|
|
# define CPUX86_BASIC 0x0
|
|
# define CPUX86_EXTENDED 0x80000000
|
|
|
|
struct cpuX86Data {
|
|
size_t basic_len;
|
|
struct cpuX86cpuid *basic;
|
|
size_t extended_len;
|
|
struct cpuX86cpuid *extended;
|
|
};
|
|
|
|
#endif /* __VIR_CPU_X86_DATA_H__ */
|