+++ /dev/null
-/* $NetBSD: asm.h,v 1.6 2006/09/05 19:00:42 ad Exp $ */\r
-\r
-/*-\r
- * Copyright (c) 1990 The Regents of the University of California.\r
- * All rights reserved.\r
- *\r
- * This code is derived from software contributed to Berkeley by\r
- * William Jolitz.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the distribution.\r
- * 3. Neither the name of the University nor the names of its contributors\r
- * may be used to endorse or promote products derived from this software\r
- * without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
- * SUCH DAMAGE.\r
- *\r
- * @(#)asm.h 5.5 (Berkeley) 5/7/91\r
- */\r
-\r
-#ifndef _AMD64_ASM_H_\r
-#define _AMD64_ASM_H_\r
-\r
-#ifdef PIC\r
-#define PIC_PLT(x) x@PLT\r
-#define PIC_GOT(x) x@GOTPCREL(%rip)\r
-#else\r
-#define PIC_PLT(x) x\r
-#define PIC_GOT(x) x\r
-#endif\r
-\r
-# define _C_LABEL(x) x\r
-#define _ASM_LABEL(x) x\r
-\r
-#define CVAROFF(x,y) (_C_LABEL(x)+y)(%rip)\r
-\r
-#ifdef __STDC__\r
-# define __CONCAT(x,y) x ## y\r
-# define __STRING(x) #x\r
-#else\r
-# define __CONCAT(x,y) x/**/y\r
-# define __STRING(x) "x"\r
-#endif\r
-\r
-/* let kernels and others override entrypoint alignment */\r
-#ifndef _ALIGN_TEXT\r
-#define _ALIGN_TEXT .align 4\r
-#endif\r
-\r
-#define _ENTRY(x) \\r
- .text; _ALIGN_TEXT; .globl x; .type x,@function; x:\r
-\r
-#ifdef _KERNEL\r
-/* XXX Can't use __CONCAT() here, as it would be evaluated incorrectly. */\r
-#ifdef __STDC__\r
-#define IDTVEC(name) \\r
- ALIGN_TEXT; .globl X ## name; .type X ## name,@function; X ## name:\r
-#else \r
-#define IDTVEC(name) \\r
- ALIGN_TEXT; .globl X/**/name; .type X/**/name,@function; X/**/name:\r
-#endif /* __STDC__ */ \r
-#endif /* _KERNEL */\r
-\r
-#ifdef __STDC__\r
-#define CPUVAR(off) %gs:CPU_INFO_ ## off\r
-#else\r
-#define CPUVAR(off) %gs:CPU_INFO_/**/off\r
-#endif\r
-\r
-\r
-#ifdef GPROF\r
-# define _PROF_PROLOGUE \\r
- pushq %rbp; leaq (%rsp),%rbp; call PIC_PLT(__mcount); popq %rbp\r
-#else\r
-# define _PROF_PROLOGUE\r
-#endif\r
-\r
-#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE\r
-#define NENTRY(y) _ENTRY(_C_LABEL(y))\r
-#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE\r
-\r
-#define ASMSTR .asciz\r
-\r
-#define RCSID(x) .text; .asciz x\r
-\r
-#define WEAK_ALIAS(alias,sym) \\r
- .weak alias; \\r
- alias = sym\r
-\r
-/*\r
- * STRONG_ALIAS: create a strong alias.\r
- */\r
-#define STRONG_ALIAS(alias,sym) \\r
- .globl alias; \\r
- alias = sym\r
-\r
-/* XXXfvdl do not use stabs here */\r
-#ifdef __STDC__\r
-#define WARN_REFERENCES(sym,msg) \\r
- .stabs msg ## ,30,0,0,0 ; \\r
- .stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0\r
-#else\r
-#define WARN_REFERENCES(sym,msg) \\r
- .stabs msg,30,0,0,0 ; \\r
- .stabs __STRING(sym),1,0,0,0\r
-#endif /* __STDC__ */\r
-\r
-/*\r
- * Assembley equivalent of spllower(). Label contains the label to jump to\r
- * if we need to fire off pending interrupts (e.g. _C_LABEL(Xspllower)).\r
- *\r
- * On entry %rcx = new SPL.\r
- */\r
-#define SPLLOWER(label) \\r
- movq CPUVAR(SELF), %r9 ; \\r
- cmpl CPU_INFO_ILEVEL(%r9), %ecx ; \\r
- jae 99f ; \\r
- movl CPU_INFO_IUNMASK(%r9,%rcx,4), %edi ; \\r
- pushfq ; \\r
- popq %rax ; \\r
- cli ; \\r
- testl CPU_INFO_IPENDING(%r9), %edi ; \\r
- movq %rcx, %rdi ; \\r
- jnz label ; \\r
- movl %ecx, CPU_INFO_ILEVEL(%r9) ; \\r
- pushq %rax ; \\r
- popfq ; \\r
-99:\r
-\r
-#endif /* !_AMD64_ASM_H_ */\r