summaryrefslogtreecommitdiffhomepage
path: root/include/pemagine/pe_inline_asm.h
blob: d1613e767338a0cf5f0c310fe6734e950009b0b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#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

#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 */
static __inline__ void * pe_va_from_rva(const void * base, intptr_t offset)
{
        return (void *)((intptr_t)base + offset);
}

#endif