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 * 4. Neither the name of the University nor the names of its contributors
1786551Sjake *    may be used to endorse or promote products derived from this software
1886551Sjake *    without specific prior written permission.
1986551Sjake *
2086551Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2186551Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2286551Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2386551Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2486551Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2586551Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2686551Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2786551Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2886551Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2986551Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3086551Sjake * SUCH DAMAGE.
3186551Sjake *
3286551Sjake *	from: @(#)DEFS.h	5.1 (Berkeley) 4/23/90
3386551Sjake *	from: FreeBSD: src/sys/i386/include/asm.h,v 1.7 2000/01/25
3486551Sjake * $FreeBSD$
3586551Sjake */
3686551Sjake
3786551Sjake#ifndef _MACHINE_ASM_H_
3886551Sjake#define	_MACHINE_ASM_H_
3986551Sjake
4088790Sjake#define	__ASM__
4188790Sjake
4286551Sjake#include <sys/cdefs.h>
4386551Sjake
4486551Sjake#ifdef PIC
4586551Sjake#define	PIC_PROLOGUE(r1, r2) \
4686551Sjake	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), r1 ; \
4786551Sjake	rd	%pc, r2 ; \
4886551Sjake	or	r1, %lo(_GLOBAL_OFFSET_TABLE_+4), r1 ; \
4986551Sjake	add	r2, r1, r2
5086551Sjake#define	SET(name, r1, r2) \
5186551Sjake	set	name, r2 ; \
5286551Sjake	ldx	[r1 + r2], r2
5386551Sjake#else
5486551Sjake#define	PIC_PROLOGUE(r1, r2)
5586551Sjake#define	SET(name, r1, r2) \
5686551Sjake	set	name, r2
5786551Sjake#endif
5886551Sjake
5986551Sjake/*
6086551Sjake * CNAME and HIDENAME manage the relationship between symbol names in C
6186551Sjake * and the equivalent assembly language names.  CNAME is given a name as
6286551Sjake * it would be used in a C program.  It expands to the equivalent assembly
6386551Sjake * language name.  HIDENAME is given an assembly-language name, and expands
6486551Sjake * to a possibly-modified form that will be invisible to C programs.
6586551Sjake */
6686551Sjake#define CNAME(csym)		csym
6786551Sjake#define HIDENAME(asmsym)	__CONCAT(.,asmsym)
6886551Sjake
69114188Sjake#define	CCFSZ	192
70114188Sjake#define	SPOFF	2047
7186551Sjake
72114085Sobrien#define	_ALIGN_TEXT	.align 32
73114085Sobrien
74114085Sobrien#define _START_ENTRY \
75114085Sobrien	.text ; \
76114085Sobrien	_ALIGN_TEXT
77114085Sobrien
7886551Sjake/*
79212705Smarius * Define function entry and alternate entry points.
80114085Sobrien *
81114085Sobrien * The compiler produces #function for the .type pseudo-op, but the '#'
82114085Sobrien * character has special meaning in cpp macros, so we use @function like
83114085Sobrien * other architectures.  The assembler seems to accept both.
84114085Sobrien * The assembler also accepts a .proc pseudo-op, which is used by the
85114085Sobrien * peep hole optimizer, whose argument is the type code of the return
86114085Sobrien * value.  Since this is difficult to predict and its expected that
87114085Sobrien * assembler code is already optimized, we leave it out.
88114085Sobrien */
89212705Smarius
90212705Smarius#define	_ALTENTRY(x) \
91212705Smarius	.globl	CNAME(x) ; \
92212705Smarius	.type	CNAME(x),@function ; \
93212705SmariusCNAME(x):
94212705Smarius
95114085Sobrien#define	_ENTRY(x) \
96114085Sobrien	_START_ENTRY ; \
97114085Sobrien	.globl	CNAME(x) ; \
98114085Sobrien	.type	CNAME(x),@function ; \
99114085SobrienCNAME(x):
100114085Sobrien
101212705Smarius#define	ALTENTRY(x)	_ALTENTRY(x)
102114085Sobrien#define	ENTRY(x)	_ENTRY(x)
103114085Sobrien#define	END(x)		.size x, . - x
104114085Sobrien
105114085Sobrien/*
10692998Sobrien * Kernel RCS ID tag and copyright macros
10792998Sobrien */
10892998Sobrien
109114085Sobrien#undef __FBSDID
11092998Sobrien#if !defined(lint) && !defined(STRIP_FBSDID)
11192998Sobrien#define __FBSDID(s)	.ident s
11292998Sobrien#else
11392998Sobrien#define __FBSDID(s)	/* nothing */
11492998Sobrien#endif /* not lint and not STRIP_FBSDID */
11592998Sobrien
11686551Sjake#endif /* !_MACHINE_ASM_H_ */
117