x86: define CPUINFO_features used as the base offset for cpu features
PATCH v3 1/9 x86: define CPUINFO_features used as the base offset for cpu features
This patch defines CPUINFO_features which can be used as the base of the offset for cpu features.
--- xen/arch/x86/boot/head.S | 2 +- xen/arch/x86/x86_64/asm-offsets.c | 2 +- xen/include/asm-x86/asm_defns.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-)
xen/arch/x86/boot/head.S +1 -1
@@ -131,7 +131,7 @@ __start: mov $0x80000001,%eax cpuid 1: mov %edx,sym_phys(cpuid_ext_features) - mov %edx,sym_phys(boot_cpu_data)+CPUINFO86_ext_features + mov %edx,sym_phys(boot_cpu_data)+CPUINFO_ext_features /* Check for availability of long mode. */ bt $29,%edx
xen/arch/x86/x86_64/asm-offsets.c +1 -1
@@ -159,7 +159,7 @@ void __dummy__(void)OFFSET (IRQSTAT_softirq_pending, irq_cpustat_t, __softirq_pending);BLANK (); - OFFSET(CPUINFO86_ext_features, struct cpuinfo_x86, x86_capability[1]); + OFFSET(CPUINFO_features, struct cpuinfo_x86, x86_capability[0]);BLANK ();OFFSET (MB_flags, multiboot_info_t, flags);
xen/include/asm-x86/asm_defns.h +2 -0
@@ -29,6 +29,8 @@ void ret_from_intr(void); " .previous\n"#endif +#define CPUINFO_ext_features (CPUINFO_features+4) +#define _ASM_EXTABLE (from, to) _ASM__EXTABLE(, from, to)#define _ASM_PRE_EXTABLE (from, to) _ASM__EXTABLE(.pre, from, to)
Signature · 1 line
1.8.3.1
Quoted 15 lines · Feng Wu
This patch defines
CPUINFO_featureswhich can be used as the base of the offset for cpu features.Signed-off-by Feng Wu <[email protected]>--- xen/arch/x86/boot/head.S | 2 +- xen/arch/x86/x86_64/asm-offsets.c | 2 +- xen/include/asm-x86/asm_defns.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-)xen/arch/x86/boot/head.S +0
-0
xen/arch/x86/boot/head.S __start: · line 134
Quoted 5 lines
xen/arch/x86/boot/head.S +1
-1@@ -131,7 +131,7 @@ __start: mov $0x80000001,%eax cpuid 1: mov %edx,sym_phys(cpuid_ext_features) - mov %edx,sym_phys(boot_cpu_data)+CPUINFO86_ext_features + mov %edx,sym_phys(boot_cpu_data)+CPUINFO_ext_features
Personally I feel this would be better as CPUINFO_features + 4, rather than having another #define in asm_defn.h solely for this purpose.
However, functionally it looks fine.
~Andrew
Quoted 29 lines
xen/arch/x86/boot/head.S +0
-0/* Check for availability of long mode. */ bt $29,%edxxen/arch/x86/x86_64/asm-offsets.c +1
-1@@ -159,7 +159,7 @@ void __dummy__(void)OFFSET (IRQSTAT_softirq_pending, irq_cpustat_t, __softirq_pending);BLANK (); - OFFSET(CPUINFO86_ext_features, struct cpuinfo_x86, x86_capability[1]); + OFFSET(CPUINFO_features, struct cpuinfo_x86, x86_capability[0]);BLANK ();OFFSET (MB_flags, multiboot_info_t, flags);xen/include/asm-x86/asm_defns.h +2
-0@@ -29,6 +29,8 @@ void ret_from_intr(void); " .previous\n"#endif +#define CPUINFO_ext_features (CPUINFO_features+4) +#define _ASM_EXTABLE (from, to) _ASM__EXTABLE(, from, to)#define _ASM_PRE_EXTABLE (from, to) _ASM__EXTABLE(.pre, from, to)
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 28.04.14 at 10:55, <[email protected]> wrote:
Quoted 10 lines · Feng Wu
This patch defines
CPUINFO_featureswhich can be used as the base of the offset for cpu features.Signed-off-by Feng Wu <[email protected]>--- xen/arch/x86/boot/head.S | 2 +- xen/arch/x86/x86_64/asm-offsets.c | 2 +- xen/include/asm-x86/asm_defns.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-)
Quoted 13 lines
xen/arch/x86/boot/head.S __start: · line 134
Quoted 10 lines
xen/arch/x86/boot/head.S +1
-1@@ -131,7 +131,7 @@ __start: mov $0x80000001,%eax cpuid 1: mov %edx,sym_phys(cpuid_ext_features) - mov %edx,sym_phys(boot_cpu_data)+CPUINFO86_ext_features + mov %edx,sym_phys(boot_cpu_data)+CPUINFO_ext_featuresPersonally I feel this would be better as
CPUINFO_features+ 4, rather than having another #define inasm_defn.hsolely for this purpose.
It should indeed be done here, without the extra #define, but also without the literal 4. Our main goal here is to collect the LM bit, so just calculate the number from X86_FEATURE_LM.
Jan