PERFORCE change 105539 for review
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Sat Sep 2 16:08:53 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=105539
Change 105539 by gonzo at gonzo_hideout on 2006/09/02 16:08:03
o Get macroses for MIPS assembly from NetBSD tree.
o Put NetBSD's mips/include/asm.h copyrights.
o Some additional call-frame defines added.
Affected files ...
.. //depot/projects/mips2/src/sys/mips/include/asm.h#7 edit
Differences ...
==== //depot/projects/mips2/src/sys/mips/include/asm.h#7 (text+ko) ====
@@ -1,9 +1,11 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+/* $NetBSD: asm.h,v 1.37 2006/01/20 22:02:40 christos Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
- * William Jolitz.
+ * Ralph Campbell.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -13,7 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -29,8 +31,24 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90
- * $FreeBSD: src/sys/amd64/include/asm.h,v 1.17 2005/04/10 20:49:21 alc Exp $
+ * @(#)machAsmDefs.h 8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * machAsmDefs.h --
+ *
+ * Macros used when writing assembler programs.
+ *
+ * Copyright (C) 1989 Digital Equipment Corporation.
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appears in all copies.
+ * Digital Equipment Corporation makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsmDefs.h,
+ * v 1.2 89/08/15 18:28:24 rab Exp SPRITE (DECWRL)
*/
#ifndef _MACHINE_ASM_H_
@@ -101,59 +119,158 @@
#define ta2 $10
#define ta3 $11
-/* XXX: values which depends on register size.
- * Used for sigcontext/mcontext_t handling.
+#ifdef __ELF__
+# define _C_LABEL(x) x
+#else
+# ifdef __STDC__
+# define _C_LABEL(x) _ ## x
+# else
+# define _C_LABEL(x) _/**/x
+# endif
+#endif
+
+/*
+ * WEAK_ALIAS: create a weak alias.
+ */
+#define WEAK_ALIAS(alias,sym) \
+ .weak alias; \
+ alias = sym
+/*
+ * STRONG_ALIAS: create a strong alias.
*/
-#define SZREG 4
-#define _OFFSETOF_SC_REGS 8
+#define STRONG_ALIAS(alias,sym) \
+ .globl alias; \
+ alias = sym
+
+#define GLOBAL(sym) \
+ .globl sym; sym:
+
+#define ENTRY(sym) \
+ .text; .globl sym; .ent sym; sym:
-#if 0
-/* XXX: Should this be kt0 or kt1? */
-/* In the kernel, we use t7 to point at the per-cpu globals. */
-#ifdef _KERNEL
-#define pcpup $8
-#endif
-#endif
+#define ASM_ENTRY(sym) \
+ .text; .globl sym; .type sym, at function; sym:
/*
- * XXXMIPS: I don't like #ifdef noyet, since vim doesn't seem to understand
- * it.
+ * LEAF
+ * A leaf routine does
+ * - call no other function,
+ * - never use any register that callee-saved (S0-S8), and
+ * - not use any local stack storage.
*/
-#if 0
+#define LEAF(x) \
+ .globl _C_LABEL(x); \
+ .ent _C_LABEL(x), 0; \
+_C_LABEL(x): ; \
+ .frame sp, 0, ra;
+
/*
- * Load the global pointer.
+ * STATIC_LEAF
+ * Declare a local leaf function.
*/
-#define LDGP(reg) \
- ldgp gp, 0(reg)
-#endif /* notyet */
+#define STATIC_LEAF(x) \
+ .ent _C_LABEL(x), 0; \
+_C_LABEL(x): ; \
+ .frame sp, 0, ra;
/*
- * XXXMIPS: Stolen from juli's code.
- * begin
+ * XLEAF
+ * declare alternate entry to leaf routine
*/
+#define XLEAF(x) \
+ .globl _C_LABEL(x); \
+ AENT (_C_LABEL(x)); \
+_C_LABEL(x):
-#define GLOBAL(sym) \
- .globl sym; sym:
+/*
+ * STATIC_XLEAF
+ * declare alternate entry to a static leaf routine
+ */
+#define STATIC_XLEAF(x) \
+ AENT (_C_LABEL(x)); \
+_C_LABEL(x):
+
+/*
+ * NESTED
+ * A function calls other functions and needs
+ * therefore stack space to save/restore registers.
+ */
+#define NESTED(x, fsize, retpc) \
+ .globl _C_LABEL(x); \
+ .ent _C_LABEL(x), 0; \
+_C_LABEL(x): ; \
+ .frame sp, fsize, retpc;
-#define XLEAF(sym) \
- .globl sym; sym:
+/*
+ * XNESTED
+ * declare alternate entry point to nested routine.
+ */
+#define XNESTED(x) \
+ .globl _C_LABEL(x); \
+ AENT (_C_LABEL(x)); \
+_C_LABEL(x):
-#define LEAF(sym) \
- .globl sym; .ent sym; sym: .frame sp, 0, ra
+/*
+ * END
+ * Mark end of a procedure.
+ */
+#define END(x) \
+ .end _C_LABEL(x)
-#define ENTRY(sym) \
- .text; .globl sym; .ent sym; sym:
-#define ASM_ENTRY(sym) \
- .text; .globl sym; .type sym, at function; sym:
+/*
+ * standard callframe {
+ * register_t cf_args[4]; arg0 - arg3
+ * register_t cf_sp; frame pointer
+ * register_t cf_ra; return address
+ * };
+ */
+#define CALLFRAME_SIZ (4 * (4 + 2))
+#define CALLFRAME_SP (4 * 4)
+#define CALLFRAME_RA (4 * 5)
-#define END(sym) \
- .end sym
+/*
+ * While it would be nice to be compatible with the SGI
+ * REG_L and REG_S macros, because they do not take parameters, it
+ * is impossible to use them with the _MIPS_SIM_ABIX32 model.
+ *
+ * These macros hide the use of mips3 instructions from the
+ * assembler to prevent the assembler from generating 64-bit style
+ * ABI calls.
+ */
-/* XXXMIPS: end */
+#if !defined(_MIPS_BSD_API) || _MIPS_BSD_API == _MIPS_BSD_API_LP32
+#define REG_L lw
+#define REG_S sw
+#define REG_LI li
+#define REG_PROLOGUE .set push
+#define REG_EPILOGUE .set pop
+#define SZREG 4
+#else
+#define REG_L ld
+#define REG_S sd
+#define REG_LI dli
+#define REG_PROLOGUE .set push ; .set mips3
+#define REG_EPILOGUE .set pop
+#define SZREG 8
+#endif /* _MIPS_BSD_API */
+/*
+ * XXX: Values which depends on register size. Used for sigcontext/mcontext_t
+ * handling. Should to be checked and replaced in _setjmp/_longjmp functions.
+ */
+#if !defined(_MIPS_BSD_API) || _MIPS_BSD_API == _MIPS_BSD_API_LP32
+#define _OFFSETOF_SC_REGS 12
+#define _OFFSETOF_SC_FPREGS 152
+#define _OFFSETOF_SC_MASK 320
+#else
+#define _OFFSETOF_SC_REGS 16
+#define _OFFSETOF_SC_FPREGS 292
+#define _OFFSETOF_SC_MASK 460
+#endif
+/* XXXMIPS: end */
#define RCSID(x) .text; .asciz x
#undef __FBSDID
@@ -163,14 +280,18 @@
#define __FBSDID(s) /* nothing */
#endif /* not lint and not STRIP_FBSDID */
-#ifdef __ELF__
-# define _C_LABEL(x) x
+#ifdef __STDC__
+#define WARN_REFERENCES(sym,msg) \
+ .stabs msg ## ,30,0,0,0 ; \
+ .stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
+#elif defined(__ELF__)
+#define WARN_REFERENCES(sym,msg) \
+ .stabs msg,30,0,0,0 ; \
+ .stabs __STRING(sym),1,0,0,0
#else
-# ifdef __STDC__
-# define _C_LABEL(x) _ ## x
-# else
-# define _C_LABEL(x) _/**/x
-# endif
-#endif
+#define WARN_REFERENCES(sym,msg) \
+ .stabs msg,30,0,0,0 ; \
+ .stabs __STRING(_/**/sym),1,0,0,0
+#endif /* __STDC__ */
#endif /* !_MACHINE_ASM_H_ */
More information about the p4-projects
mailing list