xref: /f-stack/freebsd/mips/include/abi.h (revision 22ce4aff)
1 /*	$NetBSD: asm.h,v 1.29 2000/12/14 21:29:51 jeffs Exp $	*/
2 
3 /*
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  * Copyright (c) 1992, 1993
7  *	The Regents of the University of California.  All rights reserved.
8  *
9  * This code is derived from software contributed to Berkeley by
10  * Ralph Campbell.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. Neither the name of the University nor the names of its contributors
21  *    may be used to endorse or promote products derived from this software
22  *    without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  *
36  *	@(#)machAsmDefs.h	8.1 (Berkeley) 6/10/93
37  *	JNPR: asm.h,v 1.10 2007/08/09 11:23:32 katta
38  * $FreeBSD$
39  */
40 
41 /*
42  * machAsmDefs.h --
43  *
44  *	Macros used when writing assembler programs.
45  *
46  *	Copyright (C) 1989 Digital Equipment Corporation.
47  *	Permission to use, copy, modify, and distribute this software and
48  *	its documentation for any purpose and without fee is hereby granted,
49  *	provided that the above copyright notice appears in all copies.
50  *	Digital Equipment Corporation makes no representations about the
51  *	suitability of this software for any purpose.  It is provided "as is"
52  *	without express or implied warranty.
53  *
54  * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsmDefs.h,
55  *	v 1.2 89/08/15 18:28:24 rab Exp  SPRITE (DECWRL)
56  */
57 
58 #ifndef _MACHINE_ABI_H_
59 #define	_MACHINE_ABI_H_
60 
61 #if defined(__mips_o32)
62 #define	SZREG	4
63 #else
64 #define	SZREG	8
65 #endif
66 
67 #if defined(__mips_o32) || defined(__mips_o64)
68 #define	STACK_ALIGN	8
69 #else
70 #define	STACK_ALIGN	16
71 #endif
72 
73 /*
74  *  standard callframe {
75  *	register_t cf_pad[N];		o32/64 (N=0), n32 (N=1) n64 (N=1)
76  *  	register_t cf_args[4];		arg0 - arg3 (only on o32 and o64)
77  *  	register_t cf_gp;		global pointer (only on n32 and n64)
78  *  	register_t cf_sp;		frame pointer
79  *  	register_t cf_ra;		return address
80  *  };
81  */
82 #if defined(__mips_o32) || defined(__mips_o64)
83 #define	CALLFRAME_SIZ	(SZREG * (4 + 2))
84 #define	CALLFRAME_S0	0
85 #elif defined(__mips_n32) || defined(__mips_n64)
86 #define	CALLFRAME_SIZ	(SZREG * 4)
87 #define	CALLFRAME_S0	(CALLFRAME_SIZ - 4 * SZREG)
88 #endif
89 #ifndef _KERNEL
90 #define	CALLFRAME_GP	(CALLFRAME_SIZ - 3 * SZREG)
91 #endif
92 #define	CALLFRAME_SP	(CALLFRAME_SIZ - 2 * SZREG)
93 #define	CALLFRAME_RA	(CALLFRAME_SIZ - 1 * SZREG)
94 
95 #endif /* !_MACHINE_ABI_H_ */
96