summaryrefslogtreecommitdiffhomepage
path: root/include/pemagine/pe_inline_asm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/pemagine/pe_inline_asm.h')
-rw-r--r--include/pemagine/pe_inline_asm.h46
1 files changed, 38 insertions, 8 deletions
diff --git a/include/pemagine/pe_inline_asm.h b/include/pemagine/pe_inline_asm.h
index 65e1376..d1613e7 100644
--- a/include/pemagine/pe_inline_asm.h
+++ b/include/pemagine/pe_inline_asm.h
@@ -1,16 +1,44 @@
-#if defined(__NT32)
-#if (__COMPILER__ == __GCC__)
-#include "bits/nt32/pe_inline_asm__gcc.h"
-#elif (__COMPILER__ == __MSVC__)
+#ifndef _PE_INLINE_ASM_H_
+#define _PE_INLINE_ASM_H_
+
+#include "pe_api.h"
+
+#ifdef _MSC_VER
+
+/* visual studio: begin */
+#ifdef _M_IX86
+#ifndef __SIZEOF_POINTER__
+#define __SIZEOF_POINTER__ 4
+#endif
+#endif
+
+#ifdef _M_X64
+#ifndef __SIZEOF_POINTER__
+#define __SIZEOF_POINTER__ 8
+#endif
+#endif
+
+#if (__SIZEOF_POINTER__ == 4)
#include "bits/nt32/pe_inline_asm__msvc.h"
#endif
-#elif defined(__NT64)
-#if (__COMPILER__ == __GCC__)
-#include "bits/nt64/pe_inline_asm__gcc.h"
-#elif (__COMPILER__ == __MSVC__)
+#if (__SIZEOF_POINTER__ == 8)
#include "bits/nt64/pe_inline_asm__msvc.h"
#endif
+/* visual studio: end */
+
+#else
+
+/* all other compilers: begin */
+#if (__SIZEOF_POINTER__ == 4)
+#include "bits/nt32/pe_inline_asm__common.h"
+#endif
+
+#if (__SIZEOF_POINTER__ == 8)
+#include "bits/nt64/pe_inline_asm__common.h"
+#endif
+/* all other compilers: end */
+
#endif
/* trivial */
@@ -18,3 +46,5 @@ static __inline__ void * pe_va_from_rva(const void * base, intptr_t offset)
{
return (void *)((intptr_t)base + offset);
}
+
+#endif