[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 09/18] x86emul/test: split generic and testcase specific parts



On 15/02/17 11:12, Jan Beulich wrote:
> --- a/tools/tests/x86_emulator/test_x86_emulator.c
> +++ b/tools/tests/x86_emulator/test_x86_emulator.c
> @@ -8,19 +8,37 @@
>  
>  #define verbose false /* Switch to true for far more logging. */
>  
> +static void blowfish_set_regs(struct cpu_user_regs *regs)
> +{
> +    regs->eax = 2;
> +    regs->edx = 1;
> +}
> +
> +static bool blowfish_check_regs(const struct cpu_user_regs *regs)
> +{
> +    return regs->eax == 2 && regs->edx == 1;
> +}
> +
>  static const struct {
>      const void *code;
>      size_t size;
>      unsigned int bitness;
>      const char*name;
> +    void (*set_regs)(struct cpu_user_regs *);
> +    bool (*check_regs)(const struct cpu_user_regs *);
>  } blobs[] = {
> -    { blowfish_x86_32, sizeof(blowfish_x86_32), 32, "blowfish" },
> -    { blowfish_x86_32_mno_accumulate_outgoing_args,
> -      sizeof(blowfish_x86_32_mno_accumulate_outgoing_args),
> -      32, "blowfish (push)" },
> +#define BLOWFISH(bits, desc, tag)               \
> +    { .code = blowfish_x86_##bits##tag,         \
> +      .size = sizeof(blowfish_x86_##bits##tag), \

Do you mind putting spaces in around ## ?  They are binary operators
after all, and it will make the result more legible.

Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

> +      .bitness = bits, .name = #desc,           \
> +      .set_regs = blowfish_set_regs,            \
> +      .check_regs = blowfish_check_regs }
>  #ifdef __x86_64__
> -    { blowfish_x86_64, sizeof(blowfish_x86_64), 64, "blowfish" },
> +    BLOWFISH(64, blowfish, ),
>  #endif
> +    BLOWFISH(32, blowfish, ),
> +    BLOWFISH(32, blowfish (push), _mno_accumulate_outgoing_args),
> +#undef BLOWFISH
>  };
>  
>  static unsigned int bytes_read;
> @@ -2565,13 +2583,40 @@ int main(int argc, char **argv)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.