aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2022-01-28 10:57:21 +0900
committerMITSUNARI Shigeo <[email protected]>2022-01-28 10:57:21 +0900
commit82e0deb8ab26764403595f93d93062bd7d99982e (patch)
tree966243ca0c5b045ecc0fea849fbd0f0a702b3870
parent4d9906a94d73b07877b217d1664a991f1e25569f (diff)
downloadxbyak-82e0deb8ab26764403595f93d93062bd7d99982e.tar.gz
xbyak-82e0deb8ab26764403595f93d93062bd7d99982e.zip
v6.02
-rw-r--r--CMakeLists.txt2
-rw-r--r--meson.build2
-rw-r--r--readme.md5
-rw-r--r--readme.txt2
-rw-r--r--test/address.cpp2
-rw-r--r--test/make_nm.cpp4
-rw-r--r--test/misc.cpp11
-rw-r--r--xbyak/xbyak.h8
-rw-r--r--xbyak/xbyak_mnemonic.h2
9 files changed, 31 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8978c3b..e92a621 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 2.6...3.0.2)
-project(xbyak LANGUAGES CXX VERSION 6.01)
+project(xbyak LANGUAGES CXX VERSION 6.02)
file(GLOB headers xbyak/*.h)
diff --git a/meson.build b/meson.build
index a1e69a5..a29dff6 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@
project(
'xbyak',
'cpp',
- version: '6.01',
+ version: '6.02',
license: 'BSD-3-Clause',
default_options: 'b_ndebug=if-release'
)
diff --git a/readme.md b/readme.md
index 4c78f7b..67ab861 100644
--- a/readme.md
+++ b/readme.md
@@ -1,6 +1,6 @@
[![Build Status](https://github.com/herumi/xbyak/actions/workflows/main.yml/badge.svg)](https://github.com/herumi/xbyak/actions/workflows/main.yml)
-# Xbyak 6.01 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
+#lXbyak 6.02 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
## Abstract
@@ -19,6 +19,8 @@ Use `and_()`, `or_()`, ... instead of `and()`, `or()`.
If you want to use them, then specify `-fno-operator-names` option to gcc/clang.
### News
+- strictly check address offset disp32 in a signed 32-bit integer. e.g., `ptr[(void*)0xffffffff]` causes an error.
+ - define `XBYAK_OLD_DISP_CHECK` if you need an old check, but the option will be remoevd.
- add `jmp(mem, T_FAR)`, `call(mem, T_FAR)` `retf()` for far absolute indirect jump.
- vnni instructions such as vpdpbusd supports vex encoding.
- (break backward compatibility) `push(byte, imm)` (resp. `push(word, imm)`) forces to cast `imm` to 8(resp. 16) bit.
@@ -452,6 +454,7 @@ The status will not be changed automatically, then you should reset it by `Xbyak
* define **XBYAK_UNDEF_JNL** if Bessel function jnl is defined as macro.
* define **XBYAK_NO_EXCEPTION** for a compiler option `-fno-exceptions`.
* define **XBYAK_USE_MEMFD** on Linux then /proc/self/maps shows the area used by xbyak.
+* define **XBYAK_OLD_DISP_CHECK** if the old disp check is necessary (deprecated in the future).
## Sample
diff --git a/readme.txt b/readme.txt
index 460da05..216190a 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,5 +1,5 @@
- C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 6.01
+ C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 6.02
-----------------------------------------------------------------------------
◎概要
diff --git a/test/address.cpp b/test/address.cpp
index e713b5a..bb8cd4c 100644
--- a/test/address.cpp
+++ b/test/address.cpp
@@ -93,7 +93,7 @@ void genAddress(bool isJIT, const char regTbl[][5], size_t regTblNum)
}
if (isFirst) {
if (isJIT) printf("(void*)");
- printf("0x%08X", disp);
+ printf("%d", disp);
} else {
if (disp >= 0) {
putchar('+');
diff --git a/test/make_nm.cpp b/test/make_nm.cpp
index 8af0670..c26394a 100644
--- a/test/make_nm.cpp
+++ b/test/make_nm.cpp
@@ -1269,6 +1269,10 @@ class Test {
put("mov", REG64, "0x12345678", "0x12345678");
put("mov", REG64, "0xffffffff12345678LL", "0xffffffff12345678");
put("mov", REG32e|REG16|REG8|RAX|EAX|AX|AL, IMM);
+
+ put("mov", EAX, "ptr[(void*)-1]", "[-1]");
+ put("mov", EAX, "ptr[(void*)0x7fffffff]", "[0x7fffffff]");
+ put("mov", EAX, "ptr[(void*)0xffffffffffffffff]", "[0xffffffffffffffff]");
}
void putEtc() const
{
diff --git a/test/misc.cpp b/test/misc.cpp
index 3b10c99..0e1c3f4 100644
--- a/test/misc.cpp
+++ b/test/misc.cpp
@@ -79,6 +79,17 @@ CYBOZU_TEST_AUTO(mov_const)
CYBOZU_TEST_NO_EXCEPTION(mov(af[eax], v));
}
}
+#ifdef XBYAK64
+ CYBOZU_TEST_NO_EXCEPTION(mov(rax, ptr[(void*)0x7fffffff]));
+ CYBOZU_TEST_EXCEPTION(mov(rax, ptr[(void*)0x17fffffff]), Xbyak::Error);
+#ifdef XBYAK_OLD_DISP_CHECK
+ CYBOZU_TEST_NO_EXCEPTION(mov(rax, ptr[(void*)0x80000000]));
+ CYBOZU_TEST_NO_EXCEPTION(mov(rax, ptr[(void*)0xffffffff]));
+#else
+ CYBOZU_TEST_EXCEPTION(mov(rax, ptr[(void*)0x80000000]), Xbyak::Error);
+ CYBOZU_TEST_EXCEPTION(mov(rax, ptr[(void*)0xffffffff]), Xbyak::Error);
+#endif
+#endif
}
} code;
}
diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h
index bd17021..b99ebfa 100644
--- a/xbyak/xbyak.h
+++ b/xbyak/xbyak.h
@@ -142,7 +142,7 @@ namespace Xbyak {
enum {
DEFAULT_MAX_CODE_SIZE = 4096,
- VERSION = 0x6010 /* 0xABCD = A.BC(D) */
+ VERSION = 0x6020 /* 0xABCD = A.BC(D) */
};
#ifndef MIE_INTEGER_TYPE_DEFINED
@@ -1786,10 +1786,16 @@ private:
{
uint64_t disp64 = e.getDisp();
#ifdef XBYAK64
+#ifdef XBYAK_OLD_DISP_CHECK
+ // treat 0xffffffff as 0xffffffffffffffff
+ uint64_t high = disp64 >> 32;
+ if (high != 0 && high != 0xFFFFFFFF) XBYAK_THROW(ERR_OFFSET_IS_TOO_BIG)
+#else
// displacement should be a signed 32-bit value, so also check sign bit
uint64_t high = disp64 >> 31;
if (high != 0 && high != 0x1FFFFFFFF) XBYAK_THROW(ERR_OFFSET_IS_TOO_BIG)
#endif
+#endif
uint32_t disp = static_cast<uint32_t>(disp64);
const Reg& base = e.getBase();
const Reg& index = e.getIndex();
diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h
index 09f2dcf..4676b56 100644
--- a/xbyak/xbyak_mnemonic.h
+++ b/xbyak/xbyak_mnemonic.h
@@ -1,4 +1,4 @@
-const char *getVersionString() const { return "6.01"; }
+const char *getVersionString() const { return "6.02"; }
void adc(const Operand& op, uint32_t imm) { opRM_I(op, imm, 0x10, 2); }
void adc(const Operand& op1, const Operand& op2) { opRM_RM(op1, op2, 0x10); }
void adcx(const Reg32e& reg, const Operand& op) { opGen(reg, op, 0xF6, 0x66, isREG32_REG32orMEM, NONE, 0x38); }