2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Kernel
5 * PURPOSE: Extended ASM macros for GAS and MASM/ML64
6 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8 * NOTE: This file is an extension to our well-known asm.inc that defines
9 * a set of macros allowing us to assemble specially-crafted ASM files
10 * with both GAS and MASM/ML.
12 * The additions introduced here are:
13 * - a 'long' define for MASM/ML that aliases to DWORD, and a 'dword'
14 * and 'DWORD' defines for GAS that alias to long.
15 * - an OFF(...) macro that is used for initializing global symbols with
16 * the offset value of another symbol.
17 * - a set of macros for defining and using structures.
20 #ifndef __ASMXTRAS_INC__
21 #define __ASMXTRAS_INC__
23 /* 'long' / 'dword'|'DWORD' macros for MASM/ML and GAS */
33 #define OFF(x) offset x
39 * Set of macros for defining and using structures:
40 * - STRUCT(name, ...) defines a structure of name 'name'.
41 * - FIELD_DECL(field, type, value) adds a new structure member 'field'
42 * of type 'type', with the default value 'value'.
43 * - ENDS(name) terminates the definition of the structure 'name'.
44 * - A symbol 'name' of type 'struct' is declared with VAR_STRUCT(name, struct).
45 * - Referencing a member 'field' of a symbol 'name' is done with FIELD(name, field).
49 #define STRUCT(name, ...) \
50 name STRUCT __VA_ARGS__
52 #define FIELD_DECL(field, type, value) \
58 #define VAR_STRUCT(name, struct) \
61 #define FIELD(name, field) \
66 #define STRUCT(name, ...) \
69 #define FIELD_DECL(field, type, value) \
70 VarName\()_\()field: .type value
72 #define ENDS(...) ENDM
74 #define VAR_STRUCT(name, struct) \
77 #define FIELD(name, field) \
82 #endif /* __ASMXTRAS_INC__ */