about summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/arch/x86/arch.py8
-rw-r--r--test/arch/x86/qemu/testqemu.py6
-rw-r--r--test/core/sembuilder.py11
-rw-r--r--test/test_all.py3
4 files changed, 26 insertions, 2 deletions
diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py
index 5721d72a..7d6260a2 100644
--- a/test/arch/x86/arch.py
+++ b/test/arch/x86/arch.py
@@ -832,6 +832,14 @@ reg_tests = [
      "0fb000"),
     (m32, "00000000    CMPXCHG    DWORD PTR [EAX], EAX",
      "0fb100"),
+    (m16, "00000000    CMPXCHG8B  QWORD PTR [SI+0x24]",
+     "0fc74c24"),
+    (m32, "00000000    CMPXCHG8B  QWORD PTR [ESP+0x8]",
+     "0fc74c2408"),
+    (m64, "00000000    CMPXCHG8B  QWORD PTR [RSP+0x8]",
+     "0fc74c2408"),
+    (m64, "00000000    CMPXCHG16B QWORD PTR [RSP+0x8]",
+     "480fc74c2408"),
 
     (m32, "00000000    CDQ",
      "99"),
diff --git a/test/arch/x86/qemu/testqemu.py b/test/arch/x86/qemu/testqemu.py
index 7cf2ab75..a7df4fe4 100644
--- a/test/arch/x86/qemu/testqemu.py
+++ b/test/arch/x86/qemu/testqemu.py
@@ -45,6 +45,7 @@ def xxx___printf_chk(jitter):
     fmt = get_str_ansi(jitter, args.format)
     # Manage llx
     fmt = fmt.replace("llx", "lx")
+    fmt = fmt.replace("%016lx", "%016z")
 
     fmt_a = parse_fmt(fmt)
     esp = jitter.cpu.ESP
@@ -61,11 +62,16 @@ def xxx___printf_chk(jitter):
             a2 = upck32(jitter.vm.get_mem(esp + 8 + 4*(i+1), 4))
             a = struct.unpack("d", struct.pack("Q", a2 << 32 | a))[0]
             i += 1
+        elif x.lower() == 'z':
+            a2 = upck32(jitter.vm.get_mem(esp + 8 + 4*(i+1), 4))
+            a = a2 << 32 | a
+            i += 1
         else:
             raise RuntimeError("Not implemented format")
         args.append(a)
         i += 1
 
+    fmt = fmt.replace("%016z", "%016lx")
     output = fmt%(tuple(args))
     # NaN bad repr in Python
     output = output.replace("nan", "-nan")
diff --git a/test/core/sembuilder.py b/test/core/sembuilder.py
index 468e3ef5..15fa67a4 100644
--- a/test/core/sembuilder.py
+++ b/test/core/sembuilder.py
@@ -13,9 +13,15 @@ class IR(object):
     def get_next_instr(self, _):
         return asm_label("NEXT")
 
+    def get_next_label(self, _):
+        return asm_label("NEXT")
+
     def gen_label(self):
         return asm_label("GEN")
 
+class Instr(object):
+    mode = 32
+
 # Test
 sb = SemBuilder(m2_expr.__dict__)
 
@@ -28,15 +34,18 @@ def test(Arg1, Arg2, Arg3):
     Arg3 = Arg3 if Arg2 else i32(0)
     tmpvar = 'myop'(i32(2))
     Arg2 = ('myopsize%d' % Arg1.size)(tmpvar, Arg1)
+    alias = Arg1[:24]
 
     if not Arg1:
         Arg2 = Arg3
+    else:
+        alias = {i16(4), i8(5)}
 
 a = m2_expr.ExprId('A')
 b = m2_expr.ExprId('B')
 c = m2_expr.ExprId('C')
 ir = IR()
-instr = None
+instr = Instr()
 res = test(ir, instr, a, b, c)
 
 print "[+] Returned:"
diff --git a/test/test_all.py b/test/test_all.py
index fe9c6880..94f3d8ca 100644
--- a/test/test_all.py
+++ b/test/test_all.py
@@ -108,8 +108,9 @@ QEMU_TESTS = {
     "self_modifying_code": ("tcc", "python"),
     "conv": ("tcc", "python"),
     "bcd": ("tcc", "python"),
+    "xchg": ("tcc", "python"),
     # Unsupported
-    # "floats", "xchg", "string", "misc", "segs", "code16", "exceptions",
+    # "floats", "string", "misc", "segs", "code16", "exceptions",
     # "single_step"
 }