[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] x86/ioemul: Misc improvements to ioport_emulate.c
On 29/01/18 11:23, Jan Beulich wrote: >>>> On 26.01.18 at 15:48, <andrew.cooper3@xxxxxxxxxx> 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.cooper3@xxxxxxxxxx> > It's a clear improvement, so > Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> > 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? I tried that, but couldn't find a way of creating the blob as a static in C's eyes, or the size out as a build-time constant. ~Andre _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |