GithubHelp home page GithubHelp logo

Is miasm compatible with OSX ? about miasm HOT 10 CLOSED

cea-sec avatar cea-sec commented on July 17, 2024
Is miasm compatible with OSX ?

from miasm.

Comments (10)

commial avatar commial commented on July 17, 2024 1

Thanks to #408 and #421, clang is now supported (gcc jitter uses now cc, aliased to clang on Mac). We're getting closer!

It seems that some issues regarding bundle / dylib remains (maybe related to the -bundle option used by distutils).

As travis now support OS X builds, once the support work, it could be great to add a new target (test matrix) in the .travis.yml.

from miasm.

serpilliere avatar serpilliere commented on July 17, 2024

Ok. I don't have an OSX but can you try this patch:

diff --git a/miasm2/jitter/vm_mngr.c b/miasm2/jitter/vm_mngr.c
index 188f037..2c98aa1 100644
--- a/miasm2/jitter/vm_mngr.c
+++ b/miasm2/jitter/vm_mngr.c
@@ -227,7 +227,6 @@ static uint64_t memory_page_read(vm_mngr_t* vm_mngr, unsigned int my_size, uint6
                }
                switch(my_size){
                case 8:
-                       ret = ret;
                        break;
                case 16:
                        ret = set_endian16(vm_mngr, ret);
@@ -303,7 +302,6 @@ static void memory_page_write(vm_mngr_t* vm_mngr, unsigned int my_size,
                switch(my_size){

                case 8:
-                       src = src;
                        break;
                case 16:
                        src = set_endian16(vm_mngr, src);
diff --git a/miasm2/jitter/vm_mngr.h b/miasm2/jitter/vm_mngr.h
index e365bce..ce3975d 100644
--- a/miasm2/jitter/vm_mngr.h
+++ b/miasm2/jitter/vm_mngr.h
@@ -20,6 +20,8 @@

 #ifdef __APPLE__
 #define __BYTE_ORDER __BYTE_ORDER__
+#define __BIG_ENDIAN BIG_ENDIAN
+#define __LITTLE_ENDIAN LITTLE_ENDIAN
 #elif defined(__NetBSD__)
 #define __BYTE_ORDER _BYTE_ORDER
 #define __BIG_ENDIAN _BIG_ENDIAN

from miasm.

dummys avatar dummys commented on July 17, 2024

Ok now it's build and install successfully. but when I type python test_all.py the test never finish...

Current mode: Multiprocessing
Nb CPU detected: 4

Success rate: 1/2
Cumulated time: 00:01

FAIL:x86/unit/mn_strings.py
/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore_x86.so:1: error: unrecognized file type
In file included from :12:
In file included from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:19:
In file included from /usr/include/limits.h:63:
/usr/include/sys/cdefs.h:81: warning: #warning "Unsupported compiler detected"
In file included from :12:
In file included from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:42:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
In file included from /usr/include/sys/resource.h:72:
/usr/include/stdint.h:10: error: identifier expected
Erreur de compilation !

An idea ?

from miasm.

serpilliere avatar serpilliere commented on July 17, 2024

I wish I asked an OSX for Chirstmiasm: I will try to find someone owning an OSX to debug this issue

from miasm.

serpilliere avatar serpilliere commented on July 17, 2024

Can you run tests using:

python test_all.py -m 

This will run tests without multiprocessing, and will output a cleaner error log.

from miasm.

dummys avatar dummys commented on July 17, 2024

Yes sure, can we see that on IRC ? It will be more convenient
When launching it it ask for llvm32, I have llvm33... Is miasm compatible with latest llvm version like 35 ?

Here is the output:

[LLVM] Python'py-llvm 3.2' module is required for llvm tests
[TEST/ARCH] Running tests on x86/arch.py ... OK
[TEST/ARCH] Running tests on x86/unit/mn_strings.py ... ERROR
/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore_x86.so:1: error: unrecognized file type
In file included from :12:
In file included from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:19:
In file included from /usr/include/limits.h:63:
/usr/include/sys/cdefs.h:81: warning: #warning "Unsupported compiler detected"
In file included from :12:
In file included from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:42:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
In file included from /usr/include/sys/resource.h:72:
/usr/include/stdint.h:10: error: identifier expected
Erreur de compilation !

#ifdef x86_64
#ifndef LP64
/*
for ubuntu ?!? XXX TODO
/!\ force 64 bit system using 64 bits libc
change this to ILP32 to do so.
*/
#define LP64
#endif
#endif
#include <Python.h>
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/queue.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/vm_mngr.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore_x86.h"

#define RAISE(errtype, msg) {PyObject* p; p = PyErr_Format( errtype, msg ); return p;}
void bloc_main(block_id * BlockDst, vm_cpu_t* vmcpu, vm_mngr_t* vm_mngr){
void* local_labels[] = {&&lbl_gen_00000001, &&lbl_gen_00000002, &&lbl_gen_00000003, &&lbl_gen_00000004};
goto main;
main:

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x0;
Resolve_dst(BlockDst, 0x0, 0);
return;
}

// LEA EDI, DWORD PTR [0xF]
vmcpu->RIP_new = (((((uint64_t)(0x0 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// LEA EDI, DWORD PTR [0xF]
vmcpu->RDI_new = (((((uint64_t)(0xf & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RDI = vmcpu->RDI_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x6;
Resolve_dst(BlockDst, 0x6, 0);
return;
}

// XOR ECX, ECX
vmcpu->RIP_new = (((((uint64_t)(0x6 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// XOR ECX, ECX
vmcpu->RCX_new = (((((uint64_t)((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)^(((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->pf_new = (parity(((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)^(((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff))&0xffffffff)&0xffffffff)&(0xff&0xffffffff))&0xffffffff)&0xffffffff))&0x1;
vmcpu->zf_new = (((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)^(((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff))&0xffffffff)?0x0:0x1))&0x1;
vmcpu->of_new = (0x0)&0x1;
vmcpu->nf_new = ((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)^(((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff))&0xffffffff)>>31) & 0x1))&0x1;
vmcpu->cf_new = (0x0)&0x1;
vmcpu->RCX = vmcpu->RCX_new;
vmcpu->pf = vmcpu->pf_new;
vmcpu->zf = vmcpu->zf_new;
vmcpu->of = vmcpu->of_new;
vmcpu->nf = vmcpu->nf_new;
vmcpu->cf = vmcpu->cf_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x8;
Resolve_dst(BlockDst, 0x8, 0);
return;
}

// DEC ECX
vmcpu->RIP_new = (((((uint64_t)(0x8 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// DEC ECX
vmcpu->af_new = ((((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffff&0xffffffff))&0xffffffff)&0xffffffff)&(0x10&0xffffffff))&0xffffffff)?0x1:0x0))&0x1;
vmcpu->RCX_new = (((((uint64_t)((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffff&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->pf_new = (parity(((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffff&0xffffffff))&0xffffffff)&0xffffffff)&(0xff&0xffffffff))&0xffffffff)&0xffffffff))&0x1;
vmcpu->zf_new = (((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffff&0xffffffff))&0xffffffff)?0x0:0x1))&0x1;
vmcpu->of_new = (((((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)^((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffff&0xffffffff))&0xffffffff)&0xffffffff))&0xffffffff)&0xffffffff)&(((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)^(0xffffffff&0xffffffff))&0xffffffff)&0xffffffff)^(0xffffffff&0xffffffff))&0xffffffff)&0xffffffff))&0xffffffff)>>31) & 0x1))&0x1;
vmcpu->nf_new = ((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffff&0xffffffff))&0xffffffff)>>31) & 0x1))&0x1;
vmcpu->af = vmcpu->af_new;
vmcpu->RCX = vmcpu->RCX_new;
vmcpu->pf = vmcpu->pf_new;
vmcpu->zf = vmcpu->zf_new;
vmcpu->of = vmcpu->of_new;
vmcpu->nf = vmcpu->nf_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x9;
Resolve_dst(BlockDst, 0x9, 0);
return;
}

// REPNE SCASB
vmcpu->RIP_new = (((((uint64_t)(0x9 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// REPNE SCASB
if (((((vmcpu->RCX>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF))
Resolve_dst(BlockDst, 0x2, 1);
else
Resolve_dst(BlockDst, 0xB, 0);

if (BlockDst->is_local) {
goto *local_labels[BlockDst->address];
}
else {
return;
}

lbl_gen_00000004:
// REPNE SCASB
vmcpu->RCX_new = (((((uint64_t)(((((uint32_t)((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x1)&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0)) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
if ((((((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x1)&0xffffffff))&0xffffffff)?0x0:0x1)&0x1)|(vmcpu->zf&0x1))&0x1))
Resolve_dst(BlockDst, 0xB, 0);
else
Resolve_dst(BlockDst, 0x2, 1);
vmcpu->RCX = vmcpu->RCX_new;

if (BlockDst->is_local) {
goto *local_labels[BlockDst->address];
}
else {
return;
}

lbl_gen_00000003:
// REPNE SCASB
vmcpu->pfmem08_0 = MEM_LOOKUP_08(vm_mngr, ((((vmcpu->RDI>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF));
vmcpu->af_new = ((((((((((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFF)&0xff)+(-(vmcpu->pfmem08_0)&0xff))&0xff)&0xff)&(0x10&0xff))&0xff)?0x1:0x0))&0x1;
vmcpu->pf_new = (parity(((((((((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFF)&0xff)+(-(vmcpu->pfmem08_0)&0xff))&0xff)&0xff)&(0xff&0xff))&0xff)&0xff))&0x1;
if (vmcpu->df)
Resolve_dst(BlockDst, 0x1, 1);
else
Resolve_dst(BlockDst, 0x0, 1);
vmcpu->zf_new = (((((((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFF)&0xff)+(-(vmcpu->pfmem08_0)&0xff))&0xff)?0x0:0x1))&0x1;
vmcpu->of_new = (((((((((((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFF)&0xff)^((((((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFF)&0xff)+(-(vmcpu->pfmem08_0)&0xff))&0xff)&0xff))&0xff)&0xff)&((((((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFF)&0xff)^(vmcpu->pfmem08_0&0xff))&0xff)&0xff))&0xff)>>7) & 0x1))&0x1;
vmcpu->nf_new = ((((((((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFF)&0xff)+(-(vmcpu->pfmem08_0)&0xff))&0xff)>>7) & 0x1))&0x1;
vmcpu->cf_new = ((((((((((((((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFF)&0xff)^(vmcpu->pfmem08_0&0xff))&0xff)&0xff)^((((((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFF)&0xff)+(-(vmcpu->pfmem08_0)&0xff))&0xff)&0xff))&0xff)&0xff)^(((((((((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFF)&0xff)^((((((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFF)&0xff)+(-(vmcpu->pfmem08_0)&0xff))&0xff)&0xff))&0xff)&0xff)&((((((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFF)&0xff)^(vmcpu->pfmem08_0&0xff))&0xff)&0xff))&0xff)&0xff))&0xff)>>7) & 0x1))&0x1;

// except fetch mem at instr noauto
if ((vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) & EXCEPT_DO_NOT_UPDATE_PC) {
vmcpu->RIP = 0x9;
Resolve_dst(BlockDst, 0x9, 0);
return;
}

vmcpu->af = vmcpu->af_new;
vmcpu->pf = vmcpu->pf_new;
vmcpu->zf = vmcpu->zf_new;
vmcpu->of = vmcpu->of_new;
vmcpu->nf = vmcpu->nf_new;
vmcpu->cf = vmcpu->cf_new;

// except post instr noauto
if (vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) {
vmcpu->RIP = 0x9;
Resolve_dst(BlockDst, 0x9, 0);
return;
}

if (BlockDst->is_local) {
goto *local_labels[BlockDst->address];
}
else {
return;
}

lbl_gen_00000001:
// REPNE SCASB
vmcpu->RDI_new = (((((uint64_t)(((((uint32_t)((((((((vmcpu->RDI>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0x1&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0)) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
Resolve_dst(BlockDst, 0x3, 1);
vmcpu->RDI = vmcpu->RDI_new;

if (BlockDst->is_local) {
goto *local_labels[BlockDst->address];
}
else {
return;
}

lbl_gen_00000002:
// REPNE SCASB
vmcpu->RDI_new = (((((uint64_t)(((((uint32_t)((((((((vmcpu->RDI>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x1)&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0)) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
Resolve_dst(BlockDst, 0x3, 1);
vmcpu->RDI = vmcpu->RDI_new;

if (BlockDst->is_local) {
goto *local_labels[BlockDst->address];
}
else {
return;
}

loc_000000000000000B:

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0xb;
Resolve_dst(BlockDst, 0xB, 0);
return;
}

// NOT ECX
vmcpu->RIP_new = (((((uint64_t)(0xb & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// NOT ECX
vmcpu->RCX_new = (((((uint64_t)((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)^(0xffffffff&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RCX = vmcpu->RCX_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0xd;
Resolve_dst(BlockDst, 0xD, 0);
return;
}

// DEC ECX
vmcpu->RIP_new = (((((uint64_t)(0xd & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// DEC ECX
vmcpu->af_new = ((((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffff&0xffffffff))&0xffffffff)&0xffffffff)&(0x10&0xffffffff))&0xffffffff)?0x1:0x0))&0x1;
vmcpu->RCX_new = (((((uint64_t)((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffff&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->pf_new = (parity(((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffff&0xffffffff))&0xffffffff)&0xffffffff)&(0xff&0xffffffff))&0xffffffff)&0xffffffff))&0x1;
vmcpu->zf_new = (((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffff&0xffffffff))&0xffffffff)?0x0:0x1))&0x1;
vmcpu->of_new = (((((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)^((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffff&0xffffffff))&0xffffffff)&0xffffffff))&0xffffffff)&0xffffffff)&(((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)^(0xffffffff&0xffffffff))&0xffffffff)&0xffffffff)^(0xffffffff&0xffffffff))&0xffffffff)&0xffffffff))&0xffffffff)>>31) & 0x1))&0x1;
vmcpu->nf_new = ((((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffff&0xffffffff))&0xffffffff)>>31) & 0x1))&0x1;
vmcpu->af = vmcpu->af_new;
vmcpu->RCX = vmcpu->RCX_new;
vmcpu->pf = vmcpu->pf_new;
vmcpu->zf = vmcpu->zf_new;
vmcpu->of = vmcpu->of_new;
vmcpu->nf = vmcpu->nf_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0xe;
Resolve_dst(BlockDst, 0xE, 0);
return;
}

// RET
vmcpu->RIP_new = (((((uint64_t)(0xe & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// RET
vmcpu->pfmem32_0 = MEM_LOOKUP_32(vm_mngr, ((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF));
vmcpu->RSP_new = (((((uint64_t)(((((uint32_t)((((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0x4&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0)) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP_new = (((((uint64_t)(vmcpu->pfmem32_0 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
Resolve_dst(BlockDst, vmcpu->pfmem32_0, 0);

// except fetch mem at instr noauto
if ((vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) & EXCEPT_DO_NOT_UPDATE_PC) {
vmcpu->RIP = 0xe;
Resolve_dst(BlockDst, 0xE, 0);
return;
}

vmcpu->RSP = vmcpu->RSP_new;
vmcpu->RIP = vmcpu->RIP_new;

// except post instr noauto
if (vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) {
vmcpu->RIP = 0xf;
Resolve_dst(BlockDst, 0xF, 0);
return;
}

if (BlockDst->is_local) {
goto *local_labels[BlockDst->address];
}
else {
return;
}

}

[TEST/ARCH] Running tests on arm/arch.py ... OK
[TEST/ARCH] Running tests on msp430/arch.py ... OK
[TEST/ARCH] Running tests on sh4/arch.py ... OK
[TEST/CORE] Running tests on interval.py ... OK
[TEST/CORE] Running tests on parse_asm.py ... OK
[TEST/EXPRESSION] Running tests on stp.py ... OK
[TEST/EXPRESSION] Running tests on expression_helper.py ... OK
[TEST/IR] Running tests on symbexec.py ... OK
[EXAMPLE/] Running tests on asm_x86.py ... OK
[EXAMPLE/] Running tests on asm_armt.py ... OK
[EXAMPLE/] Running tests on asm_box_x86_32_enc.py ... OK
[EXAMPLE/] Running tests on asm_box_x86_32_mod_self.py ... OK
[EXAMPLE/] Running tests on asm_msp430_sc.py ... OK
[EXAMPLE/] Running tests on disasm_01.py ... OK
[EXAMPLE/] Running tests on disasm_03.py box_upx.exe 0x410f90 ... OK
[EXAMPLE/] Running tests on expression/graph_dataflow.py expression/sc_connect_back.bin 0x2e ... OK
[EXAMPLE/] Running tests on expression/get_read_write.py ... OK
[EXAMPLE/] Running tests on symbol_exec.py ... OK
[EXAMPLE/] Running tests on expression/basic_simplification.py ... OK
[EXAMPLE/] Running tests on expression/expr_grapher.py ... OK
[EXAMPLE/] Running tests on expression/expr_random.py ... OK
[EXAMPLE/] Running tests on unpack_upx.py box_upx.exe --jitter tcc ... ERROR
WARNING: reach nul instr at 401130
WARNING:asmbloc:reach nul instr at 401130
/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore_x86.so:1: error: unrecognized file type
In file included from :12:
In file included from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:19:
In file included from /usr/include/limits.h:63:
/usr/include/sys/cdefs.h:81: warning: #warning "Unsupported compiler detected"
In file included from :12:
In file included from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:42:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
In file included from /usr/include/sys/resource.h:72:
/usr/include/stdint.h:10: error: identifier expected
Erreur de compilation !

#ifdef x86_64
#ifndef LP64
/*
for ubuntu ?!? XXX TODO
/!\ force 64 bit system using 64 bits libc
change this to ILP32 to do so.
*/
#define LP64
#endif
#endif
#include <Python.h>
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/queue.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/vm_mngr.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore_x86.h"

#define RAISE(errtype, msg) {PyObject* p; p = PyErr_Format( errtype, msg ); return p;}
void bloc_loc_0000000000410F90(block_id * BlockDst, vm_cpu_t* vmcpu, vm_mngr_t* vm_mngr){
void* local_labels[] = {};
goto loc_0000000000410F90;
loc_0000000000410F90:

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x410f90;
Resolve_dst(BlockDst, 0x410F90, 0);
return;
}

// PUSHAD
vmcpu->RIP_new = (((((uint64_t)(0x410f90 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// PUSHAD
vmcpu->RSP_new = (((((uint64_t)(((((uint32_t)((((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffe0&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0)) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0xfffffffc&0xffffffff))&0xffffffff), ((((vmcpu->RAX>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF));
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0xfffffff8&0xffffffff))&0xffffffff), ((((vmcpu->RCX>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF));
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0xfffffff4&0xffffffff))&0xffffffff), ((((vmcpu->RDX>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF));
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0xfffffff0&0xffffffff))&0xffffffff), ((((vmcpu->RBX>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF));
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffec&0xffffffff))&0xffffffff), ((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF));
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffe8&0xffffffff))&0xffffffff), ((((vmcpu->RBP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF));
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffe4&0xffffffff))&0xffffffff), ((((vmcpu->RSI>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF));
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffffffe0&0xffffffff))&0xffffffff), ((((vmcpu->RDI>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF));

// except fetch mem at instr noauto
if ((vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) & EXCEPT_DO_NOT_UPDATE_PC) {
vmcpu->RIP = 0x410f90;
Resolve_dst(BlockDst, 0x410F90, 0);
return;
}

vmcpu->RSP = vmcpu->RSP_new;

// except post instr noauto
if (vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) {
vmcpu->RIP = 0x410f91;
Resolve_dst(BlockDst, 0x410F91, 0);
return;
}

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x410f91;
Resolve_dst(BlockDst, 0x410F91, 0);
return;
}

// MOV ESI, 0x410015
vmcpu->RIP_new = (((((uint64_t)(0x410f91 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// MOV ESI, 0x410015
vmcpu->RSI_new = (((((uint64_t)(0x410015 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RSI = vmcpu->RSI_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x410f96;
Resolve_dst(BlockDst, 0x410F96, 0);
return;
}

// LEA EDI, DWORD PTR [ESI+0xFFFF0FEB]
vmcpu->RIP_new = (((((uint64_t)(0x410f96 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// LEA EDI, DWORD PTR [ESI+0xFFFF0FEB]
vmcpu->RDI_new = (((((uint64_t)((((((vmcpu->RSI>>0) & 0xFFFFFFFF)&0xffffffff)+(0xffff0feb&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RDI = vmcpu->RDI_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x410f9c;
Resolve_dst(BlockDst, 0x410F9C, 0);
return;
}

// PUSH EDI
vmcpu->RIP_new = (((((uint64_t)(0x410f9c & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// PUSH EDI
vmcpu->RSP_new = (((((uint64_t)(((((uint32_t)((((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x4)&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0)) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x4)&0xffffffff))&0xffffffff), ((vmcpu->RDI>>0) & 0xFFFFFFFF));

// except fetch mem at instr noauto
if ((vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) & EXCEPT_DO_NOT_UPDATE_PC) {
vmcpu->RIP = 0x410f9c;
Resolve_dst(BlockDst, 0x410F9C, 0);
return;
}

vmcpu->RSP = vmcpu->RSP_new;

// except post instr noauto
if (vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) {
vmcpu->RIP = 0x410f9d;
Resolve_dst(BlockDst, 0x410F9D, 0);
return;
}

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x410f9d;
Resolve_dst(BlockDst, 0x410F9D, 0);
return;
}

// OR EBP, 0xFFFFFFFF
vmcpu->RIP_new = (((((uint64_t)(0x410f9d & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// OR EBP, 0xFFFFFFFF
vmcpu->RBP_new = (((((uint64_t)((((((vmcpu->RBP>>0) & 0xFFFFFFFF)&0xffffffff)|(0xffffffff&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->pf_new = (parity(((((((((vmcpu->RBP>>0) & 0xFFFFFFFF)&0xffffffff)|(0xffffffff&0xffffffff))&0xffffffff)&0xffffffff)&(0xff&0xffffffff))&0xffffffff)&0xffffffff))&0x1;
vmcpu->zf_new = (((((((vmcpu->RBP>>0) & 0xFFFFFFFF)&0xffffffff)|(0xffffffff&0xffffffff))&0xffffffff)?0x0:0x1))&0x1;
vmcpu->of_new = (0x0)&0x1;
vmcpu->nf_new = ((((((((vmcpu->RBP>>0) & 0xFFFFFFFF)&0xffffffff)|(0xffffffff&0xffffffff))&0xffffffff)>>31) & 0x1))&0x1;
vmcpu->cf_new = (0x0)&0x1;
vmcpu->RBP = vmcpu->RBP_new;
vmcpu->pf = vmcpu->pf_new;
vmcpu->zf = vmcpu->zf_new;
vmcpu->of = vmcpu->of_new;
vmcpu->nf = vmcpu->nf_new;
vmcpu->cf = vmcpu->cf_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x410fa0;
Resolve_dst(BlockDst, 0x410FA0, 0);
return;
}

// JMP loc_0000000000410FB2:0x00410fb2
vmcpu->RIP_new = (((((uint64_t)(0x410fa0 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// JMP loc_0000000000410FB2:0x00410fb2
vmcpu->RIP_new = (((((uint64_t)(0x410fb2 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
Resolve_dst(BlockDst, 0x410FB2, 0);
vmcpu->RIP = vmcpu->RIP_new;

if (BlockDst->is_local) {
goto *local_labels[BlockDst->address];
}
else {
return;
}

}

[EXAMPLE/] Running tests on test_jit_x86_32.py x86_32_sc.bin --jitter tcc ... ERROR
/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore_x86.so:1: error: unrecognized file type
In file included from :12:
In file included from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:19:
In file included from /usr/include/limits.h:63:
/usr/include/sys/cdefs.h:81: warning: #warning "Unsupported compiler detected"
In file included from :12:
In file included from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:42:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
In file included from /usr/include/sys/resource.h:72:
/usr/include/stdint.h:10: error: identifier expected
Erreur de compilation !

#ifdef x86_64
#ifndef LP64
/*
for ubuntu ?!? XXX TODO
/!\ force 64 bit system using 64 bits libc
change this to ILP32 to do so.
*/
#define LP64
#endif
#endif
#include <Python.h>
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/queue.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/vm_mngr.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore_x86.h"

#define RAISE(errtype, msg) {PyObject* p; p = PyErr_Format( errtype, msg ); return p;}
void bloc_loc_0000000040000000(block_id * BlockDst, vm_cpu_t* vmcpu, vm_mngr_t* vm_mngr){
void* local_labels[] = {};
goto loc_0000000040000000;
loc_0000000040000000:

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x40000000;
Resolve_dst(BlockDst, 0x40000000, 0);
return;
}

dump_gpregs(vmcpu);
printf("40000000 LEA ECX, DWORD PTR [ECX+0x4]\n");
// LEA ECX, DWORD PTR [ECX+0x4]
vmcpu->RIP_new = (((((uint64_t)(0x40000000 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// LEA ECX, DWORD PTR [ECX+0x4]
vmcpu->RCX_new = (((((uint64_t)((((((vmcpu->RCX>>0) & 0xFFFFFFFF)&0xffffffff)+(0x4&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RCX = vmcpu->RCX_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x40000003;
Resolve_dst(BlockDst, 0x40000003, 0);
return;
}

dump_gpregs(vmcpu);
printf("40000003 LEA EBX, DWORD PTR [EBX+0x1]\n");
// LEA EBX, DWORD PTR [EBX+0x1]
vmcpu->RIP_new = (((((uint64_t)(0x40000003 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// LEA EBX, DWORD PTR [EBX+0x1]
vmcpu->RBX_new = (((((uint64_t)((((((vmcpu->RBX>>0) & 0xFFFFFFFF)&0xffffffff)+(0x1&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RBX = vmcpu->RBX_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x40000006;
Resolve_dst(BlockDst, 0x40000006, 0);
return;
}

dump_gpregs(vmcpu);
printf("40000006 CMP CL, 0x1\n");
// CMP CL, 0x1
vmcpu->RIP_new = (((((uint64_t)(0x40000006 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// CMP CL, 0x1
vmcpu->af_new = ((((((((((vmcpu->RCX>>0) & 0xFF)&0xff)+(-(0x1)&0xff))&0xff)&0xff)&(0x10&0xff))&0xff)?0x1:0x0))&0x1;
vmcpu->pf_new = (parity(((((((((vmcpu->RCX>>0) & 0xFF)&0xff)+(-(0x1)&0xff))&0xff)&0xff)&(0xff&0xff))&0xff)&0xff))&0x1;
vmcpu->zf_new = (((((((vmcpu->RCX>>0) & 0xFF)&0xff)+(-(0x1)&0xff))&0xff)?0x0:0x1))&0x1;
vmcpu->of_new = (((((((((((vmcpu->RCX>>0) & 0xFF)&0xff)^((((((vmcpu->RCX>>0) & 0xFF)&0xff)+(-(0x1)&0xff))&0xff)&0xff))&0xff)&0xff)&((((((vmcpu->RCX>>0) & 0xFF)&0xff)^(0x1&0xff))&0xff)&0xff))&0xff)>>7) & 0x1))&0x1;
vmcpu->nf_new = ((((((((vmcpu->RCX>>0) & 0xFF)&0xff)+(-(0x1)&0xff))&0xff)>>7) & 0x1))&0x1;
vmcpu->cf_new = ((((((((((((((vmcpu->RCX>>0) & 0xFF)&0xff)^(0x1&0xff))&0xff)&0xff)^((((((vmcpu->RCX>>0) & 0xFF)&0xff)+(-(0x1)&0xff))&0xff)&0xff))&0xff)&0xff)^(((((((((vmcpu->RCX>>0) & 0xFF)&0xff)^((((((vmcpu->RCX>>0) & 0xFF)&0xff)+(-(0x1)&0xff))&0xff)&0xff))&0xff)&0xff)&((((((vmcpu->RCX>>0) & 0xFF)&0xff)^(0x1&0xff))&0xff)&0xff))&0xff)&0xff))&0xff)>>7) & 0x1))&0x1;
vmcpu->af = vmcpu->af_new;
vmcpu->pf = vmcpu->pf_new;
vmcpu->zf = vmcpu->zf_new;
vmcpu->of = vmcpu->of_new;
vmcpu->nf = vmcpu->nf_new;
vmcpu->cf = vmcpu->cf_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x40000009;
Resolve_dst(BlockDst, 0x40000009, 0);
return;
}

dump_gpregs(vmcpu);
printf("40000009 JZ loc_0000000040000010:0x40000010\n");
// JZ loc_0000000040000010:0x40000010
vmcpu->RIP_new = (((((uint64_t)(0x40000009 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// JZ loc_0000000040000010:0x40000010
vmcpu->RIP_new = (((((uint64_t)((vmcpu->zf?0x40000010:0x4000000b) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
if (vmcpu->zf)
Resolve_dst(BlockDst, 0x40000010, 0);
else
Resolve_dst(BlockDst, 0x4000000B, 0);
vmcpu->RIP = vmcpu->RIP_new;

if (BlockDst->is_local) {
goto *local_labels[BlockDst->address];
}
else {
return;
}

}

[EXAMPLE/] Running tests on test_jit_arm.py md5_arm -a A684 --jitter tcc ... ERROR
/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore_arm.so:1: error: unrecognized file type
In file included from :12:
In file included from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:19:
In file included from /usr/include/limits.h:63:
/usr/include/sys/cdefs.h:81: warning: #warning "Unsupported compiler detected"
In file included from :12:
In file included from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:42:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
In file included from /usr/include/sys/resource.h:72:
/usr/include/stdint.h:10: error: identifier expected
Erreur de compilation !

#ifdef x86_64
#ifndef LP64
/*
for ubuntu ?!? XXX TODO
/!\ force 64 bit system using 64 bits libc
change this to ILP32 to do so.
*/
#define LP64
#endif
#endif
#include <Python.h>
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/queue.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/vm_mngr.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore_arm.h"

#define RAISE(errtype, msg) {PyObject* p; p = PyErr_Format( errtype, msg ); return p;}
void bloc_loc_000000000000A684(block_id * BlockDst, vm_cpu_t* vmcpu, vm_mngr_t* vm_mngr){
void* local_labels[] = {};
goto loc_000000000000A684;
loc_000000000000A684:

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->PC = 0xa684;
Resolve_dst(BlockDst, 0xA684, 0);
return;
}

// MOV R12, SP
vmcpu->PC_new = (0xa684)&0xFFFFFFFF;
vmcpu->PC = vmcpu->PC_new;
// MOV R12, SP
vmcpu->R12_new = (vmcpu->SP)&0xFFFFFFFF;
vmcpu->R12 = vmcpu->R12_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->PC = 0xa688;
Resolve_dst(BlockDst, 0xA688, 0);
return;
}

// STMFD SP!, {R11, R12, LR, PC}
vmcpu->PC_new = (0xa688)&0xFFFFFFFF;
vmcpu->PC = vmcpu->PC_new;
// STMFD SP!, {R11, R12, LR, PC}
vmcpu->SP_new = (((((((vmcpu->SP&0xffffffff)+(0xfffffffc&0xffffffff))&0xffffffff)&0xffffffff)+(0xfffffff4&0xffffffff))&0xffffffff))&0xFFFFFFFF;
MEM_WRITE_32(vm_mngr, ((((((vmcpu->SP&0xffffffff)+(0xfffffffc&0xffffffff))&0xffffffff)&0xffffffff)+(0x0&0xffffffff))&0xffffffff), 0xa690);
MEM_WRITE_32(vm_mngr, ((((((vmcpu->SP&0xffffffff)+(0xfffffffc&0xffffffff))&0xffffffff)&0xffffffff)+(0xfffffffc&0xffffffff))&0xffffffff), vmcpu->LR);
MEM_WRITE_32(vm_mngr, ((((((vmcpu->SP&0xffffffff)+(0xfffffffc&0xffffffff))&0xffffffff)&0xffffffff)+(0xfffffff8&0xffffffff))&0xffffffff), vmcpu->R12);
MEM_WRITE_32(vm_mngr, ((((((vmcpu->SP&0xffffffff)+(0xfffffffc&0xffffffff))&0xffffffff)&0xffffffff)+(0xfffffff4&0xffffffff))&0xffffffff), vmcpu->R11);

// except fetch mem at instr noauto
if ((vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) & EXCEPT_DO_NOT_UPDATE_PC) {
vmcpu->PC = 0xa688;
Resolve_dst(BlockDst, 0xA688, 0);
return;
}

vmcpu->SP = vmcpu->SP_new;

// except post instr noauto
if (vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) {
vmcpu->PC = 0xa68c;
Resolve_dst(BlockDst, 0xA68C, 0);
return;
}

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->PC = 0xa68c;
Resolve_dst(BlockDst, 0xA68C, 0);
return;
}

// SUB R11, R12, 0x4
vmcpu->PC_new = (0xa68c)&0xFFFFFFFF;
vmcpu->PC = vmcpu->PC_new;
// SUB R11, R12, 0x4
vmcpu->R11_new = ((((vmcpu->R12&0xffffffff)+(-(0x4)&0xffffffff))&0xffffffff))&0xFFFFFFFF;
vmcpu->R11 = vmcpu->R11_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->PC = 0xa690;
Resolve_dst(BlockDst, 0xA690, 0);
return;
}

// SUB SP, SP, 0x270
vmcpu->PC_new = (0xa690)&0xFFFFFFFF;
vmcpu->PC = vmcpu->PC_new;
// SUB SP, SP, 0x270
vmcpu->SP_new = ((((vmcpu->SP&0xffffffff)+(-(0x270)&0xffffffff))&0xffffffff))&0xFFFFFFFF;
vmcpu->SP = vmcpu->SP_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->PC = 0xa694;
Resolve_dst(BlockDst, 0xA694, 0);
return;
}

// SUB R3, R11, 0x64
vmcpu->PC_new = (0xa694)&0xFFFFFFFF;
vmcpu->PC = vmcpu->PC_new;
// SUB R3, R11, 0x64
vmcpu->R3_new = ((((vmcpu->R11&0xffffffff)+(-(0x64)&0xffffffff))&0xffffffff))&0xFFFFFFFF;
vmcpu->R3 = vmcpu->R3_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->PC = 0xa698;
Resolve_dst(BlockDst, 0xA698, 0);
return;
}

// MOV R0, R3
vmcpu->PC_new = (0xa698)&0xFFFFFFFF;
vmcpu->PC = vmcpu->PC_new;
// MOV R0, R3
vmcpu->R0_new = (vmcpu->R3)&0xFFFFFFFF;
vmcpu->R0 = vmcpu->R0_new;

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->PC = 0xa69c;
Resolve_dst(BlockDst, 0xA69C, 0);
return;
}

// BL loc_0000000000008538:0x00008538
vmcpu->PC_new = (0xa69c)&0xFFFFFFFF;
vmcpu->PC = vmcpu->PC_new;
// BL loc_0000000000008538:0x00008538
vmcpu->LR_new = (0xa6a0)&0xFFFFFFFF;
vmcpu->PC_new = (0x8538)&0xFFFFFFFF;
Resolve_dst(BlockDst, 0x8538, 0);
vmcpu->LR = vmcpu->LR_new;
vmcpu->PC = vmcpu->PC_new;

if (BlockDst->is_local) {
goto *local_labels[BlockDst->address];
}
else {
return;
}

}

[TEST/ARCH] Running tests on x86/sem.py ... OK
[TEST/ARCH] Running tests on arm/sem.py ... OK
[TEST/ARCH] Running tests on mips32/arch.py ... OK
[TEST/EXPRESSION] Running tests on modint.py ... OK
[TEST/IR] Running tests on ir2C.py ... OK
[EXAMPLE/] Running tests on asm_arm.py ... OK
[EXAMPLE/] Running tests on asm_box_x86_32_mod.py ... OK
[EXAMPLE/] Running tests on asm_mips32.py ... OK
[EXAMPLE/] Running tests on expression/asm_to_ir.py ... OK
[EXAMPLE/] Running tests on expression/basic_op.py ... OK
[EXAMPLE/] Running tests on expression/simplification_add.py ... OK
[EXAMPLE/] Running tests on unpack_upx.py box_upx.exe --jitter python ... OK
[EXAMPLE/] Running tests on test_dis.py -g -s -m x86_32 box_x86_32.bin 0x401000 ... OK
[EXAMPLE/] Running tests on sandbox_pe_x86_32.py box_x86_32.bin --jitter python ... OK
[EXAMPLE/] Running tests on sandbox_pe_x86_32.py box_x86_32.bin --jitter tcc ... ERROR
/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore_x86.so:1: error: unrecognized file type
In file included from :12:
In file included from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:19:
In file included from /usr/include/limits.h:63:
/usr/include/sys/cdefs.h:81: warning: #warning "Unsupported compiler detected"
In file included from :12:
In file included from /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:42:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
In file included from /usr/include/sys/resource.h:72:
/usr/include/stdint.h:10: error: identifier expected
Erreur de compilation !

#ifdef x86_64
#ifndef LP64
/*
for ubuntu ?!? XXX TODO
/!\ force 64 bit system using 64 bits libc
change this to ILP32 to do so.
*/
#define LP64
#endif
#endif
#include <Python.h>
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/queue.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/vm_mngr.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore.h"
#include "/usr/local/lib/python2.7/site-packages/miasm2/jitter/arch/JitCore_x86.h"

#define RAISE(errtype, msg) {PyObject* p; p = PyErr_Format( errtype, msg ); return p;}
void bloc_loc_0000000000401000(block_id * BlockDst, vm_cpu_t* vmcpu, vm_mngr_t* vm_mngr){
void* local_labels[] = {};
goto loc_0000000000401000;
loc_0000000000401000:

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x401000;
Resolve_dst(BlockDst, 0x401000, 0);
return;
}

// PUSH 0x0
vmcpu->RIP_new = (((((uint64_t)(0x401000 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// PUSH 0x0
vmcpu->RSP_new = (((((uint64_t)(((((uint32_t)((((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x4)&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0)) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x4)&0xffffffff))&0xffffffff), 0x0);

// except fetch mem at instr noauto
if ((vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) & EXCEPT_DO_NOT_UPDATE_PC) {
vmcpu->RIP = 0x401000;
Resolve_dst(BlockDst, 0x401000, 0);
return;
}

vmcpu->RSP = vmcpu->RSP_new;

// except post instr noauto
if (vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) {
vmcpu->RIP = 0x401002;
Resolve_dst(BlockDst, 0x401002, 0);
return;
}

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x401002;
Resolve_dst(BlockDst, 0x401002, 0);
return;
}

// PUSH 0x401015
vmcpu->RIP_new = (((((uint64_t)(0x401002 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// PUSH 0x401015
vmcpu->RSP_new = (((((uint64_t)(((((uint32_t)((((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x4)&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0)) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x4)&0xffffffff))&0xffffffff), 0x401015);

// except fetch mem at instr noauto
if ((vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) & EXCEPT_DO_NOT_UPDATE_PC) {
vmcpu->RIP = 0x401002;
Resolve_dst(BlockDst, 0x401002, 0);
return;
}

vmcpu->RSP = vmcpu->RSP_new;

// except post instr noauto
if (vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) {
vmcpu->RIP = 0x401007;
Resolve_dst(BlockDst, 0x401007, 0);
return;
}

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x401007;
Resolve_dst(BlockDst, 0x401007, 0);
return;
}

// PUSH 0x40101C
vmcpu->RIP_new = (((((uint64_t)(0x401007 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// PUSH 0x40101C
vmcpu->RSP_new = (((((uint64_t)(((((uint32_t)((((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x4)&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0)) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x4)&0xffffffff))&0xffffffff), 0x40101c);

// except fetch mem at instr noauto
if ((vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) & EXCEPT_DO_NOT_UPDATE_PC) {
vmcpu->RIP = 0x401007;
Resolve_dst(BlockDst, 0x401007, 0);
return;
}

vmcpu->RSP = vmcpu->RSP_new;

// except post instr noauto
if (vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) {
vmcpu->RIP = 0x40100c;
Resolve_dst(BlockDst, 0x40100C, 0);
return;
}

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x40100c;
Resolve_dst(BlockDst, 0x40100C, 0);
return;
}

// PUSH 0x0
vmcpu->RIP_new = (((((uint64_t)(0x40100c & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// PUSH 0x0
vmcpu->RSP_new = (((((uint64_t)(((((uint32_t)((((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x4)&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0)) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(-(0x4)&0xffffffff))&0xffffffff), 0x0);

// except fetch mem at instr noauto
if ((vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) & EXCEPT_DO_NOT_UPDATE_PC) {
vmcpu->RIP = 0x40100c;
Resolve_dst(BlockDst, 0x40100C, 0);
return;
}

vmcpu->RSP = vmcpu->RSP_new;

// except post instr noauto
if (vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) {
vmcpu->RIP = 0x40100e;
Resolve_dst(BlockDst, 0x40100E, 0);
return;
}

// pre instruction test exception
if (vm_mngr->exception_flags) {
vmcpu->RIP = 0x40100e;
Resolve_dst(BlockDst, 0x40100E, 0);
return;
}

// CALL DWORD PTR [0x402000]
vmcpu->RIP_new = (((((uint64_t)(0x40100e & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP = vmcpu->RIP_new;
// CALL DWORD PTR [0x402000]
vmcpu->pfmem32_0 = MEM_LOOKUP_32(vm_mngr, 0x402000);
vmcpu->RSP_new = (((((uint64_t)(((((uint32_t)((((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0xfffffffc&0xffffffff))&0xffffffff) & 0xFFFFFFFF)) << 0)) & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
vmcpu->RIP_new = (((((uint64_t)(vmcpu->pfmem32_0 & 0xFFFFFFFF)) << 0) | (((uint64_t)(0x0 & 0xFFFFFFFF)) << 32)))&0xFFFFFFFFFFFFFFFF;
Resolve_dst(BlockDst, vmcpu->pfmem32_0, 0);
MEM_WRITE_32(vm_mngr, (((((((vmcpu->RSP>>0) & 0xFFFFFFFF)>>0) & 0xFFFFFFFF)&0xffffffff)+(0xfffffffc&0xffffffff))&0xffffffff), 0x401014);

// except fetch mem at instr noauto
if ((vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) & EXCEPT_DO_NOT_UPDATE_PC) {
vmcpu->RIP = 0x40100e;
Resolve_dst(BlockDst, 0x40100E, 0);
return;
}

vmcpu->RSP = vmcpu->RSP_new;
vmcpu->RIP = vmcpu->RIP_new;

// except post instr noauto
if (vm_mngr->exception_flags & ~EXCEPT_CODE_AUTOMOD) {
vmcpu->RIP = 0x401014;
Resolve_dst(BlockDst, 0x401014, 0);
return;
}

if (BlockDst->is_local) {
goto *local_labels[BlockDst->address];
}
else {
return;
}

}

from miasm.

serpilliere avatar serpilliere commented on July 17, 2024

Commial has got a mac, so we will debug this issue next year!

from miasm.

dummys avatar dummys commented on July 17, 2024

Yeahh, happy new year !

from miasm.

dummys avatar dummys commented on July 17, 2024

Nice, as I don't have anymore a Mac, I can't test it.

from miasm.

serpilliere avatar serpilliere commented on July 17, 2024

I am re opening the issue as it's not currently fixed, and we may complete it.

from miasm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.