X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fx86%2Fassyntax.h;h=9bceacebdb6b0975a56782adfe0741f47f9abb0c;hb=30655c211c97a69f0eeb9ad6176ca1db67d15bf9;hp=8acc6d031d918dd8970abb323ea468c970c08f82;hpb=0b2fa873c6da02f169a76d74d3bedd91236f8e28;p=mesa.git diff --git a/src/mesa/x86/assyntax.h b/src/mesa/x86/assyntax.h index 8acc6d031d9..9bceacebdb6 100644 --- a/src/mesa/x86/assyntax.h +++ b/src/mesa/x86/assyntax.h @@ -1,4 +1,3 @@ -/* $Id: assyntax.h,v 1.18 2002/03/07 21:40:08 brianp Exp $ */ #ifndef __ASSYNTAX_H__ #define __ASSYNTAX_H__ @@ -79,9 +78,11 @@ #endif #if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (i386) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__)) -#define CONCAT(x, y) x ## y +#define CONCAT(x, y) x ## y +#define CONCAT3(x, y, z) x ## y ## z #else -#define CONCAT(x, y) x/**/y +#define CONCAT(x, y) x/**/y +#define CONCAT3(x, y, z) x/**/y/**/z #endif #ifdef ACK_ASSEMBLER @@ -254,7 +255,7 @@ #endif /* ACK_ASSEMBLER */ -#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) +#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__) #define GLNAME(a) a #else #define GLNAME(a) CONCAT(_,a) @@ -273,9 +274,7 @@ #define GLOBL CHOICE(.globl, .globl, .extern) #define GLOBAL GLOBL #define EXTERN GLOBL -/* -#define ALIGNTEXT32 CHOICE(.align 32, .align ARG2(5,0x90), .align 32) -*/ +#ifndef __AOUT__ #define ALIGNTEXT32 CHOICE(.align 32, .balign 32, .align 32) #define ALIGNTEXT16 CHOICE(.align 16, .balign 16, .align 16) #define ALIGNTEXT8 CHOICE(.align 8, .balign 8, .align 8) @@ -293,6 +292,26 @@ #define ALIGNDATA8 CHOICE(.align 8, .balign ARG2(8,0x0), .align 8) #define ALIGNDATA4 CHOICE(.align 4, .balign ARG2(4,0x0), .align 4) #define ALIGNDATA2 CHOICE(.align 2, .balign ARG2(2,0x0), .align 2) +#else +/* 'as -aout' on FreeBSD doesn't have .balign */ +#define ALIGNTEXT32 CHOICE(.align 32, .align ARG2(5,0x90), .align 32) +#define ALIGNTEXT16 CHOICE(.align 16, .align ARG2(4,0x90), .align 16) +#define ALIGNTEXT8 CHOICE(.align 8, .align ARG2(3,0x90), .align 8) +#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 ALIGNTEXT32ifNOP CHOICE(.align 32, .align ARG2(5,0x90), /*can't do it*/) +#define ALIGNTEXT16ifNOP CHOICE(.align 16, .align ARG2(4,0x90), /*can't do it*/) +#define ALIGNTEXT8ifNOP CHOICE(.align 8, .align ARG2(3,0x90), /*can't do it*/) +#define ALIGNTEXT4ifNOP CHOICE(.align 4, .align ARG2(2,0x90), /*can't do it*/) +#define ALIGNDATA32 CHOICE(.align 32, .align ARG2(5,0x0), .align 32) +#define ALIGNDATA16 CHOICE(.align 16, .align ARG2(4,0x0), .align 16) +#define ALIGNDATA8 CHOICE(.align 8, .align ARG2(3,0x0), .align 8) +#define ALIGNDATA4 CHOICE(.align 4, .align ARG2(2,0x0), .align 4) +#define ALIGNDATA2 CHOICE(.align 2, .align ARG2(1,0x0), .align 2) +#endif /* __AOUT__ */ #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) @@ -312,8 +331,8 @@ /* Addressing Modes */ /* Immediate Mode */ -#define ADDR(a) CHOICE(CONCAT($,a), CONCAT($,a), a) -#define CONST(a) CHOICE(CONCAT($,a), CONCAT($,a), a) +#define ADDR(a) CHOICE(CONCAT($,a), $a, a) +#define CONST(a) CHOICE(CONCAT($,a), $a, a) /* Indirect Mode */ #define CONTENT(a) CHOICE(a, a, (a)) /* take contents of variable */ @@ -863,7 +882,8 @@ #define P_XMM6 xmm6 #define P_XMM7 xmm7 -#define CONCAT(x, y) x ## y +#define CONCAT(x, y) x ## y +#define CONCAT3(x, y, z) x ## y ## z #if defined(NASM_ASSEMBLER) @@ -964,11 +984,11 @@ SECTION _DATA public align=16 class=DATA use32 flat #endif #if defined(Lynx) || (defined(SYSV) || defined(SVR4)) \ - || (defined(linux) || defined(__OS2ELF__)) && defined(__ELF__) \ + || (defined(__linux__) || defined(__OS2ELF__)) && defined(__ELF__) \ || defined(__FreeBSD__) && __FreeBSD__ >= 3 #define GLNAME(a) a #else -#define GLNAME(a) _ ## a +#define GLNAME(a) CONCAT(_, a) #endif /* @@ -991,12 +1011,21 @@ SECTION _DATA public align=16 class=DATA use32 flat #define B_CONST(a) a /* Indirect Mode */ +#ifdef NASM_ASSEMBLER +#define P_CONTENT(a) [a] +#define X_CONTENT(a) TBYTE_PTR [a] +#define D_CONTENT(a) QWORD_PTR [a] +#define L_CONTENT(a) DWORD_PTR [a] +#define W_CONTENT(a) WORD_PTR [a] +#define B_CONTENT(a) BYTE_PTR [a] +#else #define P_CONTENT(a) a #define X_CONTENT(a) TBYTE_PTR a #define D_CONTENT(a) QWORD_PTR a #define L_CONTENT(a) DWORD_PTR a #define W_CONTENT(a) WORD_PTR a #define B_CONTENT(a) BYTE_PTR a +#endif /* Register a indirect */ #define P_REGIND(a) [a] @@ -1065,10 +1094,10 @@ SECTION _DATA public align=16 class=DATA use32 flat #define B_REGDB(d, b) BYTE_PTR [b + d] /* Variable indirect: */ -#define VARINDIRECT(var) var +#define VARINDIRECT(var) [var] /* Use register contents as jump/call target: */ -#define CODEPTR(reg) reg +#define CODEPTR(reg) P_(reg) /* * Redefine assembler commands @@ -1077,6 +1106,7 @@ SECTION _DATA public align=16 class=DATA use32 flat #define P_(a) P_ ## a #define X_(a) X_ ## a #define D_(a) D_ ## a +#define SR_(a) W_ ## a #define S_(a) L_ ## a #define L_(a) L_ ## a #define W_(a) W_ ## a @@ -1192,7 +1222,7 @@ SECTION _DATA public align=16 class=DATA use32 flat #define JS(a) js NEAR a #define JZ(a) jz NEAR a #define JMP(a) jmp a -#define JMPF(s,a) jmpf +#define JMPF(s,a) jmp far s:a #define LAHF lahf #define LAR(a, b) lar b, a #define LEA_L(a, b) lea P_(b), P_(a) @@ -1200,11 +1230,11 @@ SECTION _DATA public align=16 class=DATA use32 flat #define LEAVE leave #define LGDT(a) lgdt a #define LIDT(a) lidt a -#define LDS(a, b) lds b, a -#define LES(a, b) les b, a -#define LFS(a, b) lfs b, a -#define LGS(a, b) lgs b, a -#define LSS(a, b) lss b, a +#define LDS(a, b) lds b, P_(a) +#define LES(a, b) les b, P_(a) +#define LFS(a, b) lfs b, P_(a) +#define LGS(a, b) lgs b, P_(a) +#define LSS(a, b) lss b, P_(a) #define LLDT(a) lldt a #define LMSW(a) lmsw a #define LOCK lock @@ -1218,7 +1248,7 @@ SECTION _DATA public align=16 class=DATA use32 flat #define LOOPNZ(a) loopnz a #define LSL(a, b) lsl b, a #define LTR(a) ltr a -#define MOV_SR(a, b) mov S_(b), S_(a) +#define MOV_SR(a, b) mov SR_(b), SR_(a) #define MOV_L(a, b) mov L_(b), L_(a) #define MOV_W(a, b) mov W_(b), W_(a) #define MOV_B(a, b) mov B_(b), B_(a) @@ -1253,14 +1283,14 @@ SECTION _DATA public align=16 class=DATA use32 flat #define OUTS_L outsd #define OUTS_W outsw #define OUTS_B outsb -#define POP_SR(a) pop S_(a) +#define POP_SR(a) pop SR_(a) #define POP_L(a) pop L_(a) #define POP_W(a) pop W_(a) #define POPA_L popad #define POPA_W popa #define POPF_L popfd #define POPF_W popf -#define PUSH_SR(a) push S_(a) +#define PUSH_SR(a) push SR_(a) #define PUSH_L(a) push L_(a) #define PUSH_W(a) push W_(a) #define PUSH_B(a) push B_(a) @@ -1288,11 +1318,11 @@ SECTION _DATA public align=16 class=DATA use32 flat #define REPZ REPE #define RET ret #define SAHF sahf -#define SAL_L(a, b) sal L_(b), L_(a) -#define SAL_W(a, b) sal W_(b), W_(a) +#define SAL_L(a, b) sal L_(b), B_(a) +#define SAL_W(a, b) sal W_(b), B_(a) #define SAL_B(a, b) sal B_(b), B_(a) -#define SAR_L(a, b) sar L_(b), L_(a) -#define SAR_W(a, b) sar W_(b), W_(a) +#define SAR_L(a, b) sar L_(b), B_(a) +#define SAR_W(a, b) sar W_(b), B_(a) #define SAR_B(a, b) sar B_(b), B_(a) #define SBB_L(a, b) sbb L_(b), L_(a) #define SBB_W(a, b) sbb W_(b), W_(a) @@ -1332,15 +1362,15 @@ SECTION _DATA public align=16 class=DATA use32 flat #define SETZ(a) setz a #define SGDT(a) sgdt a #define SIDT(a) sidt a -#define SHL_L(a, b) shl L_(b), L_(a) -#define SHL_W(a, b) shl W_(b), W_(a) +#define SHL_L(a, b) shl L_(b), B_(a) +#define SHL_W(a, b) shl W_(b), B_(a) #define SHL_B(a, b) shl B_(b), B_(a) #define SHLD_L(a,b,c) shld #define SHLD2_L(a,b) shld L_(b), L_(a) #define SHLD_W(a,b,c) shld #define SHLD2_W(a,b) shld W_(b), W_(a) -#define SHR_L(a, b) shr L_(b), L_(a) -#define SHR_W(a, b) shr W_(b), W_(a) +#define SHR_L(a, b) shr L_(b), B_(a) +#define SHR_W(a, b) shr W_(b), B_(a) #define SHR_B(a, b) shr B_(b), B_(a) #define SHRD_L(a,b,c) shrd #define SHRD2_L(a,b) shrd L_(b), L_(a) @@ -1351,9 +1381,9 @@ SECTION _DATA public align=16 class=DATA use32 flat #define STC stc #define STD std #define STI sti -#define STOS_L stos -#define STOS_W stos -#define STOS_B stos +#define STOS_L stosd +#define STOS_W stosw +#define STOS_B stosb #define STR(a) str a #define SUB_L(a, b) sub L_(b), L_(a) #define SUB_W(a, b) sub W_(b), W_(a) @@ -1680,9 +1710,37 @@ SECTION _DATA public align=16 class=DATA use32 flat /* Added by BrianP for FreeBSD (per David Dawes) */ #if !defined(NASM_ASSEMBLER) && !defined(MASM_ASSEMBLER) && !defined(__bsdi__) #define LLBL(a) CONCAT(.L,a) +#define LLBL2(a,b) CONCAT3(.L,a,b) #else #define LLBL(a) a +#define LLBL2(a,b) CONCAT(a,b) +#endif + +/* Segment overrides */ +#define SEGCS D_BYTE 46 +#define SEGDS D_BYTE 62 +#define SEGES D_BYTE 38 +#define SEGFS D_BYTE 100 +#define SEGGS D_BYTE 101 + +/* Temporary labels: valid until next non-local label */ +#ifdef NASM_ASSEMBLER +#define TLBL(a) CONCAT(.,a) +#else +#define TLBL(a) CONCAT(a,$) #endif +/* Hidden symbol visibility support. + * If we build with gcc's -fvisibility=hidden flag, we'll need to change + * the symbol visibility mode to 'default'. + */ +#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) +# define HIDDEN(x) .hidden x +#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 && !defined(__MINGW32__) +# pragma GCC visibility push(default) +# define HIDDEN(x) .hidden x +#else +# define HIDDEN(x) +#endif #endif /* __ASSYNTAX_H__ */