Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc/include sync these with the sparc64 versions.
details: https://anonhg.NetBSD.org/src/rev/d18b59e6f97b
branches: trunk
changeset: 534207:d18b59e6f97b
user: mrg <mrg%NetBSD.org@localhost>
date: Sat Jul 20 08:37:30 2002 +0000
description:
sync these with the sparc64 versions.
diffstat:
sys/arch/sparc/include/asm.h | 61 +++++++++++++++++++++++++++++-
sys/arch/sparc/include/eeprom.h | 4 +-
sys/arch/sparc/include/loadfile_machdep.h | 6 +-
sys/arch/sparc/include/openpromio.h | 3 +-
sys/arch/sparc/include/profile.h | 14 ++++++-
sys/arch/sparc/include/setjmp.h | 3 +-
sys/arch/sparc/include/stdarg.h | 57 ++++++++++++++++++++++------
7 files changed, 124 insertions(+), 24 deletions(-)
diffs (truncated from 323 to 300 lines):
diff -r 91677f108679 -r d18b59e6f97b sys/arch/sparc/include/asm.h
--- a/sys/arch/sparc/include/asm.h Sat Jul 20 08:36:17 2002 +0000
+++ b/sys/arch/sparc/include/asm.h Sat Jul 20 08:37:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: asm.h,v 1.13 2002/06/24 01:13:34 thorpej Exp $ */
+/* $NetBSD: asm.h,v 1.14 2002/07/20 08:37:30 mrg Exp $ */
/*
* Copyright (c) 1994 Allen Briggs
@@ -44,6 +44,12 @@
#ifndef _ASM_H_
#define _ASM_H_
+/* Pull in CCFSZ, CC64FSZ, and BIAS from frame.h */
+#ifndef _LOCORE
+#define _LOCORE
+#endif
+#include <machine/frame.h>
+
#ifdef __ELF__
#define _C_LABEL(name) name
#else
@@ -59,23 +65,45 @@
/*
* PIC_PROLOGUE() is akin to the compiler generated function prologue for
* PIC code. It leaves the address of the Global Offset Table in DEST,
- * clobbering register TMP in the process. Using the temporary enables us
- * to work without a stack frame (doing so requires saving %o7) .
+ * clobbering register TMP in the process.
+ *
+ * We can use two code sequences. We can read the %pc or use the call
+ * instruction that saves the pc in %o7. Call requires the branch unit and
+ * IEU1, and clobbers %o7 which needs to be restored. This instruction
+ * sequence takes about 4 cycles due to instruction interdependence. Reading
+ * the pc takes 4 cycles to dispatch and is always dispatched alone. That
+ * sequence takes 7 cycles.
*/
+#ifdef __arch64__
+#define PIC_PROLOGUE(dest,tmp) \
+ mov %o7, tmp; \
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4),dest; \
+ call 0f; \
+ or dest,%lo(_GLOBAL_OFFSET_TABLE_+4),dest; \
+0: \
+ add dest,%o7,dest; \
+ mov tmp, %o7
+#else
#define PIC_PROLOGUE(dest,tmp) \
mov %o7,tmp; 3: call 4f; nop; 4: \
sethi %hi(_C_LABEL(_GLOBAL_OFFSET_TABLE_)-(3b-.)),dest; \
or dest,%lo(_C_LABEL(_GLOBAL_OFFSET_TABLE_)-(3b-.)),dest; \
add dest,%o7,dest; mov tmp,%o7
+#endif
/*
* PICCY_SET() does the equivalent of a `set var, %dest' instruction in
* a PIC-like way, but without involving the Global Offset Table. This
* only works for VARs defined in the same file *and* in the text segment.
*/
+#ifdef __arch64__
+#define PICCY_SET(var,dest,tmp) \
+ 3: rd %pc, tmp; add tmp,(var-3b),dest
+#else
#define PICCY_SET(var,dest,tmp) \
mov %o7,tmp; 3: call 4f; nop; 4: \
add %o7,(var-3b),dest; mov tmp,%o7
+#endif
#else
#define PIC_PROLOGUE(dest,tmp)
#define PICCY_OFFSET(var,dest,tmp)
@@ -90,16 +118,30 @@
#ifdef GPROF
/* see _MCOUNT_ENTRY in profile.h */
#ifdef __ELF__
+#ifdef __arch64__
+#define _PROF_PROLOGUE \
+ .data; .align 8; 1: .uaword 0; .uaword 0; \
+ .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call _mcount; \
+ or %o0,%lo(1b),%o0; restore
+#else
#define _PROF_PROLOGUE \
.data; .align 4; 1: .long 0; \
.text; save %sp,-96,%sp; sethi %hi(1b),%o0; call _mcount; \
or %o0,%lo(1b),%o0; restore
+#endif
+#else
+#ifdef __arch64__
+#define _PROF_PROLOGUE \
+ .data; .align 8; 1: .uaword 0; .uaword 0; \
+ .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call mcount; \
+ or %o0,%lo(1b),%o0; restore
#else
#define _PROF_PROLOGUE \
.data; .align 4; 1: .long 0; \
.text; save %sp,-96,%sp; sethi %hi(1b),%o0; call mcount; \
or %o0,%lo(1b),%o0; restore
#endif
+#endif
#else
#define _PROF_PROLOGUE
#endif
@@ -122,6 +164,18 @@
alias = sym
#endif
+/*
+ * WARN_REFERENCES: create a warning if the specified symbol is referenced.
+ */
+#ifdef __ELF__
+#ifdef __STDC__
+#define WARN_REFERENCES(_sym,_msg) \
+ .section .gnu.warning. ## _sym ; .ascii _msg ; .text
+#else
+#define WARN_REFERENCES(_sym,_msg) \
+ .section .gnu.warning./**/_sym ; .ascii _msg ; .text
+#endif /* __STDC__ */
+#else
#ifdef __STDC__
#define __STRING(x) #x
#define WARN_REFERENCES(sym,msg) \
@@ -133,5 +187,6 @@
.stabs msg,30,0,0,0 ; \
.stabs __STRING(_/**/sym),1,0,0,0
#endif /* __STDC__ */
+#endif /* __ELF__ */
#endif /* _ASM_H_ */
diff -r 91677f108679 -r d18b59e6f97b sys/arch/sparc/include/eeprom.h
--- a/sys/arch/sparc/include/eeprom.h Sat Jul 20 08:36:17 2002 +0000
+++ b/sys/arch/sparc/include/eeprom.h Sat Jul 20 08:37:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: eeprom.h,v 1.3 2002/03/03 03:11:06 jmc Exp $ */
+/* $NetBSD: eeprom.h,v 1.4 2002/07/20 08:37:30 mrg Exp $ */
/*
* Copyright (c) 1994 Gordon W. Ross
@@ -50,7 +50,7 @@
u_char eeTestArea[4]; /* Factory Defined */
u_short eeWriteCount[4]; /* || || */
u_char eeChecksum[4]; /* || || */
- time_t eeLastHwUpdate; /* || || */
+ u_int32_t eeLastHwUpdate; /* || || */
/* 0x14 */
u_char eeInstalledMem; /* Megabytes */
diff -r 91677f108679 -r d18b59e6f97b sys/arch/sparc/include/loadfile_machdep.h
--- a/sys/arch/sparc/include/loadfile_machdep.h Sat Jul 20 08:36:17 2002 +0000
+++ b/sys/arch/sparc/include/loadfile_machdep.h Sat Jul 20 08:37:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_machdep.h,v 1.5 2001/12/04 18:54:34 thorpej Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.6 2002/07/20 08:37:30 mrg Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
#define COUNT_KERNEL COUNT_ALL
#ifdef _STANDALONE
-#define LOADADDR(a) (((u_long)(a) & 0x0fffffff) + offset)
+#define LOADADDR(a) (((u_long)(a) & 0x0fffffff) + (u_long)offset)
#define ALIGNENTRY(a) ((u_long)(a))
#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
@@ -53,7 +53,7 @@
#define FREE(a, b) free(a, b)
#define OKMAGIC(a) ((a) == OMAGIC)
#else
-#define LOADADDR(a) (((u_long)(a)) + offset)
+#define LOADADDR(a) (((u_long)(a)) + (u_long)offset)
#define ALIGNENTRY(a) ((u_long)(a))
#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
diff -r 91677f108679 -r d18b59e6f97b sys/arch/sparc/include/openpromio.h
--- a/sys/arch/sparc/include/openpromio.h Sat Jul 20 08:36:17 2002 +0000
+++ b/sys/arch/sparc/include/openpromio.h Sat Jul 20 08:37:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: openpromio.h,v 1.2 1994/11/20 20:53:17 deraadt Exp $ */
+/* $NetBSD: openpromio.h,v 1.3 2002/07/20 08:37:30 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -58,3 +58,4 @@
#define OPIOCGETOPTNODE _IOR('O', 4, int) /* get openprom field */
#define OPIOCGETNEXT _IOWR('O', 5, int) /* get next node of node */
#define OPIOCGETCHILD _IOWR('O', 6, int) /* get first child of node */
+#define OPIOCFINDDEVICE _IOWR('O', 7, struct opiocdesc) /* find a specific device */
diff -r 91677f108679 -r d18b59e6f97b sys/arch/sparc/include/profile.h
--- a/sys/arch/sparc/include/profile.h Sat Jul 20 08:36:17 2002 +0000
+++ b/sys/arch/sparc/include/profile.h Sat Jul 20 08:37:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: profile.h,v 1.11 2001/11/03 20:24:42 thorpej Exp $ */
+/* $NetBSD: profile.h,v 1.12 2002/07/20 08:37:30 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -54,6 +54,17 @@
#ifdef PIC
/* Inline expansion of PICCY_SET() (see <machine/asm.h>). */
+#ifdef __arch64__
+#define MCOUNT \
+ __asm__(".global " _MCOUNT_ENTRY);\
+ __asm__(_MCOUNT_ENTRY ":");\
+ __asm__("add %o7, 8, %o1");\
+ __asm__("1: rd %pc, %o2");\
+ __asm__("add %o2," _MCOUNT_SYM "-1b, %o2");\
+ __asm__("ld [%o2], %o2");\
+ __asm__("jmpl %o2, %g0");\
+ __asm__("add %i7, 8, %o0");
+#else
#define MCOUNT \
__asm__(".global " _MCOUNT_ENTRY);\
__asm__(_MCOUNT_ENTRY ":");\
@@ -63,6 +74,7 @@
__asm__("ld [%o2], %o2");\
__asm__("jmpl %o2, %g0");\
__asm__("add %i7, 8, %o0");
+#endif
#else
#define MCOUNT \
__asm__(".global " _MCOUNT_ENTRY);\
diff -r 91677f108679 -r d18b59e6f97b sys/arch/sparc/include/setjmp.h
--- a/sys/arch/sparc/include/setjmp.h Sat Jul 20 08:36:17 2002 +0000
+++ b/sys/arch/sparc/include/setjmp.h Sat Jul 20 08:37:30 2002 +0000
@@ -1,7 +1,8 @@
-/* $NetBSD: setjmp.h,v 1.2 1998/10/01 03:28:11 thorpej Exp $ */
+/* $NetBSD: setjmp.h,v 1.3 2002/07/20 08:37:30 mrg Exp $ */
/*
* machine/setjmp.h: machine dependent setjmp-related information.
*/
#define _JBLEN 14 /* size, in longs, of a jmp_buf */
+ /* A sigcontext is 10 longs */
diff -r 91677f108679 -r d18b59e6f97b sys/arch/sparc/include/stdarg.h
--- a/sys/arch/sparc/include/stdarg.h Sat Jul 20 08:36:17 2002 +0000
+++ b/sys/arch/sparc/include/stdarg.h Sat Jul 20 08:37:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: stdarg.h,v 1.17 2000/10/13 03:53:26 christos Exp $ */
+/* $NetBSD: stdarg.h,v 1.18 2002/07/20 08:37:30 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -56,14 +56,52 @@
#define __builtin_saveregs() (0)
#define __builtin_classify_type(t) (0)
#define __builtin_next_arg(t) ((t) ? 0 : 0)
+#define __alignof__(t) (0)
#endif
-#define __va_size(type) \
- (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
-
#define va_start(ap, last) \
(void)(__builtin_next_arg(last), (ap) = (va_list)__builtin_saveregs())
+#if !defined(_ANSI_SOURCE) && \
+ (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \
+ defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L)
+# define va_copy(dest, src) \
+ ((dest) = (src))
+#endif
+
+#define va_end(ap)
+
+#ifdef __arch64__
+/*
+ * For sparcv9 code.
+ */
+#define __va_arg8(ap, type) \
+ (*(type *)(void *)((ap) += 8, (ap) - 8))
+#define __va_arg16(ap, type) \
+ (*(type *)(void *)((ap) = (va_list)(((unsigned long)(ap) + 31) & -16),\
+ (ap) - 16))
+#define __va_int(ap, type) \
+ (*(type *)(void *)((ap) += 8, (ap) - sizeof(type)))
+
+#define __REAL_TYPE_CLASS 8
+#define __RECORD_TYPE_CLASS 12
+#define va_arg(ap, type) \
+ (__builtin_classify_type(*(type *)0) == __REAL_TYPE_CLASS ? \
+ (__alignof__(type) == 16 ? __va_arg16(ap, type) : \
+ __va_arg8(ap, type)) : \
+ (__builtin_classify_type(*(type *)0) < __RECORD_TYPE_CLASS ? \
+ __va_int(ap, type) : \
+ (sizeof(type) <= 8 ? __va_arg8(ap, type) : \
+ (sizeof(type) <= 16 ? __va_arg16(ap, type) : \
+ *__va_arg8(ap, type *)))))
+
+#else /* __arch64__ */
+/*
+ * For sparcv8 code.
+ */
+#define __va_size(type) \
+ (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
+
/*
* va_arg picks up the next argument of type `type'. Appending an
* asterisk to `type' must produce a pointer to `type' (i.e., `type'
@@ -84,7 +122,7 @@
Home |
Main Index |
Thread Index |
Old Index