diff options
author | MITSUNARI Shigeo <[email protected]> | 2022-04-05 14:56:52 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2022-04-05 14:56:52 +0900 |
commit | 64ec053e6177e7b2cbeca80aaf6bd6f68573cf15 (patch) | |
tree | 4c75a51e378cb3944c4b9ec97d40efe9d955dff4 | |
parent | 764d54f6faaffc14db742465092fd30d340f19b8 (diff) | |
download | xbyak-64ec053e6177e7b2cbeca80aaf6bd6f68573cf15.tar.gz xbyak-64ec053e6177e7b2cbeca80aaf6bd6f68573cf15.zip |
add umonitor
-rw-r--r-- | gen/gen_code.cpp | 1 | ||||
-rw-r--r-- | test/misc.cpp | 10 | ||||
-rw-r--r-- | xbyak/xbyak_mnemonic.h | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/gen/gen_code.cpp b/gen/gen_code.cpp index 231e19a..069ae32 100644 --- a/gen/gen_code.cpp +++ b/gen/gen_code.cpp @@ -1086,6 +1086,7 @@ void put() puts("void rdseed(const Reg& r) { if (r.isBit(8)) XBYAK_THROW(ERR_BAD_SIZE_OF_REGISTER) opModR(Reg(7, Operand::REG, r.getBit()), r, 0x0F, 0xC7); }"); puts("void crc32(const Reg32e& reg, const Operand& op) { if (reg.isBit(32) && op.isBit(16)) db(0x66); db(0xF2); opModRM(reg, op, op.isREG(), op.isMEM(), 0x0F, 0x38, 0xF0 | (op.isBit(8) ? 0 : 1)); }"); puts("void tpause(const Reg32& r) { int idx = r.getIdx(); if (idx > 7) XBYAK_THROW(ERR_BAD_PARAMETER) db(0x66); db(0x0F); db(0xAE); setModRM(3, 6, idx); }"); + puts("void umonitor(const Reg& r) { int idx = r.getIdx(); if (idx > 7) XBYAK_THROW(ERR_BAD_PARAMETER) int bit = r.getBit(); if (BIT != bit) { if ((BIT == 32 && bit == 16) || (BIT == 64 && bit == 32)) { db(0x67); } else { XBYAK_THROW(ERR_BAD_SIZE_OF_REGISTER) } } db(0xF3); db(0x0F); db(0xAE); setModRM(3, 6, idx); }"); } { const struct Tbl { diff --git a/test/misc.cpp b/test/misc.cpp index dad9052..0b664ef 100644 --- a/test/misc.cpp +++ b/test/misc.cpp @@ -1898,12 +1898,22 @@ CYBOZU_TEST_AUTO(misc) { tpause(eax); tpause(ebx); +#ifdef XBYAK32 + umonitor(cx); + umonitor(ecx); +#else + umonitor(ecx); + umonitor(rcx); +#endif } } c; const uint8_t tbl[] = { // tpause 0x66, 0x0f, 0xae, 0xf0, 0x66, 0x0f, 0xae, 0xf3, + // umonitor + 0x67, 0xf3, 0x0f, 0xae, 0xf1, + 0xf3, 0x0f, 0xae, 0xf1, }; const size_t n = sizeof(tbl) / sizeof(tbl[0]); CYBOZU_TEST_EQUAL(c.getSize(), n); diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h index f80417a..e4e623c 100644 --- a/xbyak/xbyak_mnemonic.h +++ b/xbyak/xbyak_mnemonic.h @@ -818,6 +818,7 @@ void tzcnt(const Reg®, const Operand& op) { opSp1(reg, op, 0xF3, 0x0F, 0xBC); void ucomisd(const Xmm& xmm, const Operand& op) { opGen(xmm, op, 0x2E, 0x66, isXMM_XMMorMEM); } void ucomiss(const Xmm& xmm, const Operand& op) { opGen(xmm, op, 0x2E, 0x100, isXMM_XMMorMEM); } void ud2() { db(0x0F); db(0x0B); } +void umonitor(const Reg& r) { int idx = r.getIdx(); if (idx > 7) XBYAK_THROW(ERR_BAD_PARAMETER) int bit = r.getBit(); if (BIT != bit) { if ((BIT == 32 && bit == 16) || (BIT == 64 && bit == 32)) { db(0x67); } else { XBYAK_THROW(ERR_BAD_SIZE_OF_REGISTER) } } db(0xF3); db(0x0F); db(0xAE); setModRM(3, 6, idx); } void unpckhpd(const Xmm& xmm, const Operand& op) { opGen(xmm, op, 0x15, 0x66, isXMM_XMMorMEM); } void unpckhps(const Xmm& xmm, const Operand& op) { opGen(xmm, op, 0x15, 0x100, isXMM_XMMorMEM); } void unpcklpd(const Xmm& xmm, const Operand& op) { opGen(xmm, op, 0x14, 0x66, isXMM_XMMorMEM); } |