📄 assyntax.h
字号:
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/assyntax.h,v 3.7.2.2 1997/05/11 02:56:22 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. *//* $XConsortium: assyntax.h /main/5 1996/02/21 17:50:49 kaleb $ */ /* * assyntax.h * * 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 */#define AL al#define AH ah#define AX ax#define EAX ax#define BL bl#define BH bh#define BX bx#define EBX bx#define CL cl#define CH ch#define CX cx#define ECX cx#define DL dl#define DH dh#define DX dx#define EDX dx#define BP bp#define EBP bp#define SI si#define ESI si#define DI di#define EDI di#define SP sp#define ESP sp#define CS cs#define SS ss#define DS ds#define ES es#define FS fs#define GS gs/* Control Registers */#define CR0 cr0#define CR1 cr1#define CR2 cr2#define CR3 cr3/* Debug Registers */#define DR0 dr0#define DR1 dr1#define DR2 dr2#define DR3 dr3#define DR4 dr4#define DR5 dr5#define DR6 dr6#define DR7 dr7/* Floating-point Stack */#define ST st#define AS_BEGIN .sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text#define _WTOG o16 /* word toggle for _W instructions */#define _LTOG /* long toggle for _L instructions */#define ADDR_TOGGLE a16#define OPSZ_TOGGLE o16#define USE16 .use16#define USE32 .use32#define CHOICE(a,b,c) c#else /* AT&T or GAS *//* Redefine register names for GAS & AT&T assemblers */#define AL %al#define AH %ah#define AX %ax#define EAX %eax#define BL %bl#define BH %bh#define BX %bx#define EBX %ebx#define CL %cl#define CH %ch#define CX %cx#define ECX %ecx#define DL %dl#define DH %dh#define DX %dx#define EDX %edx#define BP %bp#define EBP %ebp#define SI %si#define ESI %esi#define DI %di#define EDI %edi#define SP %sp#define ESP %esp#define CS %cs#define SS %ss#define DS %ds#define ES %es#define FS %fs#define GS %gs/* Control Registers */#define CR0 %cr0#define CR1 %cr1#define CR2 %cr2#define CR3 %cr3/* Debug Registers */#define DR0 %db0#define DR1 %db1#define DR2 %db2#define DR3 %db3#define DR4 %db4#define DR5 %db5#define DR6 %db6#define DR7 %db7/* Floating-point Stack */#define ST %st#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(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || (defined(linux) || defined(__OS2ELF__)) && defined(__ELF__) || defined (OSKIT) && defined(__ELF__)#define GLNAME(a) a#else#define GLNAME(a) CONCAT(_,a)#endif /****************************************/ /* */ /* Select the various choices */ /* */ /****************************************//* Redefine assembler directives *//*********************************/#define GLOBL CHOICE(.globl, .globl, .extern)#define ALIGNTEXT4 CHOICE(.align 4, .align ARG2(2,0x90), .align 4)#define ALIGNTEXT2 CHOICE(.align 2, .align ARG2(1,0x90), .align 2)/* ALIGNTEXT4ifNOP is the same as ALIGNTEXT4, but only if the space is * guaranteed to be filled with NOPs. Otherwise it does nothing. */#define ALIGNTEXT4ifNOP CHOICE(.align 4, .align ARG2(2,0x90), /*can't do it*/)#define ALIGNDATA4 CHOICE(.align 4, .align ARG2(2,0x0), .align 4)#define ALIGNDATA2 CHOICE(.align 2, .align ARG2(1,0x0), .align 2)#define FILE(s) CHOICE(.file s, .file s, .file s)#define STRING(s) CHOICE(.string s, .asciz s, .asciz s)#define D_LONG CHOICE(.long, .long, .data4)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -