1250136Simp/*	$NetBSD: regdef.h,v 1.12 2005/12/11 12:18:09 christos Exp $	*/
2250136Simp
3250134Simp/*
4250134Simp * Copyright (c) 1992, 1993
5250136Simp *	The Regents of the University of California.  All rights reserved.
6178172Simp *
7250134Simp * This code is derived from software contributed to Berkeley by
8250134Simp * Ralph Campbell. This file is derived from the MIPS RISC
9250134Simp * Architecture book by Gerry Kane.
10178172Simp *
11250134Simp * Redistribution and use in source and binary forms, with or without
12250134Simp * modification, are permitted provided that the following conditions
13250134Simp * are met:
14250134Simp * 1. Redistributions of source code must retain the above copyright
15250134Simp *    notice, this list of conditions and the following disclaimer.
16250134Simp * 2. Redistributions in binary form must reproduce the above copyright
17250134Simp *    notice, this list of conditions and the following disclaimer in the
18250134Simp *    documentation and/or other materials provided with the distribution.
19250136Simp * 3. Neither the name of the University nor the names of its contributors
20250134Simp *    may be used to endorse or promote products derived from this software
21250134Simp *    without specific prior written permission.
22250134Simp *
23250134Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24250134Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25250134Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26250134Simp * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27250134Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28250134Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29250134Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30250134Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31250134Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32250134Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33250134Simp * SUCH DAMAGE.
34250136Simp *
35250136Simp *	@(#)regdef.h	8.1 (Berkeley) 6/10/93
36178172Simp * $FreeBSD$
37178172Simp */
38178172Simp
39250136Simp#ifndef _MIPS_REGDEF_H
40250136Simp#define _MIPS_REGDEF_H
41250135Simp
42250136Simp#include <machine/cdefs.h>	/* for API selection */
43250135Simp
44250136Simp#define zero	$0	/* always zero */
45250136Simp#define AT	$at	/* assembler temporary */
46250136Simp#define v0	$2	/* return value */
47250136Simp#define v1	$3
48250136Simp#define a0	$4	/* argument registers */
49250136Simp#define a1	$5
50250136Simp#define a2	$6
51250136Simp#define a3	$7
52250136Simp#if defined(__mips_n32) || defined(__mips_n64)
53250136Simp#define	a4	$8
54250136Simp#define	a5	$9
55250136Simp#define	a6	$10
56250136Simp#define	a7	$11
57250136Simp#define	t0	$12	/* temp registers (not saved across subroutine calls) */
58250136Simp#define	t1	$13
59250136Simp#define	t2	$14
60250136Simp#define	t3	$15
61250136Simp#else
62250136Simp#define t0	$8	/* temp registers (not saved across subroutine calls) */
63250136Simp#define t1	$9
64250136Simp#define t2	$10
65250136Simp#define t3	$11
66250136Simp#define t4	$12
67250136Simp#define t5	$13
68250136Simp#define t6	$14
69250136Simp#define t7	$15
70250136Simp#endif /* __mips_n32 || __mips_n64 */
71250136Simp#define s0	$16	/* saved across subroutine calls (callee saved) */
72250136Simp#define s1	$17
73250136Simp#define s2	$18
74250136Simp#define s3	$19
75250136Simp#define s4	$20
76250136Simp#define s5	$21
77250136Simp#define s6	$22
78250136Simp#define s7	$23
79250136Simp#define t8	$24	/* two more temporary registers */
80250136Simp#define t9	$25
81250136Simp#define k0	$26	/* kernel temporary */
82250136Simp#define k1	$27
83250136Simp#define gp	$28	/* global pointer */
84250136Simp#define sp	$29	/* stack pointer */
85250136Simp#define s8	$30	/* one more callee saved */
86250136Simp#define ra	$31	/* return address */
87250136Simp
88250136Simp/*
89250136Simp * These are temp registers whose names can be used in either the old
90250136Simp * or new ABI, although they map to different physical registers.  In
91250136Simp * the old ABI, they map to t4-t7, and in the new ABI, they map to a4-a7.
92250136Simp *
93250136Simp * Because they overlap with the last 4 arg regs in the new ABI, ta0-ta3
94250136Simp * should be used only when we need more than t0-t3.
95250136Simp */
96250136Simp#if defined(__mips_n32) || defined(__mips_n64)
97250136Simp#define	ta0	$8
98250136Simp#define	ta1	$9
99250136Simp#define	ta2	$10
100250136Simp#define	ta3	$11
101250136Simp#else
102250136Simp#define	ta0	$12
103250136Simp#define	ta1	$13
104250136Simp#define	ta2	$14
105250136Simp#define	ta3	$15
106250136Simp#endif /* __mips_n32 || __mips_n64 */
107250136Simp
108250136Simp#endif /* _MIPS_REGDEF_H */
109