diff options
| -rw-r--r-- | miasm/expression/expression.py | 4 | ||||
| -rw-r--r-- | miasm/jitter/vm_mngr.h | 2 | ||||
| -rw-r--r-- | test/expression/expression.py | 6 | ||||
| -rw-r--r-- | test/jitter/jitcore.py | 12 |
4 files changed, 15 insertions, 9 deletions
diff --git a/miasm/expression/expression.py b/miasm/expression/expression.py index e5debb34..4b0bbe6b 100644 --- a/miasm/expression/expression.py +++ b/miasm/expression/expression.py @@ -568,11 +568,11 @@ class Expr(object): def __sub__(self, other): return ExprOp('+', self, ExprOp('-', other)) - def __div__(self, other): + def __truediv__(self, other): return ExprOp('/', self, other) def __floordiv__(self, other): - return self.__div__(other) + return self.__truediv__(other) def __mod__(self, other): return ExprOp('%', self, other) diff --git a/miasm/jitter/vm_mngr.h b/miasm/jitter/vm_mngr.h index 4c8383c4..f7aea5b8 100644 --- a/miasm/jitter/vm_mngr.h +++ b/miasm/jitter/vm_mngr.h @@ -39,7 +39,7 @@ #define __BYTE_ORDER __BYTE_ORDER__ #define __BIG_ENDIAN BIG_ENDIAN #define __LITTLE_ENDIAN LITTLE_ENDIAN -#elif defined(__NetBSD__) || defined(__OpenBSD__) +#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) #define __BYTE_ORDER _BYTE_ORDER #define __BIG_ENDIAN _BIG_ENDIAN #define __LITTLE_ENDIAN _LITTLE_ENDIAN diff --git a/test/expression/expression.py b/test/expression/expression.py index 9b0c2807..fa3cf0f7 100644 --- a/test/expression/expression.py +++ b/test/expression/expression.py @@ -80,16 +80,22 @@ assert mem.get_r(mem_read=True) == set([mem, A]) C = A+B D = C + A +E = A / B +F = A // B +assert E is F assert A in A assert A in C assert B in C assert C in C +assert E in E assert A in D assert B in D assert C in D assert D in D +assert A in E +assert B in E assert C not in A assert C not in B diff --git a/test/jitter/jitcore.py b/test/jitter/jitcore.py index 1e009d9a..95245855 100644 --- a/test/jitter/jitcore.py +++ b/test/jitter/jitcore.py @@ -9,16 +9,16 @@ jitter = machine.jitter(loc_db, sys.argv[1]) jitter.cpu.RAX = 16565615892967251934 assert jitter.cpu.RAX == 16565615892967251934 -jitter.cpu.RAX = -1 +jitter.cpu.RAX = -1 & 0xffffffffffffffff assert jitter.cpu.RAX == 0xffffffffffffffff -jitter.cpu.RAX = -2 +jitter.cpu.RAX = -2 & 0xffffffffffffffff assert jitter.cpu.RAX == 0xfffffffffffffffe -jitter.cpu.EAX = -2 +jitter.cpu.EAX = -2 & 0xffffffff assert jitter.cpu.EAX == 0xfffffffe -jitter.cpu.RAX = -0xffffffffffffffff +jitter.cpu.RAX = -0xffffffffffffffff & 0xffffffffffffffff assert jitter.cpu.RAX == 1 try: @@ -35,10 +35,10 @@ except TypeError: else: raise Exception("Should see that 0x10000000000000000 is too big for RAX") -jitter.cpu.EAX = -0xefffffff +jitter.cpu.EAX = -0xefffffff & 0xffffffff assert jitter.cpu.EAX == 0x10000001 -jitter.cpu.EAX = -0xFFFFFFFF +jitter.cpu.EAX = -0xFFFFFFFF & 0xffffffff assert jitter.cpu.EAX == 1 try: |