asm.h revision 114188
186551Sjake/*- 286551Sjake * Copyright (c) 1990 The Regents of the University of California. 386551Sjake * All rights reserved. 486551Sjake * 586551Sjake * This code is derived from software contributed to Berkeley by 686551Sjake * William Jolitz. 786551Sjake * 886551Sjake * Redistribution and use in source and binary forms, with or without 986551Sjake * modification, are permitted provided that the following conditions 1086551Sjake * are met: 1186551Sjake * 1. Redistributions of source code must retain the above copyright 1286551Sjake * notice, this list of conditions and the following disclaimer. 1386551Sjake * 2. Redistributions in binary form must reproduce the above copyright 1486551Sjake * notice, this list of conditions and the following disclaimer in the 1586551Sjake * documentation and/or other materials provided with the distribution. 1686551Sjake * 3. All advertising materials mentioning features or use of this software 1786551Sjake * must display the following acknowledgement: 1886551Sjake * This product includes software developed by the University of 1986551Sjake * California, Berkeley and its contributors. 2086551Sjake * 4. Neither the name of the University nor the names of its contributors 2186551Sjake * may be used to endorse or promote products derived from this software 2286551Sjake * without specific prior written permission. 2386551Sjake * 2486551Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2586551Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2686551Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2786551Sjake * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2886551Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2986551Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3086551Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3186551Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3286551Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3386551Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3486551Sjake * SUCH DAMAGE. 3586551Sjake * 3686551Sjake * from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90 3786551Sjake * from: FreeBSD: src/sys/i386/include/asm.h,v 1.7 2000/01/25 3886551Sjake * $FreeBSD: head/sys/sparc64/include/asm.h 114188 2003-04-29 00:37:41Z jake $ 3986551Sjake */ 4086551Sjake 4186551Sjake#ifndef _MACHINE_ASM_H_ 4286551Sjake#define _MACHINE_ASM_H_ 4386551Sjake 4488790Sjake#define __ASM__ 4588790Sjake 4686551Sjake#include <sys/cdefs.h> 4786551Sjake 4886551Sjake#ifdef PIC 4986551Sjake#define PIC_PROLOGUE(r1, r2) \ 5086551Sjake sethi %hi(_GLOBAL_OFFSET_TABLE_-4), r1 ; \ 5186551Sjake rd %pc, r2 ; \ 5286551Sjake or r1, %lo(_GLOBAL_OFFSET_TABLE_+4), r1 ; \ 5386551Sjake add r2, r1, r2 5486551Sjake#define SET(name, r1, r2) \ 5586551Sjake set name, r2 ; \ 5686551Sjake ldx [r1 + r2], r2 5786551Sjake#else 5886551Sjake#define PIC_PROLOGUE(r1, r2) 5986551Sjake#define SET(name, r1, r2) \ 6086551Sjake set name, r2 6186551Sjake#endif 6286551Sjake 6386551Sjake/* 6486551Sjake * CNAME and HIDENAME manage the relationship between symbol names in C 6586551Sjake * and the equivalent assembly language names. CNAME is given a name as 6686551Sjake * it would be used in a C program. It expands to the equivalent assembly 6786551Sjake * language name. HIDENAME is given an assembly-language name, and expands 6886551Sjake * to a possibly-modified form that will be invisible to C programs. 6986551Sjake */ 7086551Sjake#define CNAME(csym) csym 7186551Sjake#define HIDENAME(asmsym) __CONCAT(.,asmsym) 7286551Sjake 73114188Sjake#define CCFSZ 192 74114188Sjake#define SPOFF 2047 7586551Sjake 76114085Sobrien#define _ALIGN_TEXT .align 32 77114085Sobrien 78114085Sobrien#define _START_ENTRY \ 79114085Sobrien .text ; \ 80114085Sobrien _ALIGN_TEXT 81114085Sobrien 8286551Sjake/* 83114085Sobrien * Define a function entry point. 84114085Sobrien * 85114085Sobrien * The compiler produces #function for the .type pseudo-op, but the '#' 86114085Sobrien * character has special meaning in cpp macros, so we use @function like 87114085Sobrien * other architectures. The assembler seems to accept both. 88114085Sobrien * The assembler also accepts a .proc pseudo-op, which is used by the 89114085Sobrien * peep hole optimizer, whose argument is the type code of the return 90114085Sobrien * value. Since this is difficult to predict and its expected that 91114085Sobrien * assembler code is already optimized, we leave it out. 92114085Sobrien */ 93114085Sobrien#define _ENTRY(x) \ 94114085Sobrien _START_ENTRY ; \ 95114085Sobrien .globl CNAME(x) ; \ 96114085Sobrien .type CNAME(x),@function ; \ 97114085SobrienCNAME(x): 98114085Sobrien 99114085Sobrien#define ENTRY(x) _ENTRY(x) 100114085Sobrien#define END(x) .size x, . - x 101114085Sobrien 102114085Sobrien/* 10392998Sobrien * Kernel RCS ID tag and copyright macros 10492998Sobrien */ 10592998Sobrien 106114085Sobrien#undef __FBSDID 10792998Sobrien#if !defined(lint) && !defined(STRIP_FBSDID) 10892998Sobrien#define __FBSDID(s) .ident s 10992998Sobrien#else 11092998Sobrien#define __FBSDID(s) /* nothing */ 11192998Sobrien#endif /* not lint and not STRIP_FBSDID */ 11292998Sobrien 11386551Sjake#endif /* !_MACHINE_ASM_H_ */ 114