about summary refs log tree commit diff stats
path: root/miasm2/jitter
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/jitter')
-rw-r--r--miasm2/jitter/bn.c6
-rw-r--r--miasm2/jitter/bn.h4
-rw-r--r--miasm2/jitter/llvmconvert.py6
-rw-r--r--miasm2/jitter/op_semantics.c18
-rw-r--r--miasm2/jitter/op_semantics.h24
5 files changed, 29 insertions, 29 deletions
diff --git a/miasm2/jitter/bn.c b/miasm2/jitter/bn.c
index 96e66f4d..c621d102 100644
--- a/miasm2/jitter/bn.c
+++ b/miasm2/jitter/bn.c
@@ -796,7 +796,7 @@ int bignum_cnttrailzeros(bn_t n, int size)
 
 
 
-bn_t bignum_idiv(bn_t a, bn_t b, int size)
+bn_t bignum_sdiv(bn_t a, bn_t b, int size)
 {
 	require(size, "size must be greater than 0");
 	require(size <= BN_BIT_SIZE, "size must be below bignum max size");
@@ -832,14 +832,14 @@ bn_t bignum_idiv(bn_t a, bn_t b, int size)
 
 
 
-bn_t bignum_imod(bn_t a, bn_t b, int size)
+bn_t bignum_smod(bn_t a, bn_t b, int size)
 {
 	require(size, "size must be greater than 0");
 	require(size <= BN_BIT_SIZE, "size must be below bignum max size");
 
 	bn_t c;
 
-	c = bignum_idiv(a, b, size);
+	c = bignum_sdiv(a, b, size);
 	c = bignum_mul(c, b);
 	c = bignum_sub(a, c);
 	c = bignum_mask(c, size);
diff --git a/miasm2/jitter/bn.h b/miasm2/jitter/bn.h
index 67d20a77..f0a13b53 100644
--- a/miasm2/jitter/bn.h
+++ b/miasm2/jitter/bn.h
@@ -116,8 +116,8 @@ _MIASM_EXPORT bn_t bignum_sub(bn_t a, bn_t b); /* c = a - b */
 _MIASM_EXPORT bn_t bignum_mul(bn_t a, bn_t b); /* c = a * b */
 _MIASM_EXPORT bn_t bignum_udiv(bn_t a, bn_t b); /* c = a / b */
 _MIASM_EXPORT bn_t bignum_umod(bn_t a, bn_t b); /* c = a % b */
-_MIASM_EXPORT bn_t bignum_idiv(bn_t a, bn_t b, int size);
-_MIASM_EXPORT bn_t bignum_imod(bn_t a, bn_t b, int size);
+_MIASM_EXPORT bn_t bignum_sdiv(bn_t a, bn_t b, int size);
+_MIASM_EXPORT bn_t bignum_smod(bn_t a, bn_t b, int size);
 //void bignum_udivmod(struct bn* a, struct bn* b, struct bn* c, struct bn* d); /* c = a/b, d = a%b */
 
 
diff --git a/miasm2/jitter/llvmconvert.py b/miasm2/jitter/llvmconvert.py
index 37ce8d52..5230bdbe 100644
--- a/miasm2/jitter/llvmconvert.py
+++ b/miasm2/jitter/llvmconvert.py
@@ -874,15 +874,15 @@ class LLVMFunction(object):
                 self.update_cache(expr, ret)
                 return ret
 
-            if op in ["imod", "idiv", "umod", "udiv"]:
+            if op in ["smod", "sdiv", "umod", "udiv"]:
                 assert len(expr.args) == 2
 
                 arg_b = self.add_ir(expr.args[1])
                 arg_a = self.add_ir(expr.args[0])
 
-                if op == "imod":
+                if op == "smod":
                     callback = builder.srem
-                elif op == "idiv":
+                elif op == "sdiv":
                     callback = builder.sdiv
                 elif op == "umod":
                     callback = builder.urem
diff --git a/miasm2/jitter/op_semantics.c b/miasm2/jitter/op_semantics.c
index 091da87f..46e6cca1 100644
--- a/miasm2/jitter/op_semantics.c
+++ b/miasm2/jitter/op_semantics.c
@@ -738,12 +738,12 @@ UMOD(16)
 UMOD(32)
 UMOD(64)
 
-IDIV(8)
-IDIV(16)
-IDIV(32)
-IDIV(64)
-
-IMOD(8)
-IMOD(16)
-IMOD(32)
-IMOD(64)
+SDIV(8)
+SDIV(16)
+SDIV(32)
+SDIV(64)
+
+SMOD(8)
+SMOD(16)
+SMOD(32)
+SMOD(64)
diff --git a/miasm2/jitter/op_semantics.h b/miasm2/jitter/op_semantics.h
index 921c9b9e..690cfb35 100644
--- a/miasm2/jitter/op_semantics.h
+++ b/miasm2/jitter/op_semantics.h
@@ -66,8 +66,8 @@ _MIASM_EXPORT unsigned int cnttrailzeros(uint64_t size, uint64_t src);
 	}
 
 
-#define IDIV(sizeA)						\
-	int ## sizeA ## _t idiv ## sizeA (int ## sizeA ## _t a, int ## sizeA ## _t b) \
+#define SDIV(sizeA)						\
+	int ## sizeA ## _t sdiv ## sizeA (int ## sizeA ## _t a, int ## sizeA ## _t b) \
 	{								\
 		int ## sizeA ## _t r;					\
 		if (b == 0) {						\
@@ -79,8 +79,8 @@ _MIASM_EXPORT unsigned int cnttrailzeros(uint64_t size, uint64_t src);
 	}
 
 
-#define IMOD(sizeA)						\
-	int ## sizeA ## _t imod ## sizeA (int ## sizeA ## _t a, int ## sizeA ## _t b) \
+#define SMOD(sizeA)						\
+	int ## sizeA ## _t smod ## sizeA (int ## sizeA ## _t a, int ## sizeA ## _t b) \
 	{								\
 		int ## sizeA ## _t r;					\
 		if (b == 0) {						\
@@ -93,23 +93,23 @@ _MIASM_EXPORT unsigned int cnttrailzeros(uint64_t size, uint64_t src);
 
 _MIASM_EXPORT uint64_t udiv64(uint64_t a, uint64_t b);
 _MIASM_EXPORT uint64_t umod64(uint64_t a, uint64_t b);
-_MIASM_EXPORT int64_t idiv64(int64_t a, int64_t b);
-_MIASM_EXPORT int64_t imod64(int64_t a, int64_t b);
+_MIASM_EXPORT int64_t sdiv64(int64_t a, int64_t b);
+_MIASM_EXPORT int64_t smod64(int64_t a, int64_t b);
 
 _MIASM_EXPORT uint32_t udiv32(uint32_t a, uint32_t b);
 _MIASM_EXPORT uint32_t umod32(uint32_t a, uint32_t b);
-_MIASM_EXPORT int32_t idiv32(int32_t a, int32_t b);
-_MIASM_EXPORT int32_t imod32(int32_t a, int32_t b);
+_MIASM_EXPORT int32_t sdiv32(int32_t a, int32_t b);
+_MIASM_EXPORT int32_t smod32(int32_t a, int32_t b);
 
 _MIASM_EXPORT uint16_t udiv16(uint16_t a, uint16_t b);
 _MIASM_EXPORT uint16_t umod16(uint16_t a, uint16_t b);
-_MIASM_EXPORT int16_t idiv16(int16_t a, int16_t b);
-_MIASM_EXPORT int16_t imod16(int16_t a, int16_t b);
+_MIASM_EXPORT int16_t sdiv16(int16_t a, int16_t b);
+_MIASM_EXPORT int16_t smod16(int16_t a, int16_t b);
 
 _MIASM_EXPORT uint8_t udiv8(uint8_t a, uint8_t b);
 _MIASM_EXPORT uint8_t umod8(uint8_t a, uint8_t b);
-_MIASM_EXPORT int8_t idiv8(int8_t a, int8_t b);
-_MIASM_EXPORT int8_t imod8(int8_t a, int8_t b);
+_MIASM_EXPORT int8_t sdiv8(int8_t a, int8_t b);
+_MIASM_EXPORT int8_t smod8(int8_t a, int8_t b);
 
 _MIASM_EXPORT unsigned int x86_cpuid(unsigned int a, unsigned int reg_num);