lkml.org 
[lkml]   [2017]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 09/11] x86/xen: use capabilities instead of fake cpuid values for xsave
From
Date

> +static bool __init xen_check_xsave(void)
> {
> - unsigned int ax, bx, cx, dx;
> - unsigned int xsave_mask;
> + unsigned int err, eax, edx;
>
> - ax = 1;
> - cx = 0;
> - cpuid(1, &ax, &bx, &cx, &dx);
> + /* Test OSXSAVE capability via xgetbv instruction. */
> + asm volatile("1: .byte 0x0f,0x01,0xd0\n\t" /* xgetbv */
> + "xor %[err], %[err]\n"
> + "2:\n\t"
> + ".pushsection .fixup,\"ax\"\n\t"
> + "3: movl $1,%[err]\n\t"
> + "jmp 2b\n\t"
> + ".popsection\n\t"
> + _ASM_EXTABLE(1b, 3b)
> + : [err] "=r" (err), "=a" (eax), "=d" (edx)
> + : "c" (0));

Have you tested this on processors where we actually trap on xgetbv?

I have an AMD box without XSAVE support and this is a fatal error. I
suspect it's too early to use exception fixup framework here.

-boris


\
 
 \ /
  Last update: 2017-04-21 16:25    [W:0.101 / U:2.880 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site