1/* syntax.h -- Definitions for x86 syntax variations.
2 *
3 *       Copyright (C) 1992, 1994, 1995, 1998,
4 *                     2001, 2002 Free Software Foundation, Inc.
5 *
6 * This file is part of Libgcrypt.
7 *
8 * Libgcrypt is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as
10 * published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
12 *
13 * Libgcrypt is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
21 *
22 * Note: This code is heavily based on the GNU MP Library.
23 *	 Actually it's the same code with only minor changes in the
24 *	 way the data is stored; this is to support the abstraction
25 *	 of an optional secure memory allocation which may be used
26 *	 to avoid revealing of sensitive data due to paging etc.
27 */
28
29#undef ALIGN
30
31#if defined (BSD_SYNTAX) || defined (ELF_SYNTAX)
32#define R(r) %r
33#define MEM(base)(base)
34#define MEM_DISP(base,displacement)displacement(R(base))
35#define MEM_INDEX(base,index,size)(R(base),R(index),size)
36#ifdef __STDC__
37#define INSN1(mnemonic,size_suffix,dst)mnemonic##size_suffix dst
38#define INSN2(mnemonic,size_suffix,dst,src)mnemonic##size_suffix src,dst
39#else
40#define INSN1(mnemonic,size_suffix,dst)mnemonic/**/size_suffix dst
41#define INSN2(mnemonic,size_suffix,dst,src)mnemonic/**/size_suffix src,dst
42#endif
43#define TEXT .text
44#if defined (BSD_SYNTAX)
45#define ALIGN(log) .align log
46#endif
47#if defined (ELF_SYNTAX)
48#define ALIGN(log) .align 1<<(log)
49#endif
50#define GLOBL .globl
51#endif
52
53#ifdef INTEL_SYNTAX
54#define R(r) r
55#define MEM(base)[base]
56#define MEM_DISP(base,displacement)[base+(displacement)]
57#define MEM_INDEX(base,index,size)[base+index*size]
58#define INSN1(mnemonic,size_suffix,dst)mnemonic dst
59#define INSN2(mnemonic,size_suffix,dst,src)mnemonic dst,src
60#define TEXT .text
61#define ALIGN(log) .align log
62#define GLOBL .globl
63#endif
64
65#ifdef X86_BROKEN_ALIGN
66#undef ALIGN
67#define ALIGN(log) .align log,0x90
68#endif
69