Re: [PATCH kvm-unit-tests 2/3] x86: Test rflags.rf is set upon faults

From: Paolo Bonzini
Date: Mon Jul 21 2014 - 08:25:12 EST


Il 21/07/2014 13:39, Nadav Amit ha scritto:
> @@ -176,7 +176,7 @@ unsigned exception_vector(void)
> unsigned short vector;
>
> asm("mov %%gs:4, %0" : "=rm"(vector));

"rm" is wrong here, it should be "r". If we make it "q" instead, we can
use movb.


unsigned char vector;

asm("movb %%gs:4, %b0" : "=q"(vector));

> - return vector;
> + return (u8)vector;
> }

>
> +bool exception_rflags_rf(void)
> +{
> + unsigned short rf_flag;
> +
> + asm("mov %%gs:4, %0" : "=rm"(rf_flag));
> + return (rf_flag >> 8) & 1;
> +}
> +

Same here, use "movb %%gs:5, %b0" and an unsigned char.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/