X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fcil-coff.h;h=91ede875aad5d2380ae75c6a422ec7937b8b09eb;hb=157cb97206f627685c15410953d2767146f6e426;hp=098057f6fc36d310729c1a893764c69357b28b9e;hpb=00e065484e866f3a0349c882f804c4a79a13ee5c;p=mono.git diff --git a/mono/metadata/cil-coff.h b/mono/metadata/cil-coff.h index 098057f6fc3..91ede875aad 100644 --- a/mono/metadata/cil-coff.h +++ b/mono/metadata/cil-coff.h @@ -3,13 +3,13 @@ #define __MONO_CIL_COFF_H__ #include +#include /* * 25.2.1: Method header type values */ -#define METHOD_HEADER_FORMAT_MASK 7 +#define METHOD_HEADER_FORMAT_MASK 3 #define METHOD_HEADER_TINY_FORMAT 2 -#define METHOD_HEADER_TINY_FORMAT1 6 #define METHOD_HEADER_FAT_FORMAT 3 /* @@ -64,6 +64,18 @@ typedef struct { guint32 pe_rva_data_base; } MonoPEHeader; +/* 24 bytes */ +typedef struct { + guint16 pe_magic; + guchar pe_major; + guchar pe_minor; + guint32 pe_code_size; + guint32 pe_data_size; + guint32 pe_uninit_data_size; + guint32 pe_rva_entry_point; + guint32 pe_rva_code_base; +} MonoPEHeader64; + /* 68 bytes */ typedef struct { guint32 pe_image_base; /* must be 0x400000 */ @@ -89,6 +101,31 @@ typedef struct { guint32 pe_data_dir_count; } MonoPEHeaderNT; +/* 88 bytes */ +typedef struct { + guint64 pe_image_base; + guint32 pe_section_align; /* must be 8192 */ + guint32 pe_file_alignment; /* must be 512 or 4096 */ + guint16 pe_os_major; /* must be 4 */ + guint16 pe_os_minor; /* must be 0 */ + guint16 pe_user_major; + guint16 pe_user_minor; + guint16 pe_subsys_major; + guint16 pe_subsys_minor; + guint32 pe_reserved_1; + guint32 pe_image_size; + guint32 pe_header_size; + guint32 pe_checksum; + guint16 pe_subsys_required; + guint16 pe_dll_flags; + guint64 pe_stack_reserve; + guint64 pe_stack_commit; + guint64 pe_heap_reserve; + guint64 pe_heap_commit; + guint32 pe_loader_flags; + guint32 pe_data_dir_count; +} MonoPEHeaderNT64; + typedef struct { guint32 rde_data_offset; guint32 rde_size; @@ -116,33 +153,30 @@ typedef struct { #define MONO_PE_RESOURCE_ID_ANICURSOR 0x15 #define MONO_PE_RESOURCE_ID_ANIICON 0x16 #define MONO_PE_RESOURCE_ID_HTML 0x17 +#define MONO_PE_RESOURCE_ID_ASPNET_STRING 0x65 typedef struct { /* If the MSB is set, then the other 31 bits store the RVA of * the unicode string containing the name. Otherwise, the * other 31 bits contain the ID of this entry. */ -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - guint32 name_offset:31; - guint32 name_is_string:1; -#else - guint32 name_is_string:1; - guint32 name_offset:31; -#endif - + guint32 name; + /* If the MSB is set, then the other 31 bits store the RVA of * another subdirectory. Otherwise, the other 31 bits store * the RVA of the resource data entry leaf node. */ -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - guint32 dir_offset:31; - guint32 is_dir:1; -#else - guint32 is_dir:1; - guint32 dir_offset:31; -#endif + guint32 dir; } MonoPEResourceDirEntry; +#define MONO_PE_RES_DIR_ENTRY_NAME_IS_STRING(d) (GUINT32_FROM_LE((d).name) >> 31) +#define MONO_PE_RES_DIR_ENTRY_NAME_OFFSET(d) (GUINT32_FROM_LE((d).name) & 0x7fffffff) +#define MONO_PE_RES_DIR_ENTRY_SET_NAME(d,i,o) ((d).name = GUINT32_TO_LE(((guint32)((i)?1:0) << 31) | ((o) & 0x7fffffff))) + +#define MONO_PE_RES_DIR_ENTRY_IS_DIR(d) (GUINT32_FROM_LE((d).dir) >> 31) +#define MONO_PE_RES_DIR_ENTRY_DIR_OFFSET(d) (GUINT32_FROM_LE((d).dir) & 0x7fffffff) +#define MONO_PE_RES_DIR_ENTRY_SET_DIR(d,i,o) ((d).dir = GUINT32_TO_LE(((guint32)((i)?1:0) << 31) | ((o) & 0x7fffffff))) + typedef struct { guint32 res_characteristics; @@ -182,6 +216,15 @@ typedef struct { MonoPEDirEntry pe_reserved; } MonoPEDatadir; +/* 248 bytes */ +typedef struct { + char pesig [4]; + MonoCOFFHeader coff; + MonoPEHeader pe; + MonoPEHeaderNT nt; + MonoPEDatadir datadir; +} MonoDotNetHeader32; + /* 248 bytes */ typedef struct { char pesig [4]; @@ -191,6 +234,27 @@ typedef struct { MonoPEDatadir datadir; } MonoDotNetHeader; +/* XX248 bytes */ +typedef struct { + char pesig [4]; + MonoCOFFHeader coff; + MonoPEHeader64 pe; + MonoPEHeaderNT64 nt; + MonoPEDatadir datadir; +} MonoDotNetHeader64; + +#define VTFIXUP_TYPE_32BIT 0x01 +#define VTFIXUP_TYPE_64BIT 0x02 +#define VTFIXUP_TYPE_FROM_UNMANAGED 0x04 +#define VTFIXUP_TYPE_FROM_UNMANAGED_RETAIN_APPDOMAIN 0x08 +#define VTFIXUP_TYPE_CALL_MOST_DERIVED 0x10 + +typedef struct { + guint32 rva; + guint16 count; + guint16 type; +} MonoVTableFixup; + typedef struct { char st_name [8]; guint32 st_virtual_size; @@ -256,6 +320,6 @@ typedef struct { MonoCLIHeader cli_cli_header; } MonoCLIImageInfo; -guint32 mono_cli_rva_image_map (MonoCLIImageInfo *iinfo, guint32 rva); +guint32 mono_cli_rva_image_map (MonoImage *image, guint32 rva); #endif /* __MONO_CIL_COFF_H__ */