[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/ioemul: Misc improvements to ioport_emulate.c
commit f2f68439daccd7f5766d0c075a43598f626715aa Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Thu Jan 11 12:42:59 2018 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Thu Feb 1 10:54:10 2018 +0000 x86/ioemul: Misc improvements to ioport_emulate.c 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> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/ioport_emulate.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/xen/arch/x86/ioport_emulate.c b/xen/arch/x86/ioport_emulate.c index e80993a..c2aded7 100644 --- a/xen/arch/x86/ioport_emulate.c +++ b/xen/arch/x86/ioport_emulate.c @@ -1,6 +1,6 @@ /****************************************************************************** * ioport_emulate.c - * + * * Handle I/O port access quirks of various platforms. */ @@ -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 */ + }; uint16_t port = regs->dx; uint8_t value = regs->al; if ( (opcode != 0xee) || (port != 0xcd4) || !(value & 0x80) ) return false; - /* pushf */ - io_emul_stub[0] = 0x9c; - /* cli */ - io_emul_stub[1] = 0xfa; - /* out %al,%dx */ - io_emul_stub[2] = 0xee; - /* 1: in %dx,%al */ - io_emul_stub[3] = 0xec; - /* test $0x80,%al */ - io_emul_stub[4] = 0xa8; - io_emul_stub[5] = 0x80; - /* jnz 1b */ - io_emul_stub[6] = 0x75; - io_emul_stub[7] = 0xfb; - /* popf */ - io_emul_stub[8] = 0x9d; - /* ret */ - io_emul_stub[9] = 0xc3; - - BUILD_BUG_ON(IOEMUL_QUIRK_STUB_BYTES < 10); + memcpy(io_emul_stub, stub, sizeof(stub)); + BUILD_BUG_ON(IOEMUL_QUIRK_STUB_BYTES < sizeof(stub)); return true; } -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |