>>> On 26.01.18 at 15:48, <andrew.coop...@citrix.com> wrote: > Put the opcode into an array and use memcpy. This allows the compiled code to > be written with two movs, rather than 10 mov $imm8's. Also, drop trailing > whitespace in the file. > > Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
It's a clear improvement, so Reviewed-by: Jan Beulich <jbeul...@suse.com> but ... > @@ -11,32 +11,24 @@ > static bool ioemul_handle_proliant_quirk( > u8 opcode, char *io_emul_stub, struct cpu_user_regs *regs) > { > + static const char stub[] = { > + 0x9c, /* pushf */ > + 0xfa, /* cli */ > + 0xee, /* out %al, %dx */ > + 0xec, /* 1: in %dx, %al */ > + 0xa8, 0x80, /* test $0x80, %al */ > + 0x75, 0xfb, /* jnz 1b */ > + 0x9d, /* popf */ > + 0xc3, /* ret */ > + }; ... could you go even further and avoid this hex encoding of insns altogether, but using a file scope asm(), or a function scope one putting this into e.g. .fixup via .pushsection/.popsection? Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel