assyntax.h revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/assyntax.h,v 3.13 2003/08/24 17:37:03 dawes Exp $ */
#ifndef __ASSYNTAX_H__
#define __ASSYNTAX_H__
/*
* Copyright 1992 Vrije Universiteit, The Netherlands
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of the Vrije Universiteit not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. The Vrije Universiteit makes no
* representations about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
* The Vrije Universiteit DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL The Vrije Universiteit BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Copyright (c) 1993-1999 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/* $XConsortium: assyntax.h /main/5 1996/02/21 17:50:49 kaleb $ */
/*
*
* Select the syntax appropriate to the 386 assembler being used
* To add support for more assemblers add more columns to the CHOICE
* macro. Note that register names must also have uppercase names
* to avoid macro recursion. e.g., #define ah %ah recurses!
*
* NB 1. Some of the macros for certain assemblers imply that the code is to
* run in protected mode!! Caveat emptor.
*
* NB 2. 486 specific instructions are not included. This is to discourage
* their accidental use in code that is intended to run on 386 and 486
* systems.
*
* Supported assemblers:
*
* (a) AT&T SysVr4 as(1): default
* (b) GNU Assembler gas: define USE_GAS or GNU_ASSEMBLER
* (c) Amsterdam Compiler kit: define ACK_ASSEMBLER
*
* The following naming conventions have been used to identify the various
* data types:
* _SR = segment register version
* Integer:
* _Q = quadword = 64 bits
* _L = long = 32 bits
* _W = short = 16 bits
* _B = byte = 8 bits
* Floating-point:
* _X = m80real = 80 bits
* _D = double = 64 bits
* _S = single = 32 bits
*
* Author: Gregory J. Sharp, Sept 1992
* Vrije Universiteit, Amsterdam, The Netherlands
*/
#if defined(USE_GAS) && !defined(GNU_ASSEMBLER)
#define GNU_ASSEMBLER
#endif
#if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (i386) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__))
#define CONCAT(x, y) x ## y
#else
#define CONCAT(x, y) x/**/y
#endif
#ifdef ACK_ASSEMBLER
/* Assume we write code for 32-bit protected mode! */
/* Redefine register names for GAS & AT&T assemblers */
/* Control Registers */
/* Debug Registers */
/* Floating-point Stack */
#define _LTOG /* long toggle for _L instructions */
#define ADDR_TOGGLE a16
#define OPSZ_TOGGLE o16
#define CHOICE(a,b,c) c
#else /* AT&T or GAS */
/* Redefine register names for GAS & AT&T assemblers */
/* Control Registers */
/* Debug Registers */
/* Floating-point Stack */
#define AS_BEGIN
#define USE16
#define USE32
#ifdef GNU_ASSEMBLER
#define ADDR_TOGGLE aword
#define OPSZ_TOGGLE word
#define CHOICE(a,b,c) b
#else
/*
* AT&T ASSEMBLER SYNTAX
* *********************
*/
#define CHOICE(a,b,c) a
#define ADDR_TOGGLE addr16
#define OPSZ_TOGGLE data16
#endif /* GNU_ASSEMBLER */
#endif /* ACK_ASSEMBLER */
#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__)
#define GLNAME(a) a
#else
#endif
/****************************************/
/* */
/* Select the various choices */
/* */
/****************************************/
/* Redefine assembler directives */
/*********************************/
/* ALIGNTEXT4ifNOP is the same as ALIGNTEXT4, but only if the space is
* guaranteed to be filled with NOPs. Otherwise it does nothing.
*/
#ifdef GNU_ASSEMBLER
#define D_SPACE(n) . = . + n
#else
#endif
/* Addressing Modes */
/* Immediate Mode */
/* Indirect Mode */
/* Register b indirect plus displacement a */
/* Reg indirect Base + Index + Displacement - this is mainly for 16-bit mode
* which has no scaling
*/
/* Reg indirect Base + (Index * Scale) + Displacement */
/* Displaced Scaled Index: */
/* Indexed Base: */
/* Displaced Base: */
/* Variable indirect: */
/* For expressions requiring bracketing
* eg. (CRT0_PM | CRT_EM)
*/
/*
* We have to beat the problem of commas within arguments to choice.
* eg. choice (add a,b, add b,a) will get argument mismatch. Luckily ANSI
* and other known cpp definitions evaluate arguments before substitution
* so the following works.
*/
#define ARG2(a, b) a,b
#define ARG3(a,b,c) a,b,c
/* Redefine assembler commands */
/* More forms than this for imul!! */
/* Please AS code writer: use the following ONLY, if you refer to ports<256
* directly, but not in IN1_W(DX), for instance, even if IN1_ looks nicer
*/
#if defined (sun)
#else
#endif
#if !defined(_REAL_MODE) && !defined(_V86_MODE)
#endif
#if !defined(_REAL_MODE) && !defined(_V86_MODE)
#endif
/* Please AS code writer: use the following ONLY, if you refer to ports<256
* directly, but not in OUT1_W(DX), for instance, even if OUT1_ looks nicer
*/
/* Floating Point Instructions */
#endif /* __ASSYNTAX_H__ */