aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--doc/changelog.md1
-rw-r--r--gen/gen_code.cpp9
-rw-r--r--meson.build2
-rw-r--r--readme.md2
-rw-r--r--readme.txt3
-rw-r--r--sample/bf.cpp19
-rw-r--r--sample/calc.cpp1
-rw-r--r--sample/calc2.cpp1
-rw-r--r--sample/jmp_table.cpp1
-rw-r--r--sample/memfd.cpp2
-rw-r--r--sample/memfunc.cpp1
-rw-r--r--sample/protect-re.cpp1
-rw-r--r--sample/quantize.cpp1
-rw-r--r--sample/stackframe.cpp1
-rw-r--r--sample/static_buf.cpp1
-rw-r--r--sample/test0.cpp1
-rw-r--r--sample/toyvm.cpp1
-rw-r--r--test/misc.cpp52
-rw-r--r--xbyak/xbyak.h2
-rw-r--r--xbyak/xbyak_mnemonic.h6
21 files changed, 89 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 70c4314..6baf35e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5)
-project(xbyak LANGUAGES CXX VERSION 7.07.1)
+project(xbyak LANGUAGES CXX VERSION 7.08)
file(GLOB headers xbyak/*.h)
diff --git a/doc/changelog.md b/doc/changelog.md
index 7b390a8..1f5c2c3 100644
--- a/doc/changelog.md
+++ b/doc/changelog.md
@@ -1,5 +1,6 @@
# History
+* 2024/Oct/07 ver 7.08 support rdfsbase etc.
* 2024/Aug/29 ver 7.07.1 adapt to NASM 2.16.03 output of xchg (The functionality stays the same.)
* 2024/Jun/11 ver 7.07 support xresldtrk/xsusldtrk
* 2024/Mar/07 ver 7.06 Xbyak::util::Cpu supports AMD processor
diff --git a/gen/gen_code.cpp b/gen/gen_code.cpp
index e43c9b2..ee8494f 100644
--- a/gen/gen_code.cpp
+++ b/gen/gen_code.cpp
@@ -2057,6 +2057,15 @@ void put64()
// encodekey
puts("void encodekey128(const Reg32& r1, const Reg32& r2) { opEncodeKey(r1, r2, 0xFA, 0xDA); }");
puts("void encodekey256(const Reg32& r1, const Reg32& r2) { opEncodeKey(r1, r2, 0xFB, 0xDB); }");
+ // read/write fs/gs
+ {
+ const char *tbl[] = {
+ "rdfs", "rdgs", "wrfs", "wrgs"
+ };
+ for (int i = 0; i < 4; i++) {
+ printf("void %sbase(const Reg32e& r) { opRR(%s, r, T_F3|T_0F, 0xAE); }\n", tbl[i], Reg(i, Operand::REG, 32).toString());
+ }
+ }
}
void putAMX_TILE()
diff --git a/meson.build b/meson.build
index f53bea2..b5a0ce7 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@
project(
'xbyak',
'cpp',
- version: '7.07.1',
+ version: '7.08',
license: 'BSD-3-Clause',
default_options: 'b_ndebug=if-release'
)
diff --git a/readme.md b/readme.md
index cede3ea..6cab2b8 100644
--- a/readme.md
+++ b/readme.md
@@ -1,5 +1,5 @@
-# Xbyak 7.07.1 [![Badge Build]][Build Status]
+# Xbyak 7.08 [![Badge Build]][Build Status]
*A C++ JIT assembler for x86 (IA32), x64 (AMD64, x86-64)*
diff --git a/readme.txt b/readme.txt
index 1acca54..5bae6c4 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,5 +1,5 @@
- C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 7.07.1
+ C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 7.08
-----------------------------------------------------------------------------
◎概要
@@ -404,6 +404,7 @@ sample/{echo,hello}.bfは http://www.kmonos.net/alang/etc/brainfuck.php から
-----------------------------------------------------------------------------
◎履歴
+2024/10/17 ver 7.08 rdfabaseなどサポート
2024/08/29 ver 7.07.1 xchgの仕様をnasm 2.16.03の挙動に合わせる。
2024/06/11 ver 7.07 xresldtrk/xsusldtrkサポート
2024/03/07 ver 7.06 util::Cpuのキャッシュ判定周りがAMD CPU対応
diff --git a/sample/bf.cpp b/sample/bf.cpp
index 657c87c..06f1dac 100644
--- a/sample/bf.cpp
+++ b/sample/bf.cpp
@@ -1,4 +1,3 @@
-#define XBYAK_NO_OP_NAMES
#include "xbyak/xbyak.h"
#include <stdio.h>
#include <stdlib.h>
@@ -189,18 +188,30 @@ int main(int argc, char *argv[])
fprintf(stderr, "64bit mode\n");
#endif
if (argc == 1) {
- fprintf(stderr, "bf filename.bf [0|1]\n");
+ fprintf(stderr, "bf filename.bf [0|1|2]\n");
return 1;
}
std::ifstream ifs(argv[1]);
int mode = argc == 3 ? atoi(argv[2]) : 0;
try {
Brainfuck bf(ifs);
- if (mode == 0) {
+ switch (mode) {
+ case 0: {
static int stack[128 * 1024];
bf.getCode<void (*)(const void*, const void*, int *)>()(reinterpret_cast<const void*>(putchar), reinterpret_cast<const void*>(getchar), stack);
- } else {
+ break;
+ }
+ case 1: {
dump(bf.getCode(), bf.getSize());
+ break;
+ }
+ default: {
+ const char *dumpName = "bf.dump";
+ printf("dump to %s\n", dumpName);
+ std::ofstream ofs(dumpName, std::ios::binary);
+ ofs.write((const char*)bf.getCode(), bf.getSize());
+ break;
+ }
}
} catch (std::exception& e) {
printf("ERR:%s\n", e.what());
diff --git a/sample/calc.cpp b/sample/calc.cpp
index 29ad9c3..d543d04 100644
--- a/sample/calc.cpp
+++ b/sample/calc.cpp
@@ -10,7 +10,6 @@
#include <stdio.h>
#include <sstream>
#include <map>
-#define XBYAK_NO_OP_NAMES
#include "xbyak/xbyak.h"
#ifdef _MSC_VER
#pragma warning(disable : 4127) // for boost(constant condition)
diff --git a/sample/calc2.cpp b/sample/calc2.cpp
index a13d2cf..62fb900 100644
--- a/sample/calc2.cpp
+++ b/sample/calc2.cpp
@@ -22,7 +22,6 @@
#include <assert.h>
#include <string>
#include <vector>
-#define XBYAK_NO_OP_NAMES
#include "xbyak/xbyak.h"
enum Operand {
diff --git a/sample/jmp_table.cpp b/sample/jmp_table.cpp
index fb47cac..4e0ca6e 100644
--- a/sample/jmp_table.cpp
+++ b/sample/jmp_table.cpp
@@ -2,7 +2,6 @@
sample of move(reg, LABEL);, L(LABEL), putL(LABEL);
*/
#include <stdio.h>
-#define XBYAK_NO_OP_NAMES
#include <xbyak/xbyak.h>
const int expectTbl[] = {
diff --git a/sample/memfd.cpp b/sample/memfd.cpp
index 2b6d08b..312e7ca 100644
--- a/sample/memfd.cpp
+++ b/sample/memfd.cpp
@@ -25,6 +25,7 @@ public:
int main()
{
+ printf("pid=%d\n", getpid());
Code c1("Xbyak::abc", 123);
Code c2("Xbyak::xyz", 456);
printf("c1 %d\n", c1.getCode<int (*)()>()());
@@ -36,4 +37,5 @@ int main()
printf("%s\n", line.c_str());
}
}
+ getchar();
}
diff --git a/sample/memfunc.cpp b/sample/memfunc.cpp
index b97630b..65b0f04 100644
--- a/sample/memfunc.cpp
+++ b/sample/memfunc.cpp
@@ -1,7 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
-#define XBYAK_NO_OP_NAMES
#include <xbyak/xbyak.h>
struct A {
diff --git a/sample/protect-re.cpp b/sample/protect-re.cpp
index 6eaa863..a8f77cd 100644
--- a/sample/protect-re.cpp
+++ b/sample/protect-re.cpp
@@ -1,4 +1,3 @@
-#define XBYAK_NO_OP_NAMES
#include <xbyak/xbyak.h>
struct Code1 : Xbyak::CodeGenerator {
diff --git a/sample/quantize.cpp b/sample/quantize.cpp
index ba0fd22..f45337c 100644
--- a/sample/quantize.cpp
+++ b/sample/quantize.cpp
@@ -42,7 +42,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#define XBYAK_NO_OP_NAMES
#include "xbyak/xbyak.h"
#ifdef _MSC_VER
#pragma warning(disable : 4996) // scanf
diff --git a/sample/stackframe.cpp b/sample/stackframe.cpp
index 7405b40..f324bde 100644
--- a/sample/stackframe.cpp
+++ b/sample/stackframe.cpp
@@ -1,4 +1,3 @@
-#define XBYAK_NO_OP_NAMES
#include <xbyak/xbyak_util.h>
#ifdef XBYAK32
diff --git a/sample/static_buf.cpp b/sample/static_buf.cpp
index 0a8ff57..0d87101 100644
--- a/sample/static_buf.cpp
+++ b/sample/static_buf.cpp
@@ -2,7 +2,6 @@
sample to use static memory
*/
#include <stdio.h>
-#define XBYAK_NO_OP_NAMES
#include "xbyak/xbyak.h"
MIE_ALIGN(4096) char buf[4096];
diff --git a/sample/test0.cpp b/sample/test0.cpp
index afbaf83..924c816 100644
--- a/sample/test0.cpp
+++ b/sample/test0.cpp
@@ -7,7 +7,6 @@
#endif
#include <stdio.h>
#include <stdlib.h>
-#define XBYAK_NO_OP_NAMES
#include "xbyak/xbyak.h"
class Sample : public Xbyak::CodeGenerator {
diff --git a/sample/toyvm.cpp b/sample/toyvm.cpp
index dff0cb7..b6549a1 100644
--- a/sample/toyvm.cpp
+++ b/sample/toyvm.cpp
@@ -27,7 +27,6 @@
#include <stdlib.h>
#include <memory.h>
#include <vector>
-#define XBYAK_NO_OP_NAMES
#include "xbyak/xbyak.h"
#include "xbyak/xbyak_util.h"
#define NUM_OF_ARRAY(x) (sizeof(x) / sizeof(x[0]))
diff --git a/test/misc.cpp b/test/misc.cpp
index 1457691..a15721f 100644
--- a/test/misc.cpp
+++ b/test/misc.cpp
@@ -2284,5 +2284,55 @@ CYBOZU_TEST_AUTO(avx_vnni_int)
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}
-
+CYBOZU_TEST_AUTO(rdfsbase)
+{
+ struct Code : Xbyak::CodeGenerator {
+ Code()
+ {
+ rdfsbase(rax);
+ rdfsbase(r15d);
+ rdfsbase(r30d);
+ rdfsbase(r31);
+
+ rdgsbase(rax);
+ rdgsbase(r15d);
+ rdgsbase(r30d);
+ rdgsbase(r31);
+
+ wrfsbase(rax);
+ wrfsbase(r15d);
+ wrfsbase(r30d);
+ wrfsbase(r31);
+
+ wrgsbase(rax);
+ wrgsbase(r15d);
+ wrgsbase(r30d);
+ wrgsbase(r31);
+ }
+ } c;
+ const uint8_t tbl[] = {
+ 0xf3, 0x48, 0x0f, 0xae, 0xc0,
+ 0xf3, 0x41, 0x0f, 0xae, 0xc7,
+ 0xf3, 0xd5, 0x91, 0xae, 0xc6,
+ 0xf3, 0xd5, 0x99, 0xae, 0xc7,
+
+ 0xf3, 0x48, 0x0f, 0xae, 0xc8,
+ 0xf3, 0x41, 0x0f, 0xae, 0xcf,
+ 0xf3, 0xd5, 0x91, 0xae, 0xce,
+ 0xf3, 0xd5, 0x99, 0xae, 0xcf,
+
+ 0xf3, 0x48, 0x0f, 0xae, 0xd0,
+ 0xf3, 0x41, 0x0f, 0xae, 0xd7,
+ 0xf3, 0xd5, 0x91, 0xae, 0xd6,
+ 0xf3, 0xd5, 0x99, 0xae, 0xd7,
+
+ 0xf3, 0x48, 0x0f, 0xae, 0xd8,
+ 0xf3, 0x41, 0x0f, 0xae, 0xdf,
+ 0xf3, 0xd5, 0x91, 0xae, 0xde,
+ 0xf3, 0xd5, 0x99, 0xae, 0xdf,
+ };
+ const size_t n = sizeof(tbl) / sizeof(tbl[0]);
+ CYBOZU_TEST_EQUAL(c.getSize(), n);
+ CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
+}
#endif
diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h
index e67de82..292fcc7 100644
--- a/xbyak/xbyak.h
+++ b/xbyak/xbyak.h
@@ -155,7 +155,7 @@ namespace Xbyak {
enum {
DEFAULT_MAX_CODE_SIZE = 4096,
- VERSION = 0x7071 /* 0xABCD = A.BC(.D) */
+ VERSION = 0x7080 /* 0xABCD = A.BC(.D) */
};
#ifndef MIE_INTEGER_TYPE_DEFINED
diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h
index 6eb3d63..06eb6d0 100644
--- a/xbyak/xbyak_mnemonic.h
+++ b/xbyak/xbyak_mnemonic.h
@@ -1,4 +1,4 @@
-const char *getVersionString() const { return "7.07.1"; }
+const char *getVersionString() const { return "7.08"; }
void aadd(const Address& addr, const Reg32e &reg) { opMR(addr, reg, T_0F38, 0x0FC, T_APX); }
void aand(const Address& addr, const Reg32e &reg) { opMR(addr, reg, T_0F38|T_66, 0x0FC, T_APX|T_66); }
void adc(const Operand& op, uint32_t imm) { opOI(op, imm, 0x10, 2); }
@@ -1937,6 +1937,10 @@ void aesencwide128kl(const Address& addr) { opSSE_APX(xmm0, addr, T_F3|T_0F38, 0
void aesencwide256kl(const Address& addr) { opSSE_APX(xmm2, addr, T_F3|T_0F38, 0xD8, T_F3|T_MUST_EVEX, 0xD8); }
void encodekey128(const Reg32& r1, const Reg32& r2) { opEncodeKey(r1, r2, 0xFA, 0xDA); }
void encodekey256(const Reg32& r1, const Reg32& r2) { opEncodeKey(r1, r2, 0xFB, 0xDB); }
+void rdfsbase(const Reg32e& r) { opRR(eax, r, T_F3|T_0F, 0xAE); }
+void rdgsbase(const Reg32e& r) { opRR(ecx, r, T_F3|T_0F, 0xAE); }
+void wrfsbase(const Reg32e& r) { opRR(edx, r, T_F3|T_0F, 0xAE); }
+void wrgsbase(const Reg32e& r) { opRR(ebx, r, T_F3|T_0F, 0xAE); }
void ldtilecfg(const Address& addr) { if (opROO(Reg(), addr, tmm0, T_APX|T_0F38|T_W0, 0x49)) return; opVex(tmm0, &tmm0, addr, T_0F38|T_W0, 0x49); }
void sttilecfg(const Address& addr) { if (opROO(Reg(), addr, tmm0, T_APX|T_66|T_0F38|T_W0, 0x49)) return; opVex(tmm0, &tmm0, addr, T_66|T_0F38 | T_W0, 0x49); }
void tileloadd(const Tmm& tm, const Address& addr) { opAMX(tm, addr, T_F2|T_0F38|T_W0, 0x4B); }