summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64/include
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2001-08-18 16:19:29 +0000
committerJason Wright <jason@cvs.openbsd.org>2001-08-18 16:19:29 +0000
commitfdefb93f605f051a06f51deddc7c3d5cbad173a5 (patch)
treeb0cbf2e2d774633a7aa6a691eae7afde3d66e821 /sys/arch/sparc64/include
parent60b7c06efc4805b2f6bdad4a9bf1db2576d4c2ff (diff)
More files needed to compile/link ofwboot
Diffstat (limited to 'sys/arch/sparc64/include')
-rw-r--r--sys/arch/sparc64/include/boot_flag.h75
-rw-r--r--sys/arch/sparc64/include/disklabel.h46
-rw-r--r--sys/arch/sparc64/include/exec.h105
-rw-r--r--sys/arch/sparc64/include/openfirm.h63
-rw-r--r--sys/arch/sparc64/include/stdarg.h144
5 files changed, 433 insertions, 0 deletions
diff --git a/sys/arch/sparc64/include/boot_flag.h b/sys/arch/sparc64/include/boot_flag.h
new file mode 100644
index 00000000000..47f171f01a6
--- /dev/null
+++ b/sys/arch/sparc64/include/boot_flag.h
@@ -0,0 +1,75 @@
+/* $OpenBSD: boot_flag.h,v 1.1 2001/08/18 16:19:28 jason Exp $ */
+/* $NetBSD: boot_flag.h,v 1.3 2001/07/01 02:56:21 gmcgarry Exp $ */
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_BOOT_FLAG_H_
+#define _SYS_BOOT_FLAG_H_
+
+#include <sys/reboot.h>
+
+/*
+ * Recognize standard boot arguments. If the flag is known, appropriate
+ * value is or'ed to retval, otherwise retval is left intact.
+ * Note that not all ports use all flags recognized here. This list is mere
+ * concatenation of all non-conflicting standard boot flags. Individual ports
+ * might use also other flags (see e.g. alpha).
+ */
+#define BOOT_FLAG(arg, retval) do { \
+ switch (arg) { \
+ case 'a': /* ask for file name to boot from */ \
+ (retval) |= RB_ASKNAME; \
+ break; \
+ case 'b': /* always halt, never reboot */ \
+ (retval) |= RB_HALT; \
+ break; \
+ case 'c': /* userconf */ \
+ (retval) |= RB_CONFIG; \
+ break; \
+ case 'd': /* break into the kernel debugger ASAP (if compiled in) */ \
+ (retval) |= RB_KDB; \
+ break; \
+ case 'm': /* mini root present in memory */ \
+ (retval) |= RB_MINIROOT; \
+ break; \
+ case 's': /* boot to single user */ \
+ (retval) |= RB_SINGLE; \
+ break; \
+ default: /* something else, do nothing */ \
+ break; \
+ } /* switch */ \
+ \
+ } while (/* CONSTCOND */ 0)
+
+#endif /* _SYS_BOOT_FLAG_H_ */
diff --git a/sys/arch/sparc64/include/disklabel.h b/sys/arch/sparc64/include/disklabel.h
new file mode 100644
index 00000000000..efdd62106f7
--- /dev/null
+++ b/sys/arch/sparc64/include/disklabel.h
@@ -0,0 +1,46 @@
+/* $OpenBSD: disklabel.h,v 1.1 2001/08/18 16:19:28 jason Exp $ */
+/* $NetBSD: disklabel.h,v 1.1.1.1 1998/06/20 04:58:51 eeh Exp $ */
+
+/*
+ * Copyright (c) 1994 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _MACHINE_DISKLABEL_H_
+#define _MACHINE_DISKLABEL_H_
+
+#define LABELSECTOR 0 /* sector containing label */
+#define LABELOFFSET 128 /* offset of label in sector */
+#define MAXPARTITIONS 8 /* number of partitions */
+#define RAW_PART 2 /* raw partition: xx?c */
+
+struct cpu_disklabel {
+ char cd_block[512];
+};
+
+#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/sparc64/include/exec.h b/sys/arch/sparc64/include/exec.h
new file mode 100644
index 00000000000..2a3a05b9d63
--- /dev/null
+++ b/sys/arch/sparc64/include/exec.h
@@ -0,0 +1,105 @@
+/* $OpenBSD: exec.h,v 1.1 2001/08/18 16:19:28 jason Exp $ */
+/* $NetBSD: elf_machdep.h,v 1.7 2001/02/11 00:18:49 eeh Exp $ */
+
+#define ELF32_MACHDEP_ENDIANNESS ELFDATA2MSB
+#define ELF32_MACHDEP_ID_CASES \
+ case EM_SPARC: \
+ case EM_SPARC32PLUS: \
+ break;
+
+#define ELF64_MACHDEP_ENDIANNESS ELFDATA2MSB
+#define ELF64_MACHDEP_ID_CASES \
+ case EM_SPARC32PLUS: \
+ case EM_SPARCV9: \
+ break;
+
+#ifdef __arch64__
+#define ARCH_ELFSIZE 64 /* MD native binary size */
+#else
+#define ARCH_ELFSIZE 32 /* MD native binary size */
+#endif
+
+/* The following are what is used for AT_SUN_HWCAP: */
+#define AV_SPARC_HWMUL_32x32 1 /* 32x32-bit smul/umul is efficient */
+#define AV_SPARC_HWDIV_32x32 2 /* 32x32-bit sdiv/udiv is efficient */
+#define AV_SPARC_HWFSMULD 4 /* fsmuld is efficient */
+
+/*
+ * Here are some SPARC specific flags I can't
+ * find a better home for. They are used for AT_FLAGS
+ * and in the exec header.
+ */
+#define EF_SPARCV9_MM 0x3
+#define EF_SPARCV9_TSO 0x0
+#define EF_SPARCV9_PSO 0x1
+#define EF_SPARCV9_RMO 0x2
+
+#define EF_SPARC_32PLUS_MASK 0xffff00 /* bits indicating V8+ type */
+#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */
+#define EF_SPARC_EXT_MASK 0xffff00 /* bits for vendor extensions */
+#define EF_SPARC_SUN_US1 0x000200 /* UltraSPARC 1 extensions */
+#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */
+#define EF_SPARC_SUN_US3 0x000800 /* UltraSPARC 3 extensions */
+
+/* Relocation types */
+#define R_SPARC_NONE 0
+#define R_SPARC_8 1
+#define R_SPARC_16 2
+#define R_SPARC_32 3
+#define R_SPARC_DISP8 4
+#define R_SPARC_DISP16 5
+#define R_SPARC_DISP32 6
+#define R_SPARC_WDISP30 7
+#define R_SPARC_WDISP22 8
+#define R_SPARC_HI22 9
+#define R_SPARC_22 10
+#define R_SPARC_13 11
+#define R_SPARC_LO10 12
+#define R_SPARC_GOT10 13
+#define R_SPARC_GOT13 14
+#define R_SPARC_GOT22 15
+#define R_SPARC_PC10 16
+#define R_SPARC_PC22 17
+#define R_SPARC_WPLT30 18
+#define R_SPARC_COPY 19
+#define R_SPARC_GLOB_DAT 20
+#define R_SPARC_JMP_SLOT 21
+#define R_SPARC_RELATIVE 22
+#define R_SPARC_UA32 23
+#define R_SPARC_PLT32 24
+#define R_SPARC_HIPLT22 25
+#define R_SPARC_LOPLT10 26
+#define R_SPARC_PCPLT32 27
+#define R_SPARC_PCPLT22 28
+#define R_SPARC_PCPLT10 29
+#define R_SPARC_10 30
+#define R_SPARC_11 31
+#define R_SPARC_64 32
+#define R_SPARC_OLO10 33
+#define R_SPARC_HH22 34
+#define R_SPARC_HM10 35
+#define R_SPARC_LM22 36
+#define R_SPARC_PC_HH22 37
+#define R_SPARC_PC_HM10 38
+#define R_SPARC_PC_LM22 39
+#define R_SPARC_WDISP16 40
+#define R_SPARC_WDISP19 41
+#define R_SPARC_GLOB_JMP 42
+#define R_SPARC_7 43
+#define R_SPARC_5 44
+#define R_SPARC_6 45
+#define R_SPARC_DISP64 46
+#define R_SPARC_PLT64 47
+#define R_SPARC_HIX22 48
+#define R_SPARC_LOX10 49
+#define R_SPARC_H44 50
+#define R_SPARC_M44 51
+#define R_SPARC_L44 52
+#define R_SPARC_REGISTER 53
+#define R_SPARC_UA64 54
+#define R_SPARC_UA16 55
+
+
+#define R_TYPE(name) __CONCAT(R_SPARC_,name)
+
+#define __LDPGSZ 8192 /* linker page size */
diff --git a/sys/arch/sparc64/include/openfirm.h b/sys/arch/sparc64/include/openfirm.h
new file mode 100644
index 00000000000..c72eef6f15e
--- /dev/null
+++ b/sys/arch/sparc64/include/openfirm.h
@@ -0,0 +1,63 @@
+/* $OpenBSD: openfirm.h,v 1.1 2001/08/18 16:19:28 jason Exp $ */
+/* $NetBSD: openfirm.h,v 1.8 2001/07/20 00:07:14 eeh Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996 Wolfgang Solfrank.
+ * Copyright (C) 1995, 1996 TooLs GmbH.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by TooLs GmbH.
+ * 4. The name of TooLs GmbH may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Prototypes for additional OpenFirmware Interface Routines
+ */
+
+#include <dev/ofw/openfirm.h>
+
+/* All cells are 8 byte slots */
+typedef u_int64_t cell_t;
+#ifdef __arch64__
+#define HDL2CELL(x) (cell_t)(u_int)(int)(x)
+#define ADR2CELL(x) (cell_t)(x)
+#else
+#define HDL2CELL(x) (cell_t)(u_int)(int)(x)
+#define ADR2CELL(x) (cell_t)(u_int)(int)(x)
+#endif
+
+int OF_test (char* service);
+int OF_test_method (int handle, char* method);
+int OF_getproplen (int handle, char* prop);
+
+int OF_stdin (void);
+int OF_stdout (void);
+void OF_set_symbol_lookup (void (*s2v)(void *), void (*v2s)(void *));
+void OF_poweroff (void) __attribute__((__noreturn__));
+void OF_sym2val (void *);
+void OF_val2sym (void *);
+/* void OF_interpret (char *); */
+int OF_milliseconds (void);
+int OF_searchprop (int node, char *prop, void *buf, int buflen);
+int OF_mapintr(int node, int *interrupt, int validlen, int buflen);
diff --git a/sys/arch/sparc64/include/stdarg.h b/sys/arch/sparc64/include/stdarg.h
new file mode 100644
index 00000000000..a5beb86cbbe
--- /dev/null
+++ b/sys/arch/sparc64/include/stdarg.h
@@ -0,0 +1,144 @@
+/* $OpenBSD: stdarg.h,v 1.1 2001/08/18 16:19:28 jason Exp $ */
+/* $NetBSD: stdarg.h,v 1.11 2000/07/23 21:36:56 mycroft Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: @(#)stdarg.h 8.2 (Berkeley) 9/27/93
+ */
+
+#ifndef _SPARC64_STDARG_H_
+#define _SPARC64_STDARG_H_
+
+#include <machine/ansi.h>
+
+#ifdef __lint__
+#define __builtin_saveregs(t) (0)
+#define __builtin_classify_type(t) (0)
+#define __builtin_next_arg(t) ((t) ? 0 : 0)
+#endif
+
+typedef _BSD_VA_LIST_ va_list;
+
+#define va_start(ap, last) \
+ (__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
+/*
+ * 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'
+ * may not be, e.g., `int (*)()').
+ *
+ * Gcc-2.x tries to use ldd/std for double and quad_t values, but Sun's
+ * brain-damaged calling convention does not quad-align these. Thus, for
+ * 8-byte arguments, we have to pick up the actual value four bytes at a
+ * time, and use type punning (i.e., a union) to produce the result.
+ * (We could also do this with a libc function, actually, by returning
+ * 8 byte integers in %o0+%o1 and the same 8 bytes as a double in %f0+%f1.)
+ *
+ * Note: We don't declare __d with type `type', since in C++ the type might
+ * have a constructor.
+ */
+#if __GNUC__ < 2
+#define __extension__
+#endif
+
+#define __va_8byte(ap, type) \
+ __extension__ ({ \
+ union { char __d[sizeof(type)]; int __i[2]; } __va_u; \
+ __va_u.__i[0] = ((int *)(void *)(ap))[0]; \
+ __va_u.__i[1] = ((int *)(void *)(ap))[1]; \
+ (ap) += 8; *(type *)(va_list)__va_u.__d; \
+ })
+
+#define __va_arg(ap, type) \
+ (*(type *)((ap) += __va_size(type), \
+ (ap) - (sizeof(type) < sizeof(long) && \
+ sizeof(type) != __va_size(type) ? \
+ sizeof(type) : __va_size(type))))
+
+#define __RECORD_TYPE_CLASS 12
+#define va_arg(ap, type) \
+ (__builtin_classify_type(*(type *)0) >= __RECORD_TYPE_CLASS ? \
+ *__va_arg(ap, type *) : __va_size(type) == 8 ? \
+ __va_8byte(ap, type) : __va_arg(ap, type))
+
+#endif
+
+#endif /* !_SPARC64_STDARG_H_ */