diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-09-02 19:40:46 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-09-02 19:40:46 +0000 |
commit | 9ce004e213879c7110cca642cb05b5c5c0124ad4 (patch) | |
tree | 685508323fab880b52f59609a63312c674355c70 | |
parent | 1c0883a31d85f46760ad5003c0293ed26ec4696f (diff) |
Convert mvmeppc to use common powerpc parts.
51 files changed, 89 insertions, 6355 deletions
diff --git a/sys/arch/mvmeppc/dev/cpu.c b/sys/arch/mvmeppc/dev/cpu.c index 253c2ed0030..9ab192427bd 100644 --- a/sys/arch/mvmeppc/dev/cpu.c +++ b/sys/arch/mvmeppc/dev/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.1 2001/06/26 21:57:41 smurph Exp $ */ +/* $OpenBSD: cpu.c,v 1.2 2001/09/02 19:40:45 miod Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -42,7 +42,7 @@ #include <machine/autoconf.h> char cpu_model[80]; -char machine[] = "powerpc"; /* cpu architecture */ +char machine[] = MACHINE; /* cpu architecture */ /* Definition of the driver for autoconfig. */ static int cpumatch(struct device *, void *, void *); diff --git a/sys/arch/mvmeppc/include/ansi.h b/sys/arch/mvmeppc/include/ansi.h index ba1e0b55b98..90092cc37c7 100644 --- a/sys/arch/mvmeppc/include/ansi.h +++ b/sys/arch/mvmeppc/include/ansi.h @@ -1,84 +1,3 @@ -/* $OpenBSD: ansi.h,v 1.1 2001/06/26 21:57:42 smurph Exp $ */ -/* $NetBSD: ansi.h,v 1.2 1996/11/15 22:38:57 jtc Exp $ */ +/* $OpenBSD: ansi.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. 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 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. - * - * @(#)ansi.h 8.2 (Berkeley) 1/4/94 - */ - -#ifndef _ANSI_H_ -#define _ANSI_H_ - -/* - * Types which are fundamental to the implementation and may appear in - * more than one standard header are defined here. Standard headers - * then use: - * #ifdef _BSD_SIZE_T_ - * typedef _BSD_SIZE_T_ size_t; - * #undef _BSD_SIZE_T_ - * #endif - */ -#define _BSD_CLOCK_T_ unsigned long /* clock() */ -#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ -#define _BSD_SIZE_T_ unsigned int /* sizeof() */ -#define _BSD_SSIZE_T_ int /* byte count or error */ -#define _BSD_TIME_T_ int /* time() */ -struct __va_list_tag; -#define _BSD_VA_LIST_ struct __va_list_tag * /* va_list */ -#define _BSD_CLOCKID_T_ int -#define _BSD_TIMER_T_ int - -/* - * Runes (wchar_t) is declared to be an ``int'' instead of the more natural - * ``unsigned long'' or ``long''. Two things are happening here. It is not - * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, - * it looks like 10646 will be a 31 bit standard. This means that if your - * ints cannot hold 32 bits, you will be in trouble. The reason an int was - * chosen over a long is that the is*() and to*() routines take ints (says - * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you - * lose a bit of ANSI conformance, but your programs will still work. - * - * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t - * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains - * defined for ctype.h. - */ -#define _BSD_WCHAR_T_ int /* wchar_t */ -#define _BSD_RUNE_T_ int /* rune_t */ - -/* - * We describe off_t here so its declaration can be visible to - * stdio without pulling in all of <sys/type.h>, thus appeasing ANSI. - */ -#define _BSD_OFF_T_ long long /* file offset */ - -#endif /* _ANSI_H_ */ +#include <powerpc/ansi.h> diff --git a/sys/arch/mvmeppc/include/asm.h b/sys/arch/mvmeppc/include/asm.h index ed098b5a24e..2d7dd239381 100644 --- a/sys/arch/mvmeppc/include/asm.h +++ b/sys/arch/mvmeppc/include/asm.h @@ -1,106 +1,3 @@ -/* $OpenBSD: asm.h,v 1.1 2001/06/26 21:57:42 smurph Exp $ */ -/* $NetBSD: asm.h,v 1.1 1996/09/30 16:34:20 ws Exp $ */ +/* $OpenBSD: asm.h,v 1.2 2001/09/02 19:40:24 miod 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. - */ - -#ifndef _PPC_ASM_H_ -#define _PPC_ASM_H_ - -/* XXX */ -#define TARGET_ELF - -#ifdef PIC -#define PIC_PROLOGUE XXX -#define PIC_EPILOGUE XXX -#ifdef __STDC__ -#define PIC_PLT(x) x ## @plt -#define PIC_GOT(x) XXX -#define PIC_GOTOFF(x) XXX -#else /* not __STDC__ */ -#define PIC_PLT(x) x/**/@plt -#define PIC_GOT(x) XXX -#define PIC_GOTOFF(x) XXX -#endif /* __STDC__ */ -#else -#define PIC_PROLOGUE -#define PIC_EPILOGUE -#define PIC_PLT(x) x -#define PIC_GOT(x) x -#define PIC_GOTOFF(x) x -#endif - -#ifdef TARGET_AOUT -#ifdef __STDC__ -# define _C_LABEL(x) _ ## x -#else -# define _C_LABEL(x) _/**/x -#endif -#endif - -#ifdef TARGET_ELF -# define _C_LABEL(x) x -#endif -#define _ASM_LABEL(x) x - -#ifdef __STDC__ -# define _TMP_LABEL(x) .L_ ## x -#else -# define _TMP_LABEL(x) .L_/**/x -#endif - -#define _ENTRY(x) \ - .text; .align 2; .globl x; .type x,@function; x: - -#ifdef PROF -# define _PROF_PROLOGUE(y) \ - .section ".data"; \ - .align 2; \ -_TMP_LABEL(y):; \ - .long 0; \ - .section ".text"; \ - mflr 0; \ - addis 11, 11, _TMP_LABEL(y)@ha; \ - stw 0, 4(1); \ - addi 0, 11,_TMP_LABEL(y)@l; \ - bl _mcount; -#else -# define _PROF_PROLOGUE(y) -#endif - -#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE(y) -#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE(y) - -#define ASMSTR .asciz - -#define RCSID(x) .text; .asciz x - -#endif /* !_PPC_ASM_H_ */ +#include <powerpc/asm.h> diff --git a/sys/arch/mvmeppc/include/bat.h b/sys/arch/mvmeppc/include/bat.h index b2938749e9f..23718fd9942 100644 --- a/sys/arch/mvmeppc/include/bat.h +++ b/sys/arch/mvmeppc/include/bat.h @@ -1,54 +1,3 @@ -/* $OpenBSD: bat.h,v 1.1 2001/06/26 21:57:43 smurph Exp $ */ +/* $OpenBSD: bat.h,v 1.2 2001/09/02 19:40:24 miod 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. - */ - -#ifndef _MACHINE_BAT_H_ -#define _MACHINE_BAT_H_ - -struct bat { - u_int32_t batu; - u_int32_t batl; -}; - -#define BATU(vaddr) (((vaddr)&0xf0000000)|0x1ffe) -#define BATL(raddr,wimg) (((raddr)&0xf0000000)|(wimg)|0x2) - -#define BAT_W 0x40 -#define BAT_I 0x20 -#define BAT_M 0x10 -#define BAT_G 0x08 - -#ifdef _KERNEL -extern struct bat battable[16]; -#endif - -#endif /* _MACHINE_BAT_H_ */ +#include <powerpc/bat.h> diff --git a/sys/arch/mvmeppc/include/cdefs.h b/sys/arch/mvmeppc/include/cdefs.h index aefb56bbc02..06151ac459c 100644 --- a/sys/arch/mvmeppc/include/cdefs.h +++ b/sys/arch/mvmeppc/include/cdefs.h @@ -1,43 +1,3 @@ -/* $OpenBSD: cdefs.h,v 1.1 2001/06/26 21:57:43 smurph Exp $ */ -/* $NetBSD: cdefs.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */ +/* $OpenBSD: cdefs.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/* - * Written by J.T. Conklin <jtc@wimsey.com> 01/17/95. - * Public domain. - */ - -#ifndef _MACHINE_CDEFS_H_ -#define _MACHINE_CDEFS_H_ - -#ifdef __STDC__ -#define _C_LABEL(x) _STRING(_ ## x) -#else -#define _C_LABEL(x) _STRING(_/**/x) -#endif - -#if 0 -#ifdef __GNUC__ -#ifdef __STDC__ -#define __indr_reference(sym,alias) \ - __asm__(".stabs \"_" #alias "\",11,0,0,0"); \ - __asm__(".stabs \"_" #sym "\",1,0,0,0") -#define __warn_references(sym,msg) \ - __asm__(".stabs \"" msg "\",30,0,0,0"); \ - __asm__(".stabs \"_" #sym "\",1,0,0,0") -#else -#define __indr_reference(sym,alias) \ - __asm__(".stabs \"_/**/alias\",11,0,0,0"); \ - __asm__(".stabs \"_/**/sym\",1,0,0,0") -#define __warn_references(sym,msg) \ - __asm__(".stabs msg,30,0,0,0"); \ - __asm__(".stabs \"_/**/sym\",1,0,0,0") -#endif -#endif -#else -#define __warn_references(sym,msg) -/* -#define __indr_reference(sym,alias) -*/ -#endif - -#endif /* !_MACHINE_CDEFS_H_ */ +#include <powerpc/cdefs.h> diff --git a/sys/arch/mvmeppc/include/cpu.h b/sys/arch/mvmeppc/include/cpu.h index f2fe9897e39..e51c1708603 100644 --- a/sys/arch/mvmeppc/include/cpu.h +++ b/sys/arch/mvmeppc/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ */ +/* $OpenBSD: cpu.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ /* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */ /* @@ -34,27 +34,7 @@ #ifndef _MACHINE_CPU_H_ #define _MACHINE_CPU_H_ -#include <machine/frame.h> - -#include <machine/psl.h> - -#define CLKF_USERMODE(frame) (((frame)->srr1 & PSL_PR) != 0) -#define CLKF_BASEPRI(frame) ((frame)->pri == 0) -#define CLKF_PC(frame) ((frame)->srr0) -#define CLKF_INTR(frame) ((frame)->depth != 0) - -#define cpu_swapout(p) -#define cpu_wait(p) - -extern void delay __P((unsigned)); -#define DELAY(n) delay(n) - -extern volatile int want_resched; -extern volatile int astpending; - -#define need_resched() (want_resched = 1, astpending = 1) -#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1) -#define signotify(p) (astpending = 1) +#include <powerpc/cpu.h> #define CACHELINESIZE 32 /* For now XXX */ @@ -95,6 +75,4 @@ invdcache(from, len) __asm__ __volatile__ ("sync"); } -extern char *bootpath; - #endif /* _MACHINE_CPU_H_ */ diff --git a/sys/arch/mvmeppc/include/dlfcn.h b/sys/arch/mvmeppc/include/dlfcn.h index 51d6520ba15..dca45915fca 100644 --- a/sys/arch/mvmeppc/include/dlfcn.h +++ b/sys/arch/mvmeppc/include/dlfcn.h @@ -1,63 +1,3 @@ -/* $OpenBSD: dlfcn.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ */ -/* $NetBSD: dlfcn.h,v 1.2 1995/06/05 19:38:00 pk Exp $ */ +/* $OpenBSD: dlfcn.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/* - * Copyright (c) 1995 Paul Kranenburg - * 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 Paul Kranenburg. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software withough 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 _DLFCN_H_ -#define _DLFCN_H_ - -#include <sys/cdefs.h> - -/* - * User interface to the run-time linker. - */ -__BEGIN_DECLS -extern void *dlopen __P((const char *, int)); -extern int dlclose __P((void *)); -extern void *dlsym __P((void *, const char *)); -extern int dlctl __P((void *, int, void *)); -extern const char *dlerror __P((void)); -__END_DECLS - -/* Values for dlopen `mode'. */ -#define DL_LAZY 1 -#define RTLD_LAZY DL_LAZY /* SunOS Compat */ - -/* - * dlctl() commands - */ -#define DL_GETERRNO 1 -#define DL_SETSRCHPATH x -#define DL_GETLIST x -#define DL_GETREFCNT x -#define DL_GETLOADADDR x - -#endif /* _DLFCN_H_ */ +#include <powerpc/dlfcn.h> diff --git a/sys/arch/mvmeppc/include/elf_abi.h b/sys/arch/mvmeppc/include/elf_abi.h index 8655664c0ec..a93fa5e7a8e 100644 --- a/sys/arch/mvmeppc/include/elf_abi.h +++ b/sys/arch/mvmeppc/include/elf_abi.h @@ -1,48 +1,3 @@ -/* $OpenBSD: elf_abi.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ */ +/* $OpenBSD: elf_abi.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/* - * Copyright (c) 1996 Per Fogelstrom - * - * 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 under OpenBSD by - * Per Fogelstrom. - * 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 _POWERPC_ELF_ABI_H -#define _POWERPC_ELF_ABI_H - -/* From MIPS ABI supplemental */ - -/* Architecture dependent Segment types - p_type */ -/* ??NONE?? */ - -/* Architecture dependent d_tag field for Elf32_Dyn. */ -/* ??NONE?? */ - -#define DT_PROCNUM 0 - -#endif /* _POWERPC_ELF_ABI_H */ +#include <powerpc/elf_abi.h> diff --git a/sys/arch/mvmeppc/include/endian.h b/sys/arch/mvmeppc/include/endian.h index 92b7ec3163b..bdece7fa25f 100644 --- a/sys/arch/mvmeppc/include/endian.h +++ b/sys/arch/mvmeppc/include/endian.h @@ -1,40 +1,3 @@ -/* $OpenBSD: endian.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ */ +/* $OpenBSD: endian.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/*- - * Copyright (c) 1997 Niklas Hallqvist. 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 Niklas Hallqvist. - * 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 _POWERPC_ENDIAN_H_ -#define _POWERPC_ENDIAN_H_ - -#define BYTE_ORDER BIG_ENDIAN -#include <sys/endian.h> - -#define __STRICT_ALIGNMENT - -#endif /* _POWERPC_ENDIAN_H_ */ +#include <powerpc/endian.h> diff --git a/sys/arch/mvmeppc/include/exec.h b/sys/arch/mvmeppc/include/exec.h index e4a723216e1..0e8fc9334b2 100644 --- a/sys/arch/mvmeppc/include/exec.h +++ b/sys/arch/mvmeppc/include/exec.h @@ -1,57 +1,3 @@ -/* $OpenBSD: exec.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ */ +/* $OpenBSD: exec.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/* - * Copyright (c) 1997 Per Fogelstrom, Opsycon AB. - * - * 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 under OpenBSD for RTMX Inc, - * North Carolina, USA, by Per Fogelstrom, Opsycon AB, Sweden. - * 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. - * - * $Id: exec.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ - */ - -#ifndef _MACHINE_EXEC_H_ -#define _MACHINE_EXEC_H_ - -#define __LDPGSZ 4096 /* linker page size */ - -/* - * Define what exec "formats" we should handle. - */ -#define NATIVE_EXEC_ELF -#define EXEC_SCRIPT - -#define ARCH_ELFSIZE 32 - -#define ELF_TARG_CLASS ELFCLASS32 -#define ELF_TARG_DATA ELFDATA2MSB -#define ELF_TARG_MACH EM_PPC - -#define _NLIST_DO_ELF - -#define _KERN_DO_ELF - -#endif /* _MACHINE_EXEC_H_ */ +#include <powerpc/exec.h> diff --git a/sys/arch/mvmeppc/include/float.h b/sys/arch/mvmeppc/include/float.h index 6c68fce847c..af76ee48ac2 100644 --- a/sys/arch/mvmeppc/include/float.h +++ b/sys/arch/mvmeppc/include/float.h @@ -1,80 +1,3 @@ -/* $OpenBSD: float.h,v 1.1 2001/06/26 21:57:45 smurph Exp $ */ +/* $OpenBSD: float.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/* - * Copyright (c) 1989 Regents of the University of California. - * 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 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. - * - * @(#)float.h 7.1 (Berkeley) 5/8/90 - */ - -#ifndef _MACHINE_FLOAT_H_ -#define _MACHINE_FLOAT_H_ - -#include <sys/cdefs.h> - -__BEGIN_DECLS -int __flt_rounds __P((void)); -__END_DECLS - -#define FLT_RADIX 2 /* b */ -#define FLT_ROUNDS __flt_rounds() - -#define FLT_MANT_DIG 24 /* p */ -#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ -#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ -#define FLT_MIN_EXP (-125) /* emin */ -#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */ -#define FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */ -#define FLT_MAX_EXP 128 /* emax */ -#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */ -#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ - -#define DBL_MANT_DIG 53 -#define DBL_EPSILON 2.2204460492503131E-16 -#define DBL_DIG 15 -#define DBL_MIN_EXP (-1021) -#define DBL_MIN 2.2250738585072014E-308 -#define DBL_MIN_10_EXP (-307) -#define DBL_MAX_EXP 1024 -#define DBL_MAX 1.7976931348623157E+308 -#define DBL_MAX_10_EXP 308 - -#define LDBL_MANT_DIG DBL_MANT_DIG -#define LDBL_EPSILON DBL_EPSILON -#define LDBL_DIG DBL_DIG -#define LDBL_MIN_EXP DBL_MIN_EXP -#define LDBL_MIN DBL_MIN -#define LDBL_MIN_10_EXP DBL_MIN_10_EXP -#define LDBL_MAX_EXP DBL_MAX_EXP -#define LDBL_MAX DBL_MAX -#define LDBL_MAX_10_EXP DBL_MAX_10_EXP - -#endif /* _MACHINE_FLOAT_H_ */ +#include <powerpc/float.h> diff --git a/sys/arch/mvmeppc/include/fpu.h b/sys/arch/mvmeppc/include/fpu.h index 34a4cda8070..d0687e52823 100644 --- a/sys/arch/mvmeppc/include/fpu.h +++ b/sys/arch/mvmeppc/include/fpu.h @@ -1,69 +1,3 @@ -/* $OpenBSD: fpu.h,v 1.1 2001/06/26 21:57:45 smurph Exp $ */ +/* $OpenBSD: fpu.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/*- - * Copyright (C) 1996 Wolfgang Solfrank. - * Copyright (C) 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. - */ -#ifndef _MACHINE_FPU_H_ -#define _MACHINE_FPU_H_ - -#define FPCSR_FX 0x80000000 -#define FPCSR_FEX 0x40000000 -#define FPCSR_VX 0x20000000 -#define FPCSR_OX 0x10000000 -#define FPCSR_UX 0x08000000 -#define FPCSR_ZX 0x04000000 -#define FPCSR_XX 0x02000000 -#define FPCSR_VXSNAN 0x01000000 -#define FPCSR_VXISI 0x00800000 -#define FPCSR_VXIDI 0x00400000 -#define FPCSR_VXZDZ 0x00200000 -#define FPCSR_VXIMZ 0x00100000 -#define FPCSR_VXVC 0x00080000 -#define FPCSR_FR 0x00040000 -#define FPCSR_FI 0x00020000 -#define FPCSR_FPRF 0x0001f000 -#define FPCSR_C 0x00010000 -#define FPCSR_FPCC 0x0000f000 -#define FPCSR_FL 0x00008000 -#define FPCSR_FG 0x00004000 -#define FPCSR_FE 0x00002000 -#define FPCSR_FU 0x00001000 -#define FPCSR_VXSOFT 0x00000400 -#define FPCSR_VXSQRT 0x00000200 -#define FPCSR_VXCVI 0x00000100 -#define FPCSR_VE 0x00000080 -#define FPCSR_OE 0x00000040 -#define FPCSR_UE 0x00000020 -#define FPCSR_ZE 0x00000010 -#define FPCSR_XE 0x00000008 -#define FPCSR_NI 0x00000004 -#define FPCSR_RN 0x00000003 - -#endif /* _MACHINE_FPU_H_ */ +#include <powerpc/fpu.h> diff --git a/sys/arch/mvmeppc/include/frame.h b/sys/arch/mvmeppc/include/frame.h index 2a12f8dea7b..9655be8924f 100644 --- a/sys/arch/mvmeppc/include/frame.h +++ b/sys/arch/mvmeppc/include/frame.h @@ -1,76 +1,3 @@ -/* $OpenBSD: frame.h,v 1.1 2001/06/26 21:57:45 smurph Exp $ */ +/* $OpenBSD: frame.h,v 1.2 2001/09/02 19:40:24 miod 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. - */ -#ifndef _MACHINE_FRAME_H_ -#define _MACHINE_FRAME_H_ - -#include <machine/types.h> - -/* - * This is to ensure alignment of the stackpointer - */ -#define FRAMELEN roundup(sizeof(struct trapframe) + 8, 16) -#define trapframe(p) ((struct trapframe *)((void *)(p)->p_addr + USPACE - FRAMELEN + 8)) - -struct switchframe { - register_t sp; - int fill; - int user_sr; - int cr; - register_t fixreg2; - register_t fixreg[19]; /* R13-R31 */ -}; - -struct clockframe { - register_t srr1; - register_t srr0; - int pri; - int depth; -}; - -/* - * Call frame for PowerPC used during fork. - */ -struct callframe { - register_t sp; - register_t lr; - register_t r30; - register_t r31; -}; - -struct sigframe { - int sf_signum; - siginfo_t *sf_sip; - struct sigcontext sf_sc; - siginfo_t sf_si; -}; -#endif /* _MACHINE_FRAME_H_ */ +#include <powerpc/frame.h> diff --git a/sys/arch/mvmeppc/include/ieee.h b/sys/arch/mvmeppc/include/ieee.h index 8552f21f957..4dd7dabfe58 100644 --- a/sys/arch/mvmeppc/include/ieee.h +++ b/sys/arch/mvmeppc/include/ieee.h @@ -1,136 +1,3 @@ -/* $OpenBSD: ieee.h,v 1.1 2001/06/26 21:57:45 smurph Exp $ */ +/* $OpenBSD: ieee.h,v 1.2 2001/09/02 19:40:24 miod 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. - * - * @(#)ieee.h 8.1 (Berkeley) 6/11/93 - */ - -/* - * ieee.h defines the machine-dependent layout of the machine's IEEE - * floating point. It does *not* define (yet?) any of the rounding - * mode bits, exceptions, and so forth. - */ - -/* - * Define the number of bits in each fraction and exponent. - * - * k k+1 - * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented - * - * (-exp_bias+1) - * as fractions that look like 0.fffff x 2 . This means that - * - * -126 - * the number 0.10000 x 2 , for instance, is the same as the normalized - * - * -127 -128 - * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero - * - * -129 - * in the fraction; to represent 2 , we need two, and so on. This - * - * (-exp_bias-fracbits+1) - * implies that the smallest denormalized number is 2 - * - * for whichever format we are talking about: for single precision, for - * - * -126 -149 - * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and - * - * -149 == -127 - 23 + 1. - */ -#define SNG_EXPBITS 8 -#define SNG_FRACBITS 23 - -#define DBL_EXPBITS 11 -#define DBL_FRACBITS 52 - -#define EXT_EXPBITS 15 -#define EXT_FRACBITS 112 - -struct ieee_single { - u_int sng_sign:1; - u_int sng_exp:8; - u_int sng_frac:23; -}; - -struct ieee_double { - u_int dbl_sign:1; - u_int dbl_exp:11; - u_int dbl_frach:20; - u_int dbl_fracl; -}; - -struct ieee_ext { - u_int ext_sign:1; - u_int ext_exp:15; - u_int ext_frach:16; - u_int ext_frachm; - u_int ext_fraclm; - u_int ext_fracl; -}; - -/* - * Floats whose exponent is in [1..INFNAN) (of whatever type) are - * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. - * Floats whose exponent is zero are either zero (iff all fraction - * bits are zero) or subnormal values. - * - * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its - * high fraction; if the bit is set, it is a `quiet NaN'. - */ -#define SNG_EXP_INFNAN 255 -#define DBL_EXP_INFNAN 2047 -#define EXT_EXP_INFNAN 32767 - -#if 0 -#define SNG_QUIETNAN (1 << 22) -#define DBL_QUIETNAN (1 << 19) -#define EXT_QUIETNAN (1 << 15) -#endif - -/* - * Exponent biases. - */ -#define SNG_EXP_BIAS 127 -#define DBL_EXP_BIAS 1023 -#define EXT_EXP_BIAS 16383 +#include <powerpc/ieee.h> diff --git a/sys/arch/mvmeppc/include/ieeefp.h b/sys/arch/mvmeppc/include/ieeefp.h index fc45c9b7ee4..23e16044857 100644 --- a/sys/arch/mvmeppc/include/ieeefp.h +++ b/sys/arch/mvmeppc/include/ieeefp.h @@ -1,25 +1,3 @@ -/* $OpenBSD: ieeefp.h,v 1.2 2001/07/04 08:31:32 niklas Exp $ */ +/* $OpenBSD: ieeefp.h,v 1.3 2001/09/02 19:40:24 miod Exp $ */ -/* - * Written by J.T. Conklin, Apr 6, 1995 - * Public domain. - */ - -#ifndef _MACHINE_IEEEFP_H_ -#define _MACHINE_IEEEFP_H_ - -typedef int fp_except; -#define FP_X_IMP 0x01 /* imprecise (loss of precision) */ -#define FP_X_DZ 0x02 /* divide-by-zero exception */ -#define FP_X_UFL 0x04 /* underflow exception */ -#define FP_X_OFL 0x08 /* overflow exception */ -#define FP_X_INV 0x10 /* invalid operation exception */ - -typedef enum { - FP_RN=0, /* round to nearest representable number */ - FP_RZ=1, /* round to zero (truncate) */ - FP_RM=2, /* round toward negative infinity */ - FP_RP=3 /* round toward positive infinity */ -} fp_rnd; - -#endif /* _MACHINE_IEEEFP_H_ */ +#include <powerpc/ieeefp.h> diff --git a/sys/arch/mvmeppc/include/intr.h b/sys/arch/mvmeppc/include/intr.h index 00ded9826a9..2908fa17f12 100644 --- a/sys/arch/mvmeppc/include/intr.h +++ b/sys/arch/mvmeppc/include/intr.h @@ -1,174 +1,3 @@ -/* $OpenBSD: intr.h,v 1.2 2001/07/06 05:14:30 smurph Exp $ */ +/* $OpenBSD: intr.h,v 1.3 2001/09/02 19:40:24 miod Exp $ */ -/* - * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA. - * - * 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 under OpenBSD by - * Per Fogelstrom, Opsycon AB, Sweden for RTMX Inc, North Carolina USA. - * 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_INTR_H_ -#define _MACHINE_INTR_H_ - -#define IPL_BIO 0 -#define IPL_NET 1 -#define IPL_TTY 2 -#define IPL_IMP 3 -#define IPL_CLOCK 4 -#define IPL_NONE 5 -#define IPL_HIGH 6 - -#define IST_NONE 0 -#define IST_PULSE 1 -#define IST_EDGE 2 -#define IST_LEVEL 3 - -#ifndef _LOCORE - -#define PPC_NIRQ 65 -#define PPC_CLK_IRQ 64 -extern int intrcnt[PPC_NIRQ]; - -void setsoftclock __P((void)); -void clearsoftclock __P((void)); -int splsoftclock __P((void)); -void setsoftnet __P((void)); -void clearsoftnet __P((void)); -int splsoftnet __P((void)); - -void do_pending_int __P((void)); - - -volatile extern int cpl, ipending, astpending, tickspending; -extern int imask[7]; - -/* - * Reorder protection in the following inline functions is - * achived with the "eieio" instruction which the assembler - * seems to detect and then doen't move instructions past.... - */ -static __inline int -splraise(newcpl) - int newcpl; -{ - int oldcpl; - - __asm__ volatile("sync; eieio\n"); /* don't reorder.... */ - oldcpl = cpl; - cpl = oldcpl | newcpl; - __asm__ volatile("sync; eieio\n"); /* reorder protect */ - return(oldcpl); -} - -static __inline void -splx(newcpl) - int newcpl; -{ - __asm__ volatile("sync; eieio\n"); /* reorder protect */ - cpl = newcpl; - if(ipending & ~newcpl) - do_pending_int(); - __asm__ volatile("sync; eieio\n"); /* reorder protect */ -} - -static __inline int -spllower(newcpl) - int newcpl; -{ - int oldcpl; - - __asm__ volatile("sync; eieio\n"); /* reorder protect */ - oldcpl = cpl; - cpl = newcpl; - if(ipending & ~newcpl) - do_pending_int(); - __asm__ volatile("sync; eieio\n"); /* reorder protect */ - return(oldcpl); -} - -/* Following code should be implemented with lwarx/stwcx to avoid - * the disable/enable. i need to read the manual once more.... */ -static __inline void -set_sint(pending) - int pending; -{ - int msrsave; - - __asm__ ("mfmsr %0" : "=r"(msrsave)); - __asm__ volatile ("mtmsr %0" :: "r"(msrsave & ~PSL_EE)); - ipending |= pending; - __asm__ volatile ("mtmsr %0" :: "r"(msrsave)); -} - -#define SINT_CLOCK 0x10000000 -#define SINT_NET 0x20000000 -#define SINT_TTY 0x40000000 -#define SPL_CLOCK 0x80000000 -#define SINT_MASK (SINT_CLOCK|SINT_NET|SINT_TTY) - -#define splbio() splraise(imask[IPL_BIO]) -#define splnet() splraise(imask[IPL_NET]) -#define spltty() splraise(imask[IPL_TTY]) -#define splclock() splraise(SPL_CLOCK|SINT_MASK) -#define splimp() splraise(imask[IPL_IMP]) -#define splvm() splraise(imask[IPL_IMP]) -#define splstatclock() splhigh() -#define spllowersoftclock() spllower(SINT_CLOCK) -#define splsoftclock() splraise(SINT_CLOCK) -#define splsoftnet() splraise(SINT_NET) -#define splsofttty() splraise(SINT_TTY) - -#define setsoftclock() set_sint(SINT_CLOCK); -#define setsoftnet() set_sint(SINT_NET); -#define setsofttty() set_sint(SINT_TTY); - -#define splhigh() splraise(0xffffffff) -#define spl0() spllower(0) - -/* - * Interrupt control struct used to control the ICU setup. - */ - -struct intrhand { - struct intrhand *ih_next; - int (*ih_fun) __P((void *)); - void *ih_arg; - u_long ih_count; - int ih_level; - int ih_irq; - char *ih_what; -}; -extern int ppc_configed_intr_cnt; -#define MAX_PRECONF_INTR 16 -extern struct intrhand ppc_configed_intr[MAX_PRECONF_INTR]; -void softnet(int isr); - -#endif /* _LOCORE */ - - -#endif /* _MACHINE_INTR_H_ */ +#include <powerpc/intr.h> diff --git a/sys/arch/mvmeppc/include/ipkdb.h b/sys/arch/mvmeppc/include/ipkdb.h index 499d249a160..038d6a75c8f 100644 --- a/sys/arch/mvmeppc/include/ipkdb.h +++ b/sys/arch/mvmeppc/include/ipkdb.h @@ -1,80 +1,3 @@ -/* $OpenBSD: ipkdb.h,v 1.1 2001/06/26 21:57:46 smurph Exp $ */ +/* $OpenBSD: ipkdb.h,v 1.2 2001/09/02 19:40:24 miod 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. - */ -/* register array */ -#define FIX 0 -#define LR 32 -#define CR 33 -#define CTR 34 -#define XER 35 -#define PC 36 -#define MSR 37 -#define NREG 38 - -#ifndef _LOCORE -extern int ipkdbregs[NREG]; - -/* Doesn't handle overlapping regions */ -__inline extern void -ipkdbcopy(s,d,n) - void *s, *d; - int n; -{ - char *sp = s, *dp = d; - - while (--n >= 0) - *dp++ = *sp++; -} - -__inline extern void -ipkdbzero(d,n) - void *d; - int n; -{ - char *dp = d; - - while (--n >= 0) - *dp++ = 0; -} - -__inline extern int -ipkdbcmp(s,d,n) - void *s, *d; -{ - char *sp = s, *dp = d; - - while (--n >= 0) - if (*sp++ != *dp++) - return *--dp - *--sp; - return 0; -} -#endif /* _LOCORE */ +#include <powerpc/ipkdb.h> diff --git a/sys/arch/mvmeppc/include/kbio.h b/sys/arch/mvmeppc/include/kbio.h index af8d95c6038..58664d1dffa 100644 --- a/sys/arch/mvmeppc/include/kbio.h +++ b/sys/arch/mvmeppc/include/kbio.h @@ -1,118 +1,3 @@ -/* $OpenBSD: kbio.h,v 1.1 2001/06/26 21:57:46 smurph Exp $ */ -/* $NetBSD: kbio.h,v 1.1 1996/04/12 01:45:45 cgd Exp $ */ +/* $OpenBSD: kbio.h,v 1.2 2001/09/02 19:40:24 miod 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. - * - * @(#)kbio.h 8.1 (Berkeley) 6/11/93 - */ - -#if 0 /* XXX */ -/* - * The following is a minimal emulation of Sun's `kio' structures - * and related operations necessary to make X11 happy (i.e., make it - * compile, and make old X11 binaries run). - */ - -/* - * The kiockey structure apparently gets and/or sets keyboard mappings. - * It seems to be kind of useless, but X11 uses it (according to the - * comments) to figure out when a Sun 386i has a type-4 keyboard but - * claims to have a type-3 keyboard. We need just enough to cause the - * appropriate ioctl to return the appropriate magic value. - * - * KIOCGETKEY fills in kio_entry from kio_station. Not sure what tablemask - * is for; X sets it before the call, so it is not an output, but we do not - * care anyway. KIOCSDIRECT is supposed to tell the kernel whether to send - * keys to the console or to X; we just send them to X whenever the keyboard - * is open at all. (XXX may need to change this later) - * - * Keyboard commands and types are defined in kbd.h as they are actually - * real hardware commands and type numbers. - */ -struct okiockey { /* Out-dated key translation structure */ - int kio_tablemask; /* whatever */ - u_char kio_station; /* key number */ - u_char kio_entry; /* HOLE if not present */ - char kio_text[10]; /* the silly escape sequences (unsupported) */ -}; - -struct kiockey { - int kio_tablemask; /* whatever */ - u_char kio_station; /* key number */ - u_short kio_entry; /* HOLE if not present */ - char kio_text[10]; /* the silly escape sequences (unsupported) */ -}; - -/* - * Values for kio_tablemask. These determine which table to read/modify - * in KIOC[SG]KEY ioctls. Currently, we only have "non-shift" and "shift" - * tables. - */ -#define KIOC_NOMASK 0x0 -#define KIOC_CAPSMASK 0x1 -#define KIOC_SHIFTMASK 0xe -#define KIOC_CTRLMASK 0x30 -#define KIOC_ALTGMASK 0x200 -#define KIOC_NUMLMASK 0x800 - -#define HOLE 0x302 /* value for kio_entry to say `really type 3' */ - -#define KIOCTRANS _IOW('k', 0, int) /* set translation mode */ - /* (we only accept TR_UNTRANS_EVENT) */ -#define KIOCGETKEY _IOWR('k', 2, struct okiockey) /* fill in kio_entry */ -#define KIOCGTRANS _IOR('k', 5, int) /* get translation mode */ -#define KIOCCMD _IOW('k', 8, int) /* X uses this to ring bell */ -#define KIOCTYPE _IOR('k', 9, int) /* get keyboard type */ -#endif /* 0 XXX */ -#define KIOCSDIRECT _IOW('k', 10, int) /* keys to console? */ -#if 0 /* XXX */ -#define KIOCSKEY _IOW('k', 12, struct kiockey) /* set xlat mode */ -#define KIOCGKEY _IOWR('k', 13, struct kiockey) /* get xlat mode */ -#define KIOCLAYOUT _IOR('k', 20, int) /* get keyboard layout */ -#define KIOCSLED _IOW('k', 14, char) /* set LED state */ -#define KIOCGLED _IOR('k', 15, char) /* get LED state */ - -#define TR_NONE 0 /* X compat, unsupported */ -#define TR_ASCII 1 /* X compat, unsupported */ -#define TR_EVENT 2 /* X compat, unsupported */ -#define TR_UNTRANS_EVENT 3 -#endif /* 0 XXX */ +#include <powerpc/kbio.h> diff --git a/sys/arch/mvmeppc/include/kcore.h b/sys/arch/mvmeppc/include/kcore.h index d8d2fce296d..1a5c90d491a 100644 --- a/sys/arch/mvmeppc/include/kcore.h +++ b/sys/arch/mvmeppc/include/kcore.h @@ -1,46 +1,3 @@ -/* $OpenBSD: kcore.h,v 1.1 2001/06/26 21:57:46 smurph Exp $ */ -/* $NetBSD: kcore.h,v 1.1 1996/09/30 16:34:26 ws Exp $ */ +/* $OpenBSD: kcore.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/*- - * Copyright (C) 1996 Wolfgang Solfrank. - * Copyright (C) 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. - */ - -#ifndef _MACHINE_KCORE_H_ -#define _MACHINE_KCORE_H_ - -#define NPHYS_RAM_SEGS 4 - -typedef struct cpu_kcore_hdr { - vm_offset_t ptable; /* Phys address of page table */ - vm_offset_t potable; /* Phys address of page overflow table */ - phys_ram_seg_t ram_segs[NPHYS_RAM_SEGS]; -} cpu_kcore_hdr_t; - -#endif /* _MACHINE_KCORE_H_ */ +#include <powerpc/kcore.h> diff --git a/sys/arch/mvmeppc/include/limits.h b/sys/arch/mvmeppc/include/limits.h index 7f56856521c..115340bf365 100644 --- a/sys/arch/mvmeppc/include/limits.h +++ b/sys/arch/mvmeppc/include/limits.h @@ -1,88 +1,3 @@ -/* $OpenBSD: limits.h,v 1.1 2001/06/26 21:57:46 smurph Exp $ */ -/* $NetBSD: limits.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ +/* $OpenBSD: limits.h,v 1.2 2001/09/02 19:40:24 miod 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. - */ - -#ifndef _MACHINE_LIMITS_H_ -#define _MACHINE_LIMITS_H_ - -#define CHAR_BIT 8 /* bits per char */ -#define MB_LEN_MAX 1 /* no multibyte characters */ -#define CHAR_MIN 0 /* min value in char */ -#define CHAR_MAX 0xff /* max value in char */ -#define UCHAR_MAX 0xff /* max value in unsigned char */ -#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */ -#define SCHAR_MAX 0x7f /* max value for a signed char */ - -#define SHRT_MIN (-0x7fff-1) /* min value in short */ -#define SHRT_MAX 0x7fff /* max value in short */ -#define USHRT_MAX 0xffff /* max value in unsigned short */ - -#define INT_MIN (-0x7fffffff-1) /* min value in int */ -#define INT_MAX 0x7fffffff /* max value in int */ -#define UINT_MAX 0xffffffff /* max value in unsigned int */ - -#define LONG_MIN (-0x7fffffff-1) /* min value in long */ -#define LONG_MAX 0x7fffffff /* max value in long */ -#define ULONG_MAX 0xffffffff /* max value in unsigned long */ - -#if !defined(_ANSI_SOURCE) -#define SSIZE_MAX INT_MAX /* max value for a ssize_t */ - -#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) -#define SIZE_T_MAX UINT_MAX /* max value for a size_t */ - -#define UID_MAX UINT_MAX /* max value for a uid_t */ -#define GID_MAX UINT_MAX /* max value for a gid_t */ - -#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */ -#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */ -#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */ -#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */ -#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */ -#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */ -#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */ -#endif /* !_ANSI_SOURCE */ - -#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE) -#define LONG_BIT 32 -#define WORD_BIT 32 - -#define DBL_DIG 15 -#define DBL_MAX 1.7976931348623157E+308 -#define DBL_MIN 2.2250738585072014E-308 - -#define FLT_DIG 6 -#define FLT_MAX 3.40282347E+38F -#define FLT_MIN 1.17549435E-38F -#endif -#endif /* _MACHINE_LIMITS_H_ */ +#include <powerpc/limits.h> diff --git a/sys/arch/mvmeppc/include/link.h b/sys/arch/mvmeppc/include/link.h index c8ede7dd33d..be72922465a 100644 --- a/sys/arch/mvmeppc/include/link.h +++ b/sys/arch/mvmeppc/include/link.h @@ -1,183 +1,3 @@ -/* $OpenBSD: link.h,v 1.1 2001/06/26 21:57:47 smurph Exp $ */ +/* $OpenBSD: link.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/* - * Copyright (c) 1996 Per Fogelstrom - * - * 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 under OpenBSD by - * Per Fogelstrom. - * 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 _POWERPC_LINK_H -#define _POWERPC_LINK_H - -#include <elf_abi.h> -#include <machine/elf_abi.h> - -/* - * Debug rendezvous struct. Pointer to this is set up in the - * target code pointed by the DT_MIPS_RLD_MAP tag. If it is - * defined. - */ - -struct r_debug { - int r_version; /* Protocol version. */ - struct link_map *r_map; /* Head of list of loaded objects. */ - - /* This is the address of a function internal to the run-time linker, - that will always be called when the linker begins to map in a - library or unmap it, and again when the mapping change is complete. - The debugger can set a breakpoint at this address if it wants to - notice shared object mapping changes. */ - Elf32_Addr r_brk; - enum { - /* This state value describes the mapping change taking place when - the `r_brk' address is called. */ - RT_CONSISTENT, /* Mapping change is complete. */ - RT_ADD, /* Adding a new object. */ - RT_DELETE, /* Removing an object mapping. */ - } r_state; - - Elf32_Addr r_ldbase; /* Base address the linker is loaded at. */ - }; - -/* This symbol refers to the "dynamic structure" in the `.dynamic' section - of whatever module refers to `_DYNAMIC'. So, to find its own - `struct r_debug', a program could do: - for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL) - if (dyn->d_tag == DT_MIPS_RLD_MAP) r_debug = (struct r_debug) dyn->d_un.d_ptr; - */ - -extern Elf32_Dyn _DYNAMIC[]; - - -/* Structure describing a loaded shared object. The `l_next' and `l_prev' - members form a chain of all the shared objects loaded at startup. - - These data structures exist in space used by the run-time dynamic linker; - modifying them may have disastrous results. */ - -struct link_map - { - /* These first few members are part of the protocol with the debugger. - This is the same format used in SVR4. */ - - Elf32_Addr l_addr; /* Base address shared object is loaded at. */ - Elf32_Addr l_offs; /* Offset */ - char *l_name; /* Absolute file name object was found in. */ - Elf32_Dyn *l_ld; /* Dynamic section of the shared object. */ - struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ - - /* All following members are internal to the dynamic linker. - They may change without notice. */ - - const char *l_libname; /* Name requested (before search). */ - - /* Indexed pointers to dynamic section. */ - Elf32_Dyn *l_info[DT_NUM + DT_PROCNUM]; - - const Elf32_Phdr *l_phdr; /* Pointer to program header table in core. */ - Elf32_Word l_phnum; /* Number of program header entries. */ - Elf32_Addr l_entry; /* Entry point location. */ - - /* Symbol hash table. */ - Elf32_Word l_nbuckets; - const Elf32_Word *l_buckets, *l_chain; - - unsigned int l_opencount; /* Reference count for dlopen/dlclose. */ - enum /* Where this object came from. */ - { - lt_executable, /* The main executable program. */ - lt_interpreter, /* The interpreter: the dynamic linker. */ - lt_library, /* Library needed by main executable. */ - lt_loaded, /* Extra run-time loaded shared object. */ - } l_type:2; - unsigned int l_deps_loaded:1; /* Nonzero if DT_NEEDED items loaded. */ - unsigned int l_relocated:1; /* Nonzero if object's relocations done. */ - unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */ - unsigned int l_init_running:1; /* Nonzero while DT_INIT function runs. */ - }; - -/* SOD information used by ldconfig and ld.so */ -/* - * Maximum number of recognized shared object version numbers. - */ -#define MAXDEWEY 8 - -/* - * Header of the hints file. - */ -struct hints_header { - long hh_magic; -#define HH_MAGIC 011421044151 - long hh_version; /* Interface version number */ -#define LD_HINTS_VERSION_1 1 -#define LD_HINTS_VERSION_2 2 - long hh_hashtab; /* Location of hash table */ - long hh_nbucket; /* Number of buckets in hashtab */ - long hh_strtab; /* Location of strings */ - long hh_strtab_sz; /* Size of strings */ - long hh_ehints; /* End of hints (max offset in file) */ - long hh_dirlist; /* Colon-separated list of srch dirs */ -}; - -#define HH_BADMAG(hdr) ((hdr).hh_magic != HH_MAGIC) - -/* - * Hash table element in hints file. - */ -struct hints_bucket { - /* namex and pathx are indices into the string table */ - int hi_namex; /* Library name */ - int hi_pathx; /* Full path */ - int hi_dewey[MAXDEWEY]; /* The versions */ - int hi_ndewey; /* Number of version numbers */ -#define hi_major hi_dewey[0] -#define hi_minor hi_dewey[1] - int hi_next; /* Next in this bucket */ -}; - -#define _PATH_LD_HINTS "/var/run/ld.so.hints" - -/* - * A `Shared Object Descriptor' describes a shared object that is needed - * to complete the link edit process of the object containing it. - * A list of such objects (chained through `sod_next') is pointed at - * by `sdt_sods' in the section_dispatch_table structure. - */ - -struct sod { /* Shared Object Descriptor */ - long sod_name; /* name (relative to load address) */ - u_int sod_library : 1, /* Searched for by library rules */ - sod_reserved : 31; - short sod_major; /* major version number */ - short sod_minor; /* minor version number */ - long sod_next; /* next sod */ -}; - - -#endif /* !_POWERPC_LINK_H */ +#include <powerpc/link.h> diff --git a/sys/arch/mvmeppc/include/param.h b/sys/arch/mvmeppc/include/param.h index c1a2395d0be..1cab89fcd14 100644 --- a/sys/arch/mvmeppc/include/param.h +++ b/sys/arch/mvmeppc/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.2 2001/07/06 02:07:43 provos Exp $ */ +/* $OpenBSD: param.h,v 1.3 2001/09/02 19:40:24 miod Exp $ */ /* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ /*- @@ -38,57 +38,16 @@ #endif /* _LOCORE */ #endif +#include <powerpc/param.h> + /* * Machine dependent constants for PowerPC (32-bit only currently) */ #define MACHINE "mvmeppc" #define _MACHINE mvmeppc -#define MACHINE_ARCH "powerpc" -#define _MACHINE_ARCH powerpc - -#define MID_MACHINE 0 /* None but has to be defined */ - -#define ALIGNBYTES (sizeof(double) - 1) -#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES) -#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) - -#define PGSHIFT 12 -#define NBPG 4096 -#define PGOFSET (NBPG - 1) -#define PAGE_SIZE NBPG -#define PAGE_MASK PGOFSET -#define PAGE_SHIFT PGSHIFT - -#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ -#define DEV_BSIZE (1 << DEV_BSHIFT) -#define BLKDEV_IOSIZE NBPG -#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ - -#define UPAGES 4 -#define USPACE (UPAGES * NBPG) #define KERNBASE 0x100000 -/* - * Constants related to network buffer management. - * MCLBYTES must be no larger than the software page size, and, - * on machines that exchange pages of input or output buffers with mbuf - * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple - * of the hardware page size. - */ -#define MSIZE 256 /* size of an mbuf */ -#define MCLSHIFT 11 /* convert bytes to m_buf clusters */ -#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ -#define MCLOFSET (MCLBYTES - 1) - -#ifndef NMBCLUSTERS -#ifdef GATEWAY -#define NMBCLUSTERS 2048 /* map size, max cluster allocation */ -#else -#define NMBCLUSTERS 1024 /* map size, max cluster allocation */ -#endif -#endif - #define MSGBUFSIZE (NBPG*2) /* @@ -98,52 +57,3 @@ #define NKMEMCLUSTERS (16 * 1024 * 1024 / PAGE_SIZE) #endif -/* - * pages ("clicks") to disk blocks - */ -#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) -#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) -/* - * bytes to pages - */ -#define ctob(x) ((x) << PGSHIFT) -#define btoc(x) (((x) + PGOFSET) >> PGSHIFT) - -/* - * bytes to disk blocks - */ -#define dbtob(x) ((x) << DEV_BSHIFT) -#define btodb(x) ((x) >> DEV_BSHIFT) - -/* - * Mach derived conversion macros - */ -#define powerpc_btop(x) ((unsigned)(x) >> PGSHIFT) -#define powerpc_ptob(x) ((unsigned)(x) << PGSHIFT) - -/* - * Segment handling stuff - */ -#define SEGMENT_LENGTH 0x10000000 -#define SEGMENT_MASK 0xf0000000 - -/* - * Fixed segments - */ -#define USER_SR 13 -#define KERNEL_SR 14 -#define KERNEL_SEGMENT (0xfffff0 + KERNEL_SR) -#define EMPTY_SEGMENT 0xfffff0 -#define USER_ADDR ((void *)(USER_SR << ADDR_SR_SHFT)) - -/* - * Some system constants - */ -#ifndef NPMAPS -#define NPMAPS 32768 /* Number of pmaps in system */ -#endif - -/* - * Temporary kludge till we do (ov)bcopy in assembler - */ -#define ovbcopy bcopy diff --git a/sys/arch/mvmeppc/include/pcb.h b/sys/arch/mvmeppc/include/pcb.h index dab951bb04a..308c71edaf5 100644 --- a/sys/arch/mvmeppc/include/pcb.h +++ b/sys/arch/mvmeppc/include/pcb.h @@ -1,71 +1,3 @@ -/* $OpenBSD: pcb.h,v 1.1 2001/06/26 21:57:47 smurph Exp $ */ -/* $NetBSD: pcb.h,v 1.1 1996/09/30 16:34:29 ws Exp $ */ +/* $OpenBSD: pcb.h,v 1.2 2001/09/02 19:40:24 miod 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. - */ -#ifndef _MACHINE_PCB_H_ -#define _MACHINE_PCB_H_ - -#include <machine/reg.h> - - -typedef struct __faultbuf { - int pc; - int sr; - int sp; - int cr; - int regs[20]; -} faultbuf; - -struct pcb { - struct pmap *pcb_pm; /* pmap of our vmspace */ - struct pmap *pcb_pmreal; /* real address of above */ - register_t pcb_sp; /* saved SP */ - int pcb_spl; /* saved SPL */ - faultbuf *pcb_onfault; /* For use during copyin/copyout */ - int pcb_flags; -#define PCB_FPU 1 /* Process had FPU initialized */ - struct fpu { - double fpr[32]; - double fpcsr; /* FPCSR stored as double for easier access */ - } pcb_fpu; /* Floating point processor */ -}; - -struct md_coredump { - struct reg regs; -}; - -#ifdef _KERNEL -extern struct pcb *curpcb; -extern struct pmap *curpm; -extern struct proc *fpuproc; -#endif -#endif /* _MACHINE_PCB_H_ */ +#include <powerpc/pcb.h> diff --git a/sys/arch/mvmeppc/include/pio.h b/sys/arch/mvmeppc/include/pio.h index 5373eebcc84..71110b885c1 100644 --- a/sys/arch/mvmeppc/include/pio.h +++ b/sys/arch/mvmeppc/include/pio.h @@ -1,195 +1,3 @@ -/* $OpenBSD: pio.h,v 1.1 2001/06/26 21:57:47 smurph Exp $ */ +/* $OpenBSD: pio.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/* - * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA. - * - * 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 under OpenBSD by - * Per Fogelstrom Opsycon AB for RTMX Inc, North Carolina, USA. - * 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_PIO_H_ -#define _MACHINE_PIO_H_ -/* - * I/O macros. - */ -void *mapiodev(paddr_t pa, psize_t len); - -static __inline void -__outb(a,v) - volatile u_int8_t *a; - int v; -{ - *a = v; - __asm__ volatile("eieio"); -} - -static __inline void -__outw(a,v) - volatile u_int16_t *a; - u_int16_t v; -{ - *a = v; - __asm__ volatile("eieio"); -} - -static __inline void -__outl(a,v) - volatile u_int32_t *a; - int v; -{ - *a = v; - __asm__ volatile("eieio"); -} - -static __inline void -__outwrb(a,v) - volatile u_int16_t *a; - u_int16_t v; -{ - u_int32_t _p_ = (u_int32_t)a; - - __asm__ volatile("sthbrx %0, 0, %1" :: "r"(v), "r"(_p_)); - __asm__ volatile("eieio"); -} - -static __inline void -__outlrb(a,v) - volatile u_int32_t *a; - u_int32_t v; -{ - u_int32_t _p_ = (u_int32_t)a; - - __asm__ volatile("stwbrx %0, 0, %1" :: "r"(v), "r"(_p_)); - __asm__ volatile("eieio"); -} - -static __inline u_int8_t -__inb(a) - volatile u_int8_t *a; -{ - u_int8_t _v_; - - __asm__ volatile("eieio"); - _v_ = *a; - return _v_; -} - -static __inline u_int16_t -__inw(a) - volatile u_int16_t *a; -{ - u_int16_t _v_; - - __asm__ volatile("eieio"); - _v_ = *a; - return _v_; -} - -static __inline u_int32_t -__inl(a) - volatile u_int32_t *a; -{ - u_int32_t _v_; - - __asm__ volatile("eieio"); - _v_ = *a; - return _v_; -} - -static __inline u_int16_t -__inwrb(a) - volatile u_int16_t *a; -{ - u_int16_t _v_; - u_int32_t _p_ = (u_int32_t)a; - - __asm__ volatile("eieio"); - __asm__ volatile("lhbrx %0, 0, %1" : "=r"(_v_) : "r"(_p_)); - return _v_; -} - -static __inline u_int32_t -__inlrb(a) - volatile u_int32_t *a; -{ - u_int32_t _v_; - u_int32_t _p_ = (u_int32_t)a; - - __asm__ volatile("eieio"); - __asm__ volatile("lwbrx %0, 0, %1" : "=r"(_v_) : "r"(_p_)); - return _v_; -} - - -#define outb(a,v) (__outb((volatile u_int8_t *)(a), v)) -#define out8(a,v) outb(a,v) -#define outw(a,v) (__outw((volatile u_int16_t *)(a), v)) -#define out16(a,v) outw(a,v) -#define outl(a,v) (__outl((volatile u_int32_t *)(a), v)) -#define out32(a,v) outl(a,v) -#define inb(a) (__inb((volatile u_int8_t *)(a))) -#define in8(a) inb(a) -#define inw(a) (__inw((volatile u_int16_t *)(a))) -#define in16(a) inw(a) -#define inl(a) (__inl((volatile u_int32_t *)(a))) -#define in32(a) inl(a) - -#define out8rb(a,v) outb(a,v) -#define outwrb(a,v) (__outwrb((volatile u_int16_t *)(a), v)) -#define out16rb(a,v) outwrb(a,v) -#define outlrb(a,v) (__outlrb((volatile u_int32_t *)(a), v)) -#define out32rb(a,v) outlrb(a,v) -#define in8rb(a) inb(a) -#define inwrb(a) (__inwrb((volatile u_int16_t *)(a))) -#define in16rb(a) inwrb(a) -#define inlrb(a) (__inlrb((volatile u_int32_t *)(a))) -#define in32rb(a) inlrb(a) - -#ifdef DEBUG_SPEC -static __inline void -__flash_led(bits, count) - int bits; -{ - int i, v = 0; - - if(bits == 0) { - v = 1; bits = 3; - } - bits &= 3; - count += count; - v |= (*(volatile u_int8_t *)(MPC106_V_ISA_IO_SPACE + 0x01f4)) & ~3; - while(count--) { - v ^= bits; - for(i = 100000; i > 0; i--) - *(volatile u_int8_t *)(MPC106_V_ISA_IO_SPACE + 0x01f4) = v; - } - *(u_int8_t *)(MPC106_V_ISA_IO_SPACE + 0x01f4) &= ~3; -} -#endif /* DEBUG */ - -#endif /*_MACHINE_PIO_H_*/ +#include <powerpc/pio.h> diff --git a/sys/arch/mvmeppc/include/pmap.h b/sys/arch/mvmeppc/include/pmap.h index a0a0b898f89..61c7982c52a 100644 --- a/sys/arch/mvmeppc/include/pmap.h +++ b/sys/arch/mvmeppc/include/pmap.h @@ -1,96 +1,3 @@ -/* $OpenBSD: pmap.h,v 1.2 2001/07/18 10:47:05 art Exp $ */ -/* $NetBSD: pmap.h,v 1.1 1996/09/30 16:34:29 ws Exp $ */ +/* $OpenBSD: pmap.h,v 1.3 2001/09/02 19:40:24 miod 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. - */ - -#ifndef _MACHINE_PMAP_H_ -#define _MACHINE_PMAP_H_ - -#include <machine/pte.h> - -/* - * Segment registers - */ -#ifndef _LOCORE -typedef u_int sr_t; -#endif /* _LOCORE */ -#define SR_TYPE 0x80000000 -#define SR_SUKEY 0x40000000 -#define SR_PRKEY 0x20000000 -#define SR_VSID 0x00ffffff - -#ifndef _LOCORE -/* V->P mapping data */ -typedef int pmapv_t; -#define VP_SR_SIZE 32 -#define VP_SR_MASK VP_SR_SIZE-1 -#define VP_SR_POS 27 -#define VP_IDX1_SIZE 1024 -#define VP_IDX1_MASK VP_IDX1_SIZE-1 -#define VP_IDX1_POS 17 -#define VP_IDX2_SIZE 32 -#define VP_IDX2_MASK VP_IDX2_SIZE-1 -#define VP_IDX2_POS 12 - -/* - * Pmap stuff - */ -struct pmap { - sr_t pm_sr[16]; /* segments used in this pmap */ - int pm_refs; /* ref count */ - pmapv_t *vps[VP_SR_SIZE]; /* virtual to physical table */ - struct pmap_statistics pm_stats; /* pmap statistics */ -}; - -typedef struct pmap *pmap_t; - -#ifdef _KERNEL -extern struct pmap kernel_pmap_; -#define pmap_kernel() (&kernel_pmap_) - -#define pmap_clear_modify(pa) (ptemodify(VM_PAGE_TO_PHYS(pa), PTE_CHG, 0)) -#define pmap_clear_reference(pa) (ptemodify(VM_PAGE_TO_PHYS(pa), PTE_REF, 0)) -#define pmap_is_modified(pg) (ptebits(VM_PAGE_TO_PHYS(pg), PTE_CHG)) -#define pmap_is_referenced(pg) (ptebits(VM_PAGE_TO_PHYS(pg), PTE_REF)) -#define pmap_change_wiring(pm, va, wired) - -#define pmap_unwire(pm, va) - -#define pmap_phys_address(x) (x) - -#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) - -void pmap_bootstrap __P((u_int kernelstart, u_int kernelend)); - -#endif /* _KERNEL */ -#endif /* _LOCORE */ -#endif /* _MACHINE_PMAP_H_ */ +#include <powerpc/pmap.h> diff --git a/sys/arch/mvmeppc/include/proc.h b/sys/arch/mvmeppc/include/proc.h index a5700e76289..d5bf66404d5 100644 --- a/sys/arch/mvmeppc/include/proc.h +++ b/sys/arch/mvmeppc/include/proc.h @@ -1,40 +1,3 @@ -/* $OpenBSD: proc.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ -/* $NetBSD: proc.h,v 1.1 1996/09/30 16:34:31 ws Exp $ */ +/* $OpenBSD: proc.h,v 1.2 2001/09/02 19:40:24 miod 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. - */ - -/* - * Machine-dependent part of the proc structure - */ -struct mdproc { - int dummy; -}; +#include <powerpc/proc.h> diff --git a/sys/arch/mvmeppc/include/profile.h b/sys/arch/mvmeppc/include/profile.h index f961bdbc427..1506c84e038 100644 --- a/sys/arch/mvmeppc/include/profile.h +++ b/sys/arch/mvmeppc/include/profile.h @@ -1,73 +1,3 @@ -/* $OpenBSD: profile.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ +/* $OpenBSD: profile.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/* - * Copyright (c) 1998 Dale Rahn. 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 Dale Rahn. - * 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. - */ -#define MCOUNT \ - __asm__(" \ - .section \".text\" \n\ - .align 2 \n\ - .globl _mcount \n\ - .type _mcount,@function \n\ - _mcount: \n\ - lwz 11, 4(1) \n\ - mflr 0 \n\ - stw 0, 4(1) \n\ - stwu 1, -48(1) \n\ - stw 3, 8(1) \n\ - stw 4, 12(1) \n\ - stw 5, 16(1) \n\ - stw 6, 20(1) \n\ - stw 7, 24(1) \n\ - stw 8, 28(1) \n\ - stw 9, 32(1) \n\ - stw 10,36(1) \n\ - stw 11,40(1) \n\ - mr 4, 0 \n\ - mr 3, 11 \n\ - bl __mcount \n\ - lwz 3, 8(1) \n\ - lwz 4, 12(1) \n\ - lwz 5, 16(1) \n\ - lwz 6, 20(1) \n\ - lwz 7, 24(1) \n\ - lwz 8, 28(1) \n\ - lwz 9, 32(1) \n\ - lwz 10,36(1) \n\ - lwz 11,40(1) \n\ - addi 1, 1, 48 \n\ - lwz 0, 4(1) \n\ - mtlr 11 \n\ - stw 11, 4(1) \n\ - mtctr 0 \n\ - bctr \n\ - .Lfe2: \n\ - .size _mcount, .Lfe2-_mcount \n\ - "); -#define _MCOUNT_DECL static __mcount +#include <powerpc/profile.h> diff --git a/sys/arch/mvmeppc/include/psl.h b/sys/arch/mvmeppc/include/psl.h index ff197f9c4aa..2bc77218387 100644 --- a/sys/arch/mvmeppc/include/psl.h +++ b/sys/arch/mvmeppc/include/psl.h @@ -1,77 +1,3 @@ -/* $OpenBSD: psl.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ -/* $NetBSD: psl.h,v 1.1 1996/09/30 16:34:32 ws Exp $ */ +/* $OpenBSD: psl.h,v 1.2 2001/09/02 19:40:24 miod 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. - */ -#ifndef _MACHINE_PSL_H_ -#define _MACHINE_PSL_H_ - -/* - * Flags in MSR: - */ -#define PSL_POW 0x00040000 -#define PSL_ILE 0x00010000 -#define PSL_EE 0x00008000 -#define PSL_PR 0x00004000 -#define PSL_FP 0x00002000 -#define PSL_ME 0x00001000 -#define PSL_FE0 0x00000800 -#define PSL_SE 0x00000400 -#define PSL_BE 0x00000200 -#define PSL_FE1 0x00000100 -#define PSL_IP 0x00000040 -#define PSL_IR 0x00000020 -#define PSL_DR 0x00000010 -#define PSL_RI 0x00000002 -#define PSL_LE 0x00000001 - -/* - * Floating-point exception modes: - */ -#define PSL_FE_DIS 0 -#define PSL_FE_NONREC PSL_FE1 -#define PSL_FE_REC PSL_FE0 -#define PSL_FE_PREC (PSL_FE0 | PSL_FE1) -#define PSL_FE_DFLT PSL_FE_DIS - -/* - * Note that PSL_POW and PSL_ILE are not in the saved copy of the MSR - */ -#define PSL_MBO 0 -#define PSL_MBZ 0 - -#define PSL_USERSET (PSL_EE | PSL_PR | PSL_ME | PSL_IR | PSL_DR | PSL_RI) - -#define PSL_USERSTATIC (PSL_USERSET | PSL_IP | 0x87c0008c) - -#include <machine/intr.h> - -#endif /* _MACHINE_PSL_H_ */ +#include <powerpc/psl.h> diff --git a/sys/arch/mvmeppc/include/pte.h b/sys/arch/mvmeppc/include/pte.h index 43becb6d73d..48f7c8ea980 100644 --- a/sys/arch/mvmeppc/include/pte.h +++ b/sys/arch/mvmeppc/include/pte.h @@ -1,113 +1,3 @@ -/* $OpenBSD: pte.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ -/* $NetBSD: pte.h,v 1.1 1996/09/30 16:34:32 ws Exp $ */ +/* $OpenBSD: pte.h,v 1.2 2001/09/02 19:40:24 miod 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. - */ - -#ifndef _MACHINE_PTE_H_ -#define _MACHINE_PTE_H_ - -#include <sys/queue.h> - -/* - * Page Table Entries - */ -#ifndef _LOCORE -struct pte { - u_int pte_hi; - u_int pte_lo; -}; -#endif /* _LOCORE */ -/* High word: */ -#define PTE_VALID 0x80000000 -#define PTE_VSID_SHFT 7 -#define PTE_HID 0x00000040 -#define PTE_API 0x0000003f -/* Low word: */ -#define PTE_RPGN 0xfffff000 -#define PTE_REF 0x00000100 -#define PTE_CHG 0x00000080 -#define PTE_WIMG 0x00000078 -#define PTE_W 0x00000040 -#define PTE_I 0x00000020 -#define PTE_M 0x00000010 -#define PTE_G 0x00000008 -#define PTE_PP 0x00000003 -#define PTE_RO 0x00000003 -#define PTE_RW 0x00000002 - -#ifndef _LOCORE -typedef struct pte pte_t; -#endif /* _LOCORE */ - -/* - * Extract bits from address - */ -#define ADDR_SR_SHFT 28 -#define ADDR_PIDX 0x0ffff000 -#define ADDR_PIDX_SHFT 12 -#define ADDR_API_SHFT 22 -#define ADDR_POFF 0x00000fff - -#ifndef _LOCORE -#ifdef _KERNEL -extern pte_t *ptable; -extern int ptab_cnt; -#endif /* _KERNEL */ -#endif /* _LOCORE */ - -/* - * Bits in DSISR: - */ -#define DSISR_DIRECT 0x80000000 -#define DSISR_NOTFOUND 0x40000000 -#define DSISR_PROTECT 0x08000000 -#define DSISR_INVRX 0x04000000 -#define DSISR_STORE 0x02000000 -#define DSISR_DABR 0x00400000 -#define DSISR_SEGMENT 0x00200000 -#define DSISR_EAR 0x00100000 - -/* - * Bits in SRR1 on ISI: - */ -#define ISSRR1_NOTFOUND 0x40000000 -#define ISSRR1_DIRECT 0x10000000 -#define ISSRR1_PROTECT 0x08000000 -#define ISSRR1_SEGMENT 0x00200000 - -#ifdef _KERNEL -#ifndef _LOCORE -extern u_int dsisr __P((void)); -extern vm_offset_t dar __P((void)); -#endif /* _KERNEL */ -#endif /* _LOCORE */ -#endif /* _MACHINE_PTE_H_ */ +#include <powerpc/pte.h> diff --git a/sys/arch/mvmeppc/include/ptrace.h b/sys/arch/mvmeppc/include/ptrace.h index 311a8ddcff3..5ef1464bd3d 100644 --- a/sys/arch/mvmeppc/include/ptrace.h +++ b/sys/arch/mvmeppc/include/ptrace.h @@ -1,48 +1,3 @@ -/* $OpenBSD: ptrace.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ -/* $NetBSD: ptrace.h,v 1.7 1995/01/26 19:47:10 mycroft Exp $ */ +/* $OpenBSD: ptrace.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/* - * Copyright (c) 1993 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 _POWERPC_PTRACE_H_ -#define _POWERPC_PTRACE_H_ - -/* - * powerpc-dependent ptrace definitions - */ -#define PT_STEP (PT_FIRSTMACH + 0) -#define PT_GETREGS (PT_FIRSTMACH + 1) -#define PT_SETREGS (PT_FIRSTMACH + 2) - -#if NOT_SUPPORTED -#define PT_GETFPREGS (PT_FIRSTMACH + 3) -#define PT_SETFPREGS (PT_FIRSTMACH + 4) -#endif - -#endif /* !_POWERPC_PTRACE_H_ */ +#include <powerpc/ptrace.h> diff --git a/sys/arch/mvmeppc/include/reg.h b/sys/arch/mvmeppc/include/reg.h index e65145f27e6..1eca0f95ac6 100644 --- a/sys/arch/mvmeppc/include/reg.h +++ b/sys/arch/mvmeppc/include/reg.h @@ -1,62 +1,3 @@ -/* $OpenBSD: reg.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ +/* $OpenBSD: reg.h,v 1.2 2001/09/02 19:40:24 miod Exp $ */ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * 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. - * - * @(#)reg.h 5.5 (Berkeley) 1/18/91 - */ - -#ifndef _POWERPC_REG_H_ -#define _POWERPC_REG_H_ - -/* - * Struct reg, used for procfs and in signal contexts - * Note that in signal contexts, it's represented as an array. - * That array has to look exactly like 'struct reg' though. - */ - -/* this table is set up to match what gdb expects */ -struct reg { - u_int32_t gpr[32]; - u_int64_t fpr[32]; - u_int32_t pc; - u_int32_t ps; - u_int32_t cnd; - u_int32_t lr; - u_int32_t cnt; - u_int32_t xer; - u_int32_t mq; -}; -#endif /* !_POWERPC_REG_H_ */ +#include <powerpc/reg.h> diff --git a/sys/arch/mvmeppc/include/reloc.h b/sys/arch/mvmeppc/include/reloc.h index 478656807da..767bf71a55d 100644 --- a/sys/arch/mvmeppc/include/reloc.h +++ b/sys/arch/mvmeppc/include/reloc.h @@ -1,78 +1,3 @@ -/* $OpenBSD: reloc.h,v 1.2 2001/07/04 08:31:32 niklas Exp $ */ -/* $NetBSD: reloc.h,v 1.1 1996/09/30 16:34:33 ws Exp $ */ +/* $OpenBSD: reloc.h,v 1.3 2001/09/02 19:40:24 miod 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. - */ -#ifndef _MACH_RELOC_H_ -#define _MACH_RELOC_H_ - -/* - * Quite a number of relocation types - */ -enum reloc_type { - RELOC_NONE, - RELOC_32, - RELOC_24, - RELOC_16, - RELOC_16_LO, - RELOC_16_HI, /* RELOC_ADDIS = 5 */ - RELOC_16_HA, - RELOC_14, - RELOC_14_TAKEN, - RELOC_14_NTAKEN, - RELOC_REL24, /* RELOC_BRANCH = 10 */ - RELOC_REL14, - RELOC_REL14_TAKEN, - RELOC_REL14_NTAKEN, - RELOC_GOT16, - RELOC_GOT16_LO, - RELOC_GOT16_HI, - RELOC_GOT16_HA, - RELOC_PLT24, - RELOC_COPY, - RELOC_GLOB_DAT, - RELOC_JMP_SLOT, - RELOC_RELATIVE, - RELOC_LOCAL24PC, - RELOC_U32, - RELOC_U16, - RELOC_REL32, - RELOC_PLT32, - RELOC_PLTREL32, - RELOC_PLT16_LO, - RELOC_PLT16_HI, - RELOC_PLT16_HA, - /* ABI defines this as 32nd entry, but we ignore this, at least for now */ - RELOC_SDAREL, - RELOC_MAX -}; - -#endif /* _MACH_RELOC_H_ */ +#include <powerpc/reloc.h> diff --git a/sys/arch/mvmeppc/include/setjmp.h b/sys/arch/mvmeppc/include/setjmp.h index 8082e31b666..089b4d3d2bd 100644 --- a/sys/arch/mvmeppc/include/setjmp.h +++ b/sys/arch/mvmeppc/include/setjmp.h @@ -1,4 +1,3 @@ -/* $OpenBSD: setjmp.h,v 1.2 2001/07/04 08:31:32 niklas Exp $ */ -/* $NetBSD: setjmp.h,v 1.1 1996/09/30 16:34:34 ws Exp $ */ +/* $OpenBSD: setjmp.h,v 1.3 2001/09/02 19:40:24 miod Exp $ */ -#define _JBLEN 100 +#include <powerpc/setjmp.h> diff --git a/sys/arch/mvmeppc/include/signal.h b/sys/arch/mvmeppc/include/signal.h index 15e93672485..3d9806ff46f 100644 --- a/sys/arch/mvmeppc/include/signal.h +++ b/sys/arch/mvmeppc/include/signal.h @@ -1,68 +1,3 @@ -/* $OpenBSD: signal.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ -/* $NetBSD: signal.h,v 1.1 1996/09/30 16:34:34 ws Exp $ */ +/* $OpenBSD: signal.h,v 1.2 2001/09/02 19:40:25 miod 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. - */ -#ifndef _MACHINE_SIGNAL_H_ -#define _MACHINE_SIGNAL_H_ - -typedef int sig_atomic_t; - -#include <machine/types.h> - -/* - * We have to save all registers on every trap, because - * 1. user could attach this process every time - * 2. we must be able to restore all user registers in case of fork - * Actually, we do not save the fp registers on trap, since - * these are not used by the kernel. They are saved only when switching - * between processes using the FPU. - * - */ -struct trapframe { - u_int32_t fixreg[32]; - u_int32_t lr; - u_int32_t cr; - u_int32_t xer; - u_int32_t ctr; - int srr0; - int srr1; - int dar; /* dar & dsisr are only filled on a DSI trap */ - int dsisr; - u_int32_t exc; -}; - -struct sigcontext { - int sc_onstack; /* saved onstack flag */ - int sc_mask; /* saved signal mask */ - struct trapframe sc_frame; /* saved registers */ -}; -#endif /* _MACHINE_SIGNAL_H_ */ +#include <powerpc/signal.h> diff --git a/sys/arch/mvmeppc/include/spinlock.h b/sys/arch/mvmeppc/include/spinlock.h index eded853cce9..e3bc149b06c 100644 --- a/sys/arch/mvmeppc/include/spinlock.h +++ b/sys/arch/mvmeppc/include/spinlock.h @@ -1,10 +1,3 @@ -/* $OpenBSD: spinlock.h,v 1.1 2001/06/26 21:57:49 smurph Exp $ */ +/* $OpenBSD: spinlock.h,v 1.2 2001/09/02 19:40:25 miod Exp $ */ -#ifndef _MACHINE_SPINLOCK_H_ -#define _MACHINE_SPINLOCK_H_ - -#define _SPINLOCK_UNLOCKED (0) -#define _SPINLOCK_LOCKED (1) -typedef int _spinlock_lock_t; - -#endif +#include <powerpc/spinlock.h> diff --git a/sys/arch/mvmeppc/include/stdarg.h b/sys/arch/mvmeppc/include/stdarg.h index 132071230dd..89e7a51aae6 100644 --- a/sys/arch/mvmeppc/include/stdarg.h +++ b/sys/arch/mvmeppc/include/stdarg.h @@ -1,51 +1,3 @@ -/* $OpenBSD: stdarg.h,v 1.2 2001/07/04 08:31:32 niklas Exp $ */ -/* $NetBSD: stdarg.h,v 1.1 1996/09/30 16:34:35 ws Exp $ */ +/* $OpenBSD: stdarg.h,v 1.3 2001/09/02 19:40:25 miod Exp $ */ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. 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 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. - * - * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MACHINE_STDARG_H_ -#define _MACHINE_STDARG_H_ - -#include <machine/ansi.h> - -#ifndef _STDARG_H -#define _STDARG_H -#endif -#include <machine/va-ppc.h> - -typedef _BSD_VA_LIST_ va_list; - -#endif /* !_MACHINE_STDARG_H_ */ +#include <powerpc/stdarg.h> diff --git a/sys/arch/mvmeppc/include/trap.h b/sys/arch/mvmeppc/include/trap.h index 9b66f42c4ec..a661ba3dde7 100644 --- a/sys/arch/mvmeppc/include/trap.h +++ b/sys/arch/mvmeppc/include/trap.h @@ -1,86 +1,3 @@ -/* $OpenBSD: trap.h,v 1.3 2001/07/06 05:14:30 smurph Exp $ */ -/* $NetBSD: trap.h,v 1.1 1996/09/30 16:34:35 ws Exp $ */ +/* $OpenBSD: trap.h,v 1.4 2001/09/02 19:40:25 miod 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. - */ -#ifndef _MACHINE_TRAP_H_ -#define _MACHINE_TRAP_H_ - -#define EXC_RSVD 0x0000 /* Reserved */ -#define EXC_RST 0x0100 /* Reset */ -#define EXC_MCHK 0x0200 /* Machine Check */ -#define EXC_DSI 0x0300 /* Data Storage Interrupt */ -#define EXC_ISI 0x0400 /* Instruction Storage Interrupt */ -#define EXC_EXI 0x0500 /* External Interrupt */ -#define EXC_ALI 0x0600 /* Alignment Interrupt */ -#define EXC_PGM 0x0700 /* Program Interrupt */ -#define EXC_FPU 0x0800 /* Floating-point Unavailable */ -#define EXC_DECR 0x0900 /* Decrementer Interrupt */ -#define EXC_SC 0x0c00 /* System Call */ -#define EXC_TRC 0x0d00 /* Trace */ -#define EXC_FPA 0x0e00 /* Floating-point Assist */ - -/* The following are only available on 604: */ -#define EXC_PERF 0x0f00 /* Performance Monitoring */ -#define EXC_BPT 0x1300 /* Instruction Breakpoint */ -#define EXC_SMI 0x1400 /* System Managment Interrupt */ - -/* And these are only on the 603: */ -#define EXC_IMISS 0x1000 /* Instruction translation miss */ -#define EXC_DLMISS 0x1100 /* Data load translation miss */ -#define EXC_DSMISS 0x1200 /* Data store translation miss */ - -#define EXC_LAST 0x2f00 /* Last possible exception vector */ - -#define EXC_AST 0x3000 /* Fake AST vector */ - -/* Trap was in user mode */ -#define EXC_USER 0x10000 - -/* - * EXC_ALI sets bits in the DSISR and DAR to provide enough - * information to recover from the unaligned access without needing to - * parse the offending instruction. This includes certain bits of the - * opcode, and information about what registers are used. The opcode - * indicator values below come from Appendix F of Book III of "The - * PowerPC Architecture". - */ - -#define EXC_ALI_OPCODE_INDICATOR(dsisr) ((dsisr >> 10) & 0x7f) -#define EXC_ALI_LFD 0x09 -#define EXC_ALI_STFD 0x0b -#define EXC_ALI_DCBZ 0x5f - -/* Macros to extract register information */ -#define EXC_ALI_RST(dsisr) ((dsisr >> 5) & 0x1f) /* source or target */ -#define EXC_ALI_RA(dsisr) (dsisr & 0x1f) - -#endif /* _MACHINE_TRAP_H_ */ +#include <powerpc/trap.h> diff --git a/sys/arch/mvmeppc/include/types.h b/sys/arch/mvmeppc/include/types.h index 87af1f45243..55ed77c002e 100644 --- a/sys/arch/mvmeppc/include/types.h +++ b/sys/arch/mvmeppc/include/types.h @@ -1,70 +1,3 @@ -/* $NetBSD: types.h,v 1.1 1996/09/30 16:34:36 ws Exp $ */ -/* $OpenBSD: types.h,v 1.1 2001/06/26 21:57:49 smurph Exp $ */ +/* $OpenBSD: types.h,v 1.2 2001/09/02 19:40:25 miod Exp $ */ -/*- - * Copyright (C) 1995 Wolfgang Solfrank. - * Copyright (C) 1995 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. - */ - -#ifndef _MACHINE_TYPES_H_ -#define _MACHINE_TYPES_H_ - -#include <sys/cdefs.h> - -#define __BIT_TYPES_DEFINED__ -typedef signed char int8_t; -typedef unsigned char u_int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short u_int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned int u_int32_t; -typedef unsigned int uint32_t; -typedef long long int64_t; -typedef unsigned long long u_int64_t; -typedef unsigned long long uint64_t; - -typedef u_int32_t register_t; - -typedef unsigned long vm_size_t; -typedef unsigned long vm_offset_t; - -typedef unsigned long vaddr_t; -typedef unsigned long paddr_t; -typedef unsigned long vsize_t; -typedef unsigned long psize_t; - -typedef struct label_t { - int val[40]; /* double check this XXX */ -} label_t; - -#define __BROKEN_INDIRECT_CONFIG - -#endif /* _MACHINE_TYPES_H_ */ +#include <powerpc/types.h> diff --git a/sys/arch/mvmeppc/include/va-ppc.h b/sys/arch/mvmeppc/include/va-ppc.h index f61a2704036..b114a9c121e 100644 --- a/sys/arch/mvmeppc/include/va-ppc.h +++ b/sys/arch/mvmeppc/include/va-ppc.h @@ -1,306 +1,3 @@ -/* $OpenBSD: va-ppc.h,v 1.2 2001/07/04 08:31:32 niklas Exp $ */ +/* $OpenBSD: va-ppc.h,v 1.3 2001/09/02 19:40:25 miod Exp $ */ -/* GNU C varargs support for the PowerPC with either the V.4 or Windows NT calling sequences */ - -#ifndef _WIN32 -/* System V.4 support */ -/* Define __gnuc_va_list. */ - -#ifndef __GNUC_VA_LIST -#define __GNUC_VA_LIST - -#ifndef _SYS_VA_LIST_H -#define _SYS_VA_LIST_H /* Solaris sys/va_list.h */ - -/* Solaris decided to rename overflow_arg_area to input_arg_area, - so handle it via a macro. */ -#define __va_overflow(AP) (AP)->overflow_arg_area - -/* Note that the names in this structure are in the user's namespace, but - that the V.4 abi explicitly states that these names should be used. */ -typedef struct __va_list_tag { - char gpr; /* index into the array of 8 GPRs stored in the - register save area gpr=0 corresponds to r3, - gpr=1 to r4, etc. */ - char fpr; /* index into the array of 8 FPRs stored in the - register save area fpr=0 corresponds to f1, - fpr=1 to f2, etc. */ - char *overflow_arg_area; /* location on stack that holds the next - overflow argument */ - char *reg_save_area; /* where r3:r10 and f1:f8, if saved are stored */ -} __va_list[1], __gnuc_va_list[1]; - -#else /* _SYS_VA_LIST */ - -typedef __va_list __gnuc_va_list; -#define __va_overflow(AP) (AP)->input_arg_area - -#endif /* not _SYS_VA_LIST */ -#endif /* not __GNUC_VA_LIST */ - -/* If this is for internal libc use, don't define anything but - __gnuc_va_list. */ -#if defined (_STDARG_H) || defined (_VARARGS_H) - -/* Register save area located below the frame pointer */ -#ifndef __VA_PPC_H__ -#define __VA_PPC_H__ -typedef struct { - long __gp_save[8]; /* save area for GP registers */ - double __fp_save[8]; /* save area for FP registers */ -} __va_regsave_t; - -/* Macros to access the register save area */ -/* We cast to void * and then to TYPE * because this avoids - a warning about increasing the alignment requirement. */ -#define __VA_FP_REGSAVE(AP,TYPE) \ - ((TYPE *) (void *) (&(((__va_regsave_t *) \ - (AP)->reg_save_area)->__fp_save[(int)(AP)->fpr]))) - -#define __VA_GP_REGSAVE(AP,TYPE) \ - ((TYPE *) (void *) (&(((__va_regsave_t *) \ - (AP)->reg_save_area)->__gp_save[(int)(AP)->gpr]))) -#if __GNUC_MINOR__ > 8 -#define GCC29 -#endif - -#ifndef GCC29 -/* Common code for va_start for both varargs and stdarg. This depends - on the format of rs6000_args in rs6000.h. The fields used are: - - #0 WORDS # words used for GP regs/stack values - #1 FREGNO next available FP register - #2 NARGS_PROTOTYPE # args left in the current prototype - #3 ORIG_NARGS original value of NARGS_PROTOTYPE - #4 VARARGS_OFFSET offset from frame pointer of varargs area */ -#else /* GCC29 */ -/* Common code for va_start for both varargs and stdarg. We allow all - the work to be done by __builtin_saveregs. It returns a pointer to - a va_list that was constructed on the stack; we must simply copy it - to the user's variable. */ -#endif /* GCC29 */ - -#ifndef GCC29 -#define __va_words __builtin_args_info (0) -#define __va_fregno __builtin_args_info (1) -#define __va_nargs __builtin_args_info (2) -#define __va_orig_nargs __builtin_args_info (3) -#define __va_varargs_offset __builtin_args_info (4) - -#define __va_start_common(AP, FAKE) \ -__extension__ ({ \ - register int __words = __va_words - FAKE; \ - \ - (AP) = (struct __va_list_tag *)__builtin_alloca(sizeof(struct __va_list_tag)); \ - (AP)->gpr = (__words < 8) ? __words : 8; \ - (AP)->fpr = __va_fregno - 33; \ - (AP)->reg_save_area = (((char *) __builtin_frame_address (0)) \ - + __va_varargs_offset); \ - __va_overflow(AP) = ((char *)__builtin_saveregs () \ - + (((__words >= 8) ? __words - 8 : 0) \ - * sizeof (long))); \ - (void)0; \ -}) -#else /* GCC29 */ -#define __va_start_common(AP, FAKE) \ -__extension__ ({ \ - (AP) = (struct __va_list_tag *)__builtin_alloca(sizeof(__gnuc_va_list)); \ - __builtin_memcpy ((AP), __builtin_saveregs (), sizeof(__gnuc_va_list)); \ - }) -#endif /* GCC29 */ - -#ifdef _STDARG_H /* stdarg.h support */ - -/* Calling __builtin_next_arg gives the proper error message if LASTARG is - not indeed the last argument. */ -#define va_start(AP,LASTARG) \ - (__builtin_next_arg (LASTARG), __va_start_common (AP, 0)) - -#else /* varargs.h support */ - -#define va_start(AP) __va_start_common (AP, 1) -#define va_alist __va_1st_arg -#define va_dcl register int va_alist; ... - -#endif /* _STDARG_H */ - -#ifdef _SOFT_FLOAT -#define __va_float_p(TYPE) 0 -#else -#define __va_float_p(TYPE) (__builtin_classify_type(*(TYPE *)0) == 8) -#endif - -#define __va_longlong_p(TYPE) \ - ((__builtin_classify_type(*(TYPE *)0) == 1) && (sizeof(TYPE) == 8)) - -#define __va_aggregate_p(TYPE) (__builtin_classify_type(*(TYPE *)0) >= 12) -#define __va_size(TYPE) ((sizeof(TYPE) + sizeof (long) - 1) / sizeof (long)) - -#ifndef GCC29 -#define va_arg(AP,TYPE) \ -__extension__ (*({ \ - register TYPE *__ptr; \ - \ - if (__va_float_p (TYPE) && (AP)->fpr < 8) \ - { \ - __ptr = __VA_FP_REGSAVE (AP, TYPE); \ - (AP)->fpr++; \ - } \ - \ - else if (__va_aggregate_p (TYPE) && (AP)->gpr < 8) \ - { \ - __ptr = * __VA_GP_REGSAVE (AP, TYPE *); \ - (AP)->gpr++; \ - } \ - \ - else if (!__va_float_p (TYPE) && !__va_aggregate_p (TYPE) \ - && (AP)->gpr + __va_size(TYPE) <= 8 \ - && (!__va_longlong_p(TYPE) \ - || (AP)->gpr + __va_size(TYPE) <= 7)) \ - { \ - if (__va_longlong_p(TYPE) && ((AP)->gpr & 1) != 0) \ - (AP)->gpr++; \ - \ - __ptr = __VA_GP_REGSAVE (AP, TYPE); \ - (AP)->gpr += __va_size (TYPE); \ - } \ - \ - else if (!__va_float_p (TYPE) && !__va_aggregate_p (TYPE) \ - && (AP)->gpr < 8) \ - { \ - (AP)->gpr = 8; \ - __ptr = (TYPE *) (void *) (__va_overflow(AP)); \ - __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \ - } \ - \ - else if (__va_aggregate_p (TYPE)) \ - { \ - __ptr = * (TYPE **) (void *) (__va_overflow(AP)); \ - __va_overflow(AP) += sizeof (TYPE *); \ - } \ - else \ - { \ - if (__va_longlong_p(TYPE) && ((long)__va_overflow(AP) & 4) != 0) \ - __va_overflow(AP) += 4; \ - \ - __ptr = (TYPE *) (void *) (__va_overflow(AP)); \ - __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \ - } \ - \ - __ptr; \ -})) -#else /* GCC29 */ -#define va_arg(AP,TYPE) \ -__extension__ (*({ \ - register TYPE *__ptr; \ - \ - if (__va_float_p (TYPE) && (AP)->fpr < 8) \ - { \ - __ptr = __VA_FP_REGSAVE (AP, TYPE); \ - (AP)->fpr++; \ - } \ - \ - else if (__va_aggregate_p (TYPE) && (AP)->gpr < 8) \ - { \ - __ptr = * __VA_GP_REGSAVE (AP, TYPE *); \ - (AP)->gpr++; \ - } \ - \ - else if (!__va_float_p (TYPE) && !__va_aggregate_p (TYPE) \ - && (AP)->gpr + __va_size(TYPE) <= 8 \ - && (!__va_longlong_p(TYPE) \ - || (AP)->gpr + __va_size(TYPE) <= 8)) \ - { \ - if (__va_longlong_p(TYPE) && ((AP)->gpr & 1) != 0) \ - (AP)->gpr++; \ - \ - __ptr = __VA_GP_REGSAVE (AP, TYPE); \ - (AP)->gpr += __va_size (TYPE); \ - } \ - \ - else if (!__va_float_p (TYPE) && !__va_aggregate_p (TYPE) \ - && (AP)->gpr < 8) \ - { \ - (AP)->gpr = 8; \ - __ptr = (TYPE *) (void *) (__va_overflow(AP)); \ - __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \ - } \ - \ - else if (__va_aggregate_p (TYPE)) \ - { \ - __ptr = * (TYPE **) (void *) (__va_overflow(AP)); \ - __va_overflow(AP) += sizeof (TYPE *); \ - } \ - else \ - { \ - __ptr = (TYPE *) (void *) (__va_overflow(AP)); \ - __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \ - } \ - \ - __ptr; \ -})) -#endif /* not GCC29 */ - -#define va_end(AP) ((void)0) - -/* Copy __gnuc_va_list into another variable of this type. */ -#define __va_copy(dest, src) *(dest) = *(src) - -#endif /* __VA_PPC_H__ */ -#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ - - -#else -/* Windows NT */ -/* Define __gnuc_va_list. */ - -#ifndef __GNUC_VA_LIST -#define __GNUC_VA_LIST -typedef char *__gnuc_va_list; -#endif /* not __GNUC_VA_LIST */ - -/* If this is for internal libc use, don't define anything but - __gnuc_va_list. */ -#if defined (_STDARG_H) || defined (_VARARGS_H) - -#define __va_start_common(AP, LASTARG, FAKE) \ - ((__builtin_saveregs ()), ((AP) = ((char *) &LASTARG) + __va_rounded_size (AP)), 0) - -#ifdef _STDARG_H /* stdarg.h support */ - -/* Calling __builtin_next_arg gives the proper error message if LASTARG is - not indeed the last argument. */ -#define va_start(AP,LASTARG) \ - (__builtin_saveregs (), \ - (AP) = __builtin_next_arg (LASTARG), \ - 0) - -#else /* varargs.h support */ - -#define va_start(AP) \ - (__builtin_saveregs (), \ - (AP) = __builtin_next_arg (__va_1st_arg) - sizeof (int), \ - 0) - -#define va_alist __va_1st_arg -#define va_dcl register int __va_1st_arg; ... - -#endif /* _STDARG_H */ - -#define __va_rounded_size(TYPE) ((sizeof (TYPE) + 3) & ~3) -#define __va_align(AP, TYPE) \ - ((((unsigned long)(AP)) + ((sizeof (TYPE) >= 8) ? 7 : 3)) \ - & ~((sizeof (TYPE) >= 8) ? 7 : 3)) - -#define va_arg(AP,TYPE) \ -( *(TYPE *)((AP = (char *) (__va_align(AP, TYPE) \ - + __va_rounded_size(TYPE))) \ - - __va_rounded_size(TYPE))) - -#define va_end(AP) ((void)0) - -/* Copy __gnuc_va_list into another variable of this type. */ -#define __va_copy(dest, src) (dest) = (src) - -#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ -#endif /* Windows NT */ +#include <powerpc/va-ppc.h> diff --git a/sys/arch/mvmeppc/include/varargs.h b/sys/arch/mvmeppc/include/varargs.h index 6490a1a2cdc..7c9459f0643 100644 --- a/sys/arch/mvmeppc/include/varargs.h +++ b/sys/arch/mvmeppc/include/varargs.h @@ -1,54 +1,3 @@ -/* $OpenBSD: varargs.h,v 1.2 2001/07/04 08:31:32 niklas Exp $ */ -/* $NetBSD: varargs.h,v 1.1 1996/09/30 16:34:37 ws Exp $ */ +/* $OpenBSD: varargs.h,v 1.3 2001/09/02 19:40:25 miod Exp $ */ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * 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. - * - * @(#)varargs.h 8.2 (Berkeley) 3/22/94 - */ - -#ifndef _PPC_VARARGS_H_ -#define _PPC_VARARGS_H_ - -#define _VARARGS_H - -#include <machine/ansi.h> -#include <machine/va-ppc.h> - -typedef _BSD_VA_LIST_ va_list; - -#endif /* !_PPC_VARARGS_H_ */ +#include <powerpc/varargs.h> diff --git a/sys/arch/mvmeppc/include/vmparam.h b/sys/arch/mvmeppc/include/vmparam.h index b269ab5bcd4..5b55db829be 100644 --- a/sys/arch/mvmeppc/include/vmparam.h +++ b/sys/arch/mvmeppc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.3 2001/07/04 08:31:33 niklas Exp $ */ +/* $OpenBSD: vmparam.h,v 1.4 2001/09/02 19:40:25 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.1 1996/09/30 16:34:38 ws Exp $ */ /*- @@ -36,7 +36,7 @@ #define MACHINE_VMPARAM_H #define USRTEXT PAGE_SIZE -#define USRSTACK VM_MAXUSER_ADDRESS +#define USRSTACK VM_MAX_ADDRESS #ifndef MAXTSIZ #define MAXTSIZ (16*1024*1024) /* max text size */ @@ -91,8 +91,8 @@ * Would like to have MAX addresses = 0, but this doesn't (currently) work */ #define VM_MIN_ADDRESS ((vm_offset_t)0) -#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xfffff000) -#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS +#define VM_MAX_ADDRESS ((vm_offset_t)0xfffff000) +#define VM_MAXUSER_ADDRESS VM_MAX_ADDRESS #define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)(KERNEL_SR << ADDR_SR_SHFT)) /* ppc_kvm_size is so that vm space can be stolen before vm is fully diff --git a/sys/arch/mvmeppc/include/vuid_event.h b/sys/arch/mvmeppc/include/vuid_event.h index 3ecbdcb7a3a..018c1502586 100644 --- a/sys/arch/mvmeppc/include/vuid_event.h +++ b/sys/arch/mvmeppc/include/vuid_event.h @@ -1,88 +1,3 @@ -/* $OpenBSD: vuid_event.h,v 1.1 2001/06/26 21:57:50 smurph Exp $ */ -/* $NetBSD: vuid_event.h,v 1.1 1996/04/12 01:45:47 cgd Exp $ */ +/* $OpenBSD: vuid_event.h,v 1.2 2001/09/02 19:40:25 miod 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. - * - * @(#)vuid_event.h 8.1 (Berkeley) 6/11/93 - */ - -/* - * The following is a minimal emulation of Sun's `Firm_event' structures - * and related operations necessary to make X11 happy (i.e., make it - * compile, and make old X11 binaries run). - */ -typedef struct firm_event { - u_short id; /* key or MS_* or LOC_[XY]_DELTA */ - u_short pad; /* unused, at least by X11 */ - int value; /* VKEY_{UP,DOWN} or locator delta */ - struct timeval time; -} Firm_event; - -/* - * Special `id' fields. These weird numbers simply match the old binaries. - * Others are in 0..0x7f and are keyboard key numbers (keyboard dependent!). - */ -#define MS_LEFT 0x7f20 /* left mouse button */ -#define MS_MIDDLE 0x7f21 /* middle mouse button */ -#define MS_RIGHT 0x7f22 /* right mouse button */ -#define LOC_X_DELTA 0x7f80 /* mouse delta-X */ -#define LOC_Y_DELTA 0x7f81 /* mouse delta-Y */ -#define LOC_X_ABSOLUTE 0x7f82 /* X compat, unsupported */ -#define LOC_Y_ABSOLUTE 0x7f83 /* X compat, unsupported */ - -/* - * Special `value' fields. These apply to keys and mouse buttons. The - * value of a mouse delta is the delta. Note that positive deltas are - * left and up (not left and down as you might expect). - */ -#define VKEY_UP 0 /* key or button went up */ -#define VKEY_DOWN 1 /* key or button went down */ - -/* - * The following ioctls are clearly intended to take things in and out - * of `firm event' mode. Since we always run in this mode (as far as - * /dev/kbd and /dev/mouse are concerned, anyway), we always claim to - * be in this mode and reject anything else. - */ -#define VUIDSFORMAT _IOW('v', 1, int) -#define VUIDGFORMAT _IOR('v', 2, int) -#define VUID_FIRM_EVENT 1 /* the only format we support */ +#include <powerpc/vuid_event.h> diff --git a/sys/arch/mvmeppc/include/wsconsio.h b/sys/arch/mvmeppc/include/wsconsio.h index 37ae8d06b5c..8800c567bec 100644 --- a/sys/arch/mvmeppc/include/wsconsio.h +++ b/sys/arch/mvmeppc/include/wsconsio.h @@ -1,62 +1,3 @@ -/* $OpenBSD: wsconsio.h,v 1.1 2001/06/26 21:57:50 smurph Exp $ */ -/* $NetBSD: wsconsio.h,v 1.1 1996/04/12 01:43:06 cgd Exp $ */ +/* $OpenBSD: wsconsio.h,v 1.2 2001/09/02 19:40:25 miod Exp $ */ -/* - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -/* - * Get keyboard type. Keyboard type definitions are below. - */ -#define WSCONSIO_KBD_GTYPE _IOR('W',100,int) -#define KBD_TYPE_LK201 0 /* lk-201 */ -#define KBD_TYPE_LK401 1 /* lk-401 */ -#define KBD_TYPE_PC 2 /* pc-like */ - -/* - * If arg is one, don't process scancodes into characters - */ -#define WSCONSIO_KBD_SCANCODES _IO('W',101,int) - -/* - * Bell ioctls. - */ - -struct wsconsio_bell_data { - int wbd_flags; - int wbd_pitch; /* pitch, in Hz. */ - int wbd_period; /* period, in milliseconds. */ - int wbd_volume; /* percentage of maximum volume. */ -}; - -#define WSCONSIO_BELLDATA_PITCH 0x01 /* pitch data present */ -#define WSCONSIO_BELLDATA_PERIOD 0x02 /* period data present */ -#define WSCONSIO_BELLDATA_VOLUME 0x04 /* volume data present */ - -#define WSCONSIO_BELL _IO('W',102) -#define WSCONSIO_COMPLEXBELL _IOW('W',103,struct wsconsio_bell_data) -#define WSCONSIO_SETBELL _IOW('W',104,struct wsconsio_bell_data) -#define WSCONSIO_GETBELL _IOR('W',105,struct wsconsio_bell_data) +#include <powerpc/wsconsio.h> diff --git a/sys/arch/mvmeppc/mvmeppc/Locore.c b/sys/arch/mvmeppc/mvmeppc/Locore.c deleted file mode 100644 index 9b77cd4d198..00000000000 --- a/sys/arch/mvmeppc/mvmeppc/Locore.c +++ /dev/null @@ -1,89 +0,0 @@ -/* $OpenBSD: Locore.c,v 1.1 2001/06/26 21:57:52 smurph 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. - */ - -/* - * Some additional routines that happened to be in locore.S traditionally, - * but have no need to be coded in assembly. - */ - -#include <sys/param.h> -#include <sys/proc.h> - -int whichqs; - -/* - * Put process p on the run queue, given by its priority. - * Calls should be made at splstatclock(), and p->p_stat should be SRUN. - */ -void -setrunqueue(p) - struct proc *p; -{ - struct prochd *q; - struct proc *oldlast; - int which = p->p_priority >> 2; - -#ifdef DIAGNOSTIC - if (p->p_back) - panic("setrunqueue"); -#endif - q = &qs[which]; - whichqs |= 0x80000000 >> which; - p->p_forw = (struct proc *)q; - p->p_back = oldlast = q->ph_rlink; - q->ph_rlink = p; - oldlast->p_forw = p; -} - -/* - * Remove process p from its run queue, given by its priority. - * Calls should be made at splstatclock(). - */ -void -remrunqueue(p) - struct proc *p; -{ - int which = p->p_priority >> 2; - struct prochd *q; - -#ifdef DIAGNOSTIC - if (!(whichqs & (0x80000000 >> which))) - panic("remrunqueue"); -#endif - p->p_forw->p_back = p->p_back; - p->p_back->p_forw = p->p_forw; - p->p_back = NULL; - q = &qs[which]; - if (q->ph_link == (struct proc *)q) - whichqs &= ~(0x80000000 >> which); -} diff --git a/sys/arch/mvmeppc/mvmeppc/bcopy.c b/sys/arch/mvmeppc/mvmeppc/bcopy.c deleted file mode 100644 index 25835d24b59..00000000000 --- a/sys/arch/mvmeppc/mvmeppc/bcopy.c +++ /dev/null @@ -1,144 +0,0 @@ -/* $OpenBSD: bcopy.c,v 1.1 2001/06/26 21:57:52 smurph Exp $ */ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -/*static char *sccsid = "from: @(#)bcopy.c 5.11 (Berkeley) 6/21/91";*/ -static char *rcsid = "$Id: bcopy.c,v 1.1 2001/06/26 21:57:52 smurph Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -/* -#include <string.h> -*/ -#include <sys/types.h> - -/* - * sizeof(word) MUST BE A POWER OF TWO - * SO THAT wmask BELOW IS ALL ONES - */ -typedef int word; /* "word" used for optimal copy speed */ - -#define wsize sizeof(word) -#define wmask (wsize - 1) - -/* - * Copy a block of memory, handling overlap. - * This is the routine that actually implements - * (the portable versions of) bcopy, memcpy, and memmove. - */ -#ifdef MEMCOPY -void * -memcpy(dst0, src0, length) -#else -#ifdef MEMMOVE -void * -memmove(dst0, src0, length) -#else -void -bcopy(src0, dst0, length) -#endif -#endif - void *dst0; - const void *src0; - register size_t length; -{ - register char *dst = dst0; - register const char *src = src0; - register size_t t; - - if (length == 0 || dst == src) /* nothing to do */ - goto done; - - /* - * Macros: loop-t-times; and loop-t-times, t>0 - */ -#define TLOOP(s) if (t) TLOOP1(s) -#define TLOOP1(s) do { s; } while (--t) - - if ((unsigned long)dst < (unsigned long)src) { - /* - * Copy forward. - */ - t = (int)src; /* only need low bits */ - if ((t | (int)dst) & wmask) { - /* - * Try to align operands. This cannot be done - * unless the low bits match. - */ - if ((t ^ (int)dst) & wmask || length < wsize) - t = length; - else - t = wsize - (t & wmask); - length -= t; - TLOOP1(*dst++ = *src++); - } - /* - * Copy whole words, then mop up any trailing bytes. - */ - t = length / wsize; - TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); - t = length & wmask; - TLOOP(*dst++ = *src++); - } else { - /* - * Copy backwards. Otherwise essentially the same. - * Alignment works as before, except that it takes - * (t&wmask) bytes to align, not wsize-(t&wmask). - */ - src += length; - dst += length; - t = (int)src; - if ((t | (int)dst) & wmask) { - if ((t ^ (int)dst) & wmask || length <= wsize) - t = length; - else - t &= wmask; - length -= t; - TLOOP1(*--dst = *--src); - } - t = length / wsize; - TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src); - t = length & wmask; - TLOOP(*--dst = *--src); - } -done: -#if defined(MEMCOPY) || defined(MEMMOVE) - return (dst0); -#else - return; -#endif -} diff --git a/sys/arch/mvmeppc/mvmeppc/in_cksum.c b/sys/arch/mvmeppc/mvmeppc/in_cksum.c deleted file mode 100644 index 2500b6b3a75..00000000000 --- a/sys/arch/mvmeppc/mvmeppc/in_cksum.c +++ /dev/null @@ -1,85 +0,0 @@ -/* $OpenBSD: in_cksum.c,v 1.1 2001/06/26 21:57:53 smurph Exp $ */ -/* $NetBSD: in_cksum.c,v 1.1 1996/09/30 16:34:47 ws 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. - */ -#include <sys/param.h> -#include <sys/mbuf.h> - -/* - * First cut for in_cksum. - * This code is in C and should be optimized for PPC later. - */ -#define REDUCE (sum = (sum & 0xffff) + (sum >> 16)) -#define ROL (sum = sum << 8) -#define ADDB (ROL, sum += *w, byte_swapped ^= 1) -#define ADDS (sum += *(u_short *)w) -#define SHIFT(n) (w += (n), mlen -= (n)) -#define ADDCARRY do { while (sum > 0xffff) REDUCE; } while (0) - -int -in_cksum(m, len) - struct mbuf *m; - int len; -{ - u_char *w; - u_int sum = 0; - int mlen; - int byte_swapped = 0; - - for (; m && len; m = m->m_next) { - if (m->m_len == 0) - continue; - w = mtod(m, u_char *); - mlen = m->m_len; - if (len < mlen) - mlen = len; - len -= mlen; - if ((long)w & 1) { - REDUCE; - ADDB; - SHIFT(1); - } - while (mlen >= 2) { - ADDS; - SHIFT(2); - } - REDUCE; - if (mlen == 1) - ADDB; - } - if (byte_swapped) { - REDUCE; - ROL; - } - ADDCARRY; - return sum ^ 0xffff; -} diff --git a/sys/arch/mvmeppc/mvmeppc/pmap.c b/sys/arch/mvmeppc/mvmeppc/pmap.c deleted file mode 100644 index ec0ca913c00..00000000000 --- a/sys/arch/mvmeppc/mvmeppc/pmap.c +++ /dev/null @@ -1,1672 +0,0 @@ -/* $OpenBSD: pmap.c,v 1.7 2001/08/06 21:00:14 miod Exp $ */ -/* $NetBSD: pmap.c,v 1.1 1996/09/30 16:34:52 ws 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. - */ -#include <sys/param.h> -#include <sys/malloc.h> -#include <sys/proc.h> -#include <sys/user.h> -#include <sys/queue.h> -#include <sys/systm.h> -#include <sys/pool.h> - -#include <vm/vm.h> -#include <vm/vm_kern.h> - -#include <uvm/uvm.h> - -#include <machine/pcb.h> -#include <machine/powerpc.h> - -pte_t *ptable; -int ptab_cnt; -u_int ptab_mask; -#define HTABSIZE (ptab_cnt * 64) - -struct pte_ovfl { - LIST_ENTRY(pte_ovfl) po_list; /* Linked list of overflow entries */ - struct pte po_pte; /* PTE for this mapping */ -}; - -LIST_HEAD(pte_ovtab, pte_ovfl) *potable; /* Overflow entries for ptable */ - -struct pmap kernel_pmap_; - -int physmem; -static int npgs; -static u_int nextavail; - -static struct mem_region *mem, *avail; - -#if 0 -void -dump_avail() -{ - int cnt; - struct mem_region *mp; - extern struct mem_region *avail; - - printf("memory %x\n", mem); - for (cnt = 0, mp = mem; mp->size; mp++) { - printf("memory region %x: start 0x%08x, size 0x%08x\n", - cnt, mp->start, mp->size); - cnt++; - } - printf("available %x\n", avail); - for (cnt = 0, mp = avail; mp->size; mp++) { - printf("avail region %x: start 0x%08x, size 0x%08x\n", - cnt, mp->start, mp->size); - cnt++; - } -} -#endif - - -/* virtual to physical map */ -static inline int -VP_SR(va) - paddr_t va; -{ - return (va >> VP_SR_POS) & VP_SR_MASK; -} -static inline int -VP_IDX1(va) - paddr_t va; -{ - return (va >> VP_IDX1_POS) & VP_IDX1_MASK; -} - -static inline int -VP_IDX2(va) - paddr_t va; -{ - return (va >> VP_IDX2_POS) & VP_SR_MASK; -} - -int -pmap_vp_valid(pm, va) - pmap_t pm; - vaddr_t va; -{ - pmapv_t *vp1; - vp1 = pm->vps[VP_SR(va)]; - if (vp1 != NULL) { - return (vp1[VP_IDX1(va)] & (1 << VP_IDX2(va))); - } - return 0; -} -int -pmap_vp_remove(pm, va) - pmap_t pm; - vaddr_t va; -{ - pmapv_t *vp1; - int s; - int retcode; - retcode = 0; - vp1 = pm->vps[VP_SR(va)]; -#ifdef DEBUG - printf("pmap_vp_remove: removing va %x pm %x", va, pm); -#endif - if (vp1 != NULL) { - s = splhigh(); - retcode = vp1[VP_IDX1(va)] & (1 << VP_IDX2(va)); - vp1[VP_IDX1(va)] &= ~(1 << VP_IDX2(va)); - splx(s); - } -#ifdef DEBUG - printf(" ret %x\n", retcode); -#endif - return retcode; -} -void -pmap_vp_enter(pm, va, pa) - pmap_t pm; - vaddr_t va; - paddr_t pa; -{ - pmapv_t *vp1; - pmapv_t *mem1; - int s; - int idx; - idx = VP_SR(va); - vp1 = pm->vps[idx]; -#ifdef DEBUG - printf("pmap_vp_enter: pm %x va %x vp1 %x idx %x ", pm, va, vp1, idx); -#endif - if (vp1 == NULL) { -#ifdef DEBUG - printf("l1 entry idx %x ", idx); -#endif - if (pm == pmap_kernel()) { - printf(" irk kernel allocating map?\n"); - } else { - if (!(mem1 = (pmapv_t *)uvm_km_zalloc(kernel_map, NBPG))) - panic("pmap_vp_enter: uvm_km_zalloc() failed"); - } - pm->vps[idx] = mem1; -#ifdef DEBUG - printf("got %x ", mem1); -#endif - vp1 = mem1; - } -#ifdef DEBUG - printf("l2 idx %x\n", VP_IDX2(va)); -#endif - - s = splhigh(); - vp1[VP_IDX1(va)] |= (1 << VP_IDX2(va)); - splx(s); - return; -} - -void -pmap_vp_destroy(pm) - pmap_t pm; -{ - pmapv_t *vp1; - int sr, idx1; - - for (sr = 0; sr < 32; sr++) { - vp1 = pm->vps[sr]; - if (vp1 == NULL) { - continue; - } -#ifdef SANITY - for(idx1 = 0; idx1 < 1024; idx1++) { - if (vp1[idx1] != 0) { - printf("mapped page at %x \n" - 0); /* XXX what page was this... */ - vp1[idx2] = 0; - - } - } -#endif - uvm_km_free(kernel_map, (vaddr_t)vp1, NBPG); - pm->vps[sr] = 0; - } -} -static int vp_page0[1024]; -static int vp_page1[1024]; -void -pmap_vp_preinit() -{ - pmap_t pm = pmap_kernel(); - /* magic addresses are 0xe0000000, 0xe8000000 */ - pm->vps[VP_SR(0xe0000000)] = vp_page0; - pm->vps[VP_SR(0xe8000000)] = vp_page1; -} - - -/* - * This is a cache of referenced/modified bits. - * Bits herein are shifted by ATTRSHFT. - */ -static char *pmap_attrib; -#define ATTRSHFT 4 - -struct pv_entry { - struct pv_entry *pv_next; /* Linked list of mappings */ - int pv_idx; /* Index into ptable */ - vm_offset_t pv_va; /* virtual address of mapping */ - struct pmap *pv_pmap; /* pmap associated with this map */ -}; - -struct pv_entry *pv_table; - -struct pool pmap_pv_pool; -static struct pv_entry *pmap_alloc_pv __P((void)); -static void pmap_free_pv __P((struct pv_entry *)); - -struct pool pmap_po_pool; -static struct pte_ovfl *poalloc __P((void)); -static void pofree __P((struct pte_ovfl *, int)); - -static u_int usedsr[NPMAPS / sizeof(u_int) / 8]; - -static int pmap_initialized; - -/* - * These small routines may have to be replaced, - * if/when we support processors other that the 604. - */ -static inline void -tlbie(ea) - caddr_t ea; -{ - asm volatile ("tlbie %0" :: "r"(ea)); -} - -static inline void -tlbsync() -{ - asm volatile ("sync; tlbsync; sync"); -} - -static void -tlbia() -{ - caddr_t i; - - asm volatile ("sync"); - for (i = 0; i < (caddr_t)0x00040000; i += 0x00001000) - tlbie(i); - tlbsync(); -} - -static inline int -ptesr(sr, addr) - sr_t *sr; - vm_offset_t addr; -{ - return sr[(u_int)addr >> ADDR_SR_SHFT]; -} - -static inline int -pteidx(sr, addr) - sr_t sr; - vm_offset_t addr; -{ - int hash; - - hash = (sr & SR_VSID) ^ (((u_int)addr & ADDR_PIDX) >> ADDR_PIDX_SHFT); - return hash & ptab_mask; -} - -static inline int -ptematch(ptp, sr, va, which) - pte_t *ptp; - sr_t sr; - vm_offset_t va; - int which; -{ - return ptp->pte_hi - == (((sr & SR_VSID) << PTE_VSID_SHFT) - | (((u_int)va >> ADDR_API_SHFT) & PTE_API) - | which); -} - -/* - * Try to insert page table entry *pt into the ptable at idx. - * - * Note: *pt mustn't have PTE_VALID set. - * This is done here as required by Book III, 4.12. - */ -static int -pte_insert(idx, pt) - int idx; - pte_t *pt; -{ - pte_t *ptp; - int i; - - /* - * First try primary hash. - */ - for (ptp = ptable + idx * 8, i = 8; --i >= 0; ptp++) - if (!(ptp->pte_hi & PTE_VALID)) { - *ptp = *pt; - ptp->pte_hi &= ~PTE_HID; - asm volatile ("sync"); - ptp->pte_hi |= PTE_VALID; - return 1; - } - idx ^= ptab_mask; - for (ptp = ptable + idx * 8, i = 8; --i >= 0; ptp++) - if (!(ptp->pte_hi & PTE_VALID)) { - *ptp = *pt; - ptp->pte_hi |= PTE_HID; - asm volatile ("sync"); - ptp->pte_hi |= PTE_VALID; - return 1; - } - return 0; -} - -/* - * Spill handler. - * - * Tries to spill a page table entry from the overflow area. - * Note that this routine runs in real mode on a separate stack, - * with interrupts disabled. - */ -int -pte_spill(addr) - vm_offset_t addr; -{ - int idx, i; - sr_t sr; - struct pte_ovfl *po; - pte_t ps; - pte_t *pt; - - asm ("mfsrin %0,%1" : "=r"(sr) : "r"(addr)); - idx = pteidx(sr, addr); - for (po = potable[idx].lh_first; po; po = po->po_list.le_next) - if (ptematch(&po->po_pte, sr, addr, 0)) { - /* - * Now found an entry to be spilled into the real ptable. - */ - if (pte_insert(idx, &po->po_pte)) { - LIST_REMOVE(po, po_list); - pofree(po, 0); - return 1; - } - /* - * Have to substitute some entry. Use the primary hash for this. - * - * Use low bits of timebase as random generator - */ - asm ("mftb %0" : "=r"(i)); - pt = ptable + idx * 8 + (i & 7); - pt->pte_hi &= ~PTE_VALID; - ps = *pt; - asm volatile ("sync"); - tlbie(addr); - tlbsync(); - *pt = po->po_pte; - asm volatile ("sync"); - pt->pte_hi |= PTE_VALID; - po->po_pte = ps; - if (ps.pte_hi & PTE_HID) { - /* - * We took an entry that was on the alternate hash - * chain, so move it to it's original chain. - */ - po->po_pte.pte_hi &= ~PTE_HID; - LIST_REMOVE(po, po_list); - LIST_INSERT_HEAD(potable + (idx ^ ptab_mask), - po, po_list); - } - return 1; - } - return 0; -} - -int avail_start; -int avail_end; -/* - * This is called during initppc, before the system is really initialized. - */ -void -pmap_bootstrap(kernelstart, kernelend) - u_int kernelstart, kernelend; -{ - struct mem_region *mp, *mp1; - int cnt, i; - u_int s, sz; - u_int addr; - - avail_start = kernelend; - /* - * Get memory. - */ - (fw->mem_regions)(&mem, &avail); - physmem = 0; - for (mp = mem; mp->size; mp++) { - physmem += btoc(mp->size); - } - - /* - * Count the number of available entries. - */ - for (cnt = 0, mp = avail; mp->size; mp++) - cnt++; - - /* - * Page align all regions. - * Non-page memory isn't very interesting to us. - * Also, sort the entries for ascending addresses. - */ - kernelstart &= ~PGOFSET; - kernelend = (kernelend + PGOFSET) & ~PGOFSET; - - /* make certain that each section is page aligned for base and size */ - for (mp = avail; mp->size; mp++) { - u_int32_t end; - s = mp->start - round_page(mp->start); - if (s != 0) { - mp->start = round_page(mp->start); - end = trunc_page(mp->size + mp->start); - mp->size = end - mp->start; - } - mp->size = trunc_page(mp->size); - } - for (mp = avail; mp->size; mp++) { - /* - * Check whether this region holds all of the kernel. - */ - s = mp->start + mp->size; - if (mp->start < kernelstart && s > kernelend) { - mp->start = kernelend; - mp->size = kernelstart - mp->start; - } - /* - * Look whether this regions starts within the kernel. - */ - if (mp->start >= kernelstart && mp->start < kernelend) { - s = kernelend - mp->start; - if (mp->size > s) - mp->size -= s; - else - mp->size = 0; - mp->start = kernelend; - } - /* - * Now look whether this region ends within the kernel. - */ - s = mp->start + mp->size; - if (s > kernelstart && s < kernelend) - mp->size -= s - kernelstart; - /* - * Now page align the start of the region. - */ - s = mp->start % NBPG; - if (mp->size >= s) { - mp->size -= s; - mp->start += s; - } - /* - * And now align the size of the region. - */ - mp->size -= mp->size % NBPG; - /* - * Check whether some memory is left here. - */ - if (mp->size == 0) { - bcopy(mp + 1, mp, - (cnt - (mp - avail)) * sizeof *mp); - cnt--; - mp--; - continue; - } - s = mp->start; - sz = mp->size; - npgs += btoc(sz); - for (mp1 = avail; mp1 < mp; mp1++) - if (s < mp1->start) - break; - if (mp1 < mp) { - bcopy(mp1, mp1 + 1, (void *)mp - (void *)mp1); - mp1->start = s; - mp1->size = sz; - } - } -#if 0 -avail_start = 0; -avail_end = npgs * NBPG; -#endif - -#ifdef HTABENTS - ptab_cnt = HTABENTS; -#else /* HTABENTS */ - ptab_cnt = 1024; - while ((HTABSIZE << 7) < ctob(physmem)) { - ptab_cnt <<= 1; - } -#endif /* HTABENTS */ - - /* - * Find suitably aligned memory for HTAB. - */ - for (mp = avail; mp->size; mp++) { - if (mp->start % HTABSIZE == 0) { - s = 0; - } else { - s = HTABSIZE - (mp->start % HTABSIZE) ; - } - if (mp->size < s + HTABSIZE) - continue; - ptable = (pte_t *)(mp->start + s); - if (mp->size == s + HTABSIZE) { - if (s) - mp->size = s; - else { - bcopy(mp + 1, mp, - (cnt - (mp - avail)) * sizeof *mp); - mp = avail; - } - break; - } -#if 0 - if (s != 0) { - printf("resizing avail\n"); - bcopy(mp, mp + 1, - (cnt - (mp - avail)) * sizeof *mp); - mp++->size = s; - } -#endif - mp->start += s + HTABSIZE; - mp->size -= s + HTABSIZE; - break; - } - if (!mp->size) - panic("not enough memory?"); - bzero((void *)ptable, HTABSIZE); - ptab_mask = ptab_cnt - 1; - - /* - * We cannot do vm_bootstrap_steal_memory here, - * since we don't run with translation enabled yet. - */ - s = sizeof(struct pte_ovtab) * ptab_cnt; - sz = round_page(s); - for (mp = avail; mp->size; mp++) - if (mp->size >= sz) - break; - if (!mp->size) - panic("not enough memory?"); - potable = (struct pte_ovtab *)mp->start; - mp->size -= sz; - mp->start += sz; - if (mp->size == 0) - bcopy(mp + 1, mp, (cnt - (mp - avail)) * sizeof *mp); - for (i = 0; i < ptab_cnt; i++) - LIST_INIT(potable + i); - - /* use only one memory list */ - { - u_int32_t size; - struct mem_region *curmp; - size = 0; - curmp = NULL; - for (mp = avail; mp->size; mp++) { - if (mp->size > size) { - size = mp->size; - curmp=mp; - } - } - mp = avail; - if (curmp == mp) { - ++mp; - mp->size = 0; /* lose the rest of memory */ - } else { - *mp = *curmp; - ++mp; - mp->size = 0; /* lose the rest of memory */ - } - } - - for (mp = avail; mp->size; mp++) { - uvm_page_physload(atop(mp->start), atop(mp->start + mp->size), - atop(mp->start), atop(mp->start + mp->size), - VM_FREELIST_DEFAULT); - } - - /* - * Initialize kernel pmap and hardware. - */ -#if NPMAPS >= KERNEL_SEGMENT / 16 - usedsr[KERNEL_SEGMENT / 16 / (sizeof usedsr[0] * 8)] - |= 1 << ((KERNEL_SEGMENT / 16) % (sizeof usedsr[0] * 8)); -#endif - for (i = 0; i < 16; i++) { - pmap_kernel()->pm_sr[i] = EMPTY_SEGMENT; - asm volatile ("mtsrin %0,%1" - :: "r"(EMPTY_SEGMENT), "r"(i << ADDR_SR_SHFT) ); - } - pmap_kernel()->pm_sr[KERNEL_SR] = KERNEL_SEGMENT; - asm volatile ("mtsr %0,%1" - :: "n"(KERNEL_SR), "r"(KERNEL_SEGMENT)); - asm volatile ("sync; mtsdr1 %0; isync" - :: "r"((u_int)ptable | (ptab_mask >> 10))); - tlbia(); - pmap_vp_preinit(); - nextavail = avail->start; -} - -/* - * Restrict given range to physical memory - */ -void -pmap_real_memory(start, size) - vm_offset_t *start; - vm_size_t *size; -{ - struct mem_region *mp; - - for (mp = mem; mp->size; mp++) { - if (*start + *size > mp->start - && *start < mp->start + mp->size) { - if (*start < mp->start) { - *size -= mp->start - *start; - *start = mp->start; - } - if (*start + *size > mp->start + mp->size) - *size = mp->start + mp->size - *start; - return; - } - } - *size = 0; -} - -/* - * Initialize anything else for pmap handling. - * Called during vm_init(). - */ -void -pmap_init() -{ - struct pv_entry *pv; - vsize_t sz; - vaddr_t addr; - int i, s; - int bank; - char *attr; - - sz = (vm_size_t)((sizeof(struct pv_entry) + 1) * npgs); - sz = round_page(sz); - addr = uvm_km_zalloc(kernel_map, sz); - s = splimp(); - pv = pv_table = (struct pv_entry *)addr; - for (i = npgs; --i >= 0;) - pv++->pv_idx = -1; - pool_init(&pmap_pv_pool, sizeof(struct pv_entry), 0, 0, 0, "pvpl", - 0, NULL, NULL, M_VMPMAP); - pool_init(&pmap_po_pool, sizeof(struct pte_ovfl), 0, 0, 0, "popl", - 0, NULL, NULL, M_VMPMAP); - pmap_attrib = (char *)pv; - bzero(pv, npgs); - pv = pv_table; - attr = pmap_attrib; - for (bank = 0; bank < vm_nphysseg; bank++) { - sz = vm_physmem[bank].end - vm_physmem[bank].start; - vm_physmem[bank].pmseg.pvent = pv; - vm_physmem[bank].pmseg.attrs = attr; - pv += sz; - attr += sz; - } - pmap_initialized = 1; - splx(s); -} - -/* - * Return the index of the given page in terms of pmap_next_page() calls. - */ -int -pmap_page_index(pa) - vm_offset_t pa; -{ - struct mem_region *mp; - vm_size_t pre; - - pa &= ~PGOFSET; - for (pre = 0, mp = avail; mp->size; mp++) { - if (pa >= mp->start - && pa < mp->start + mp->size) - return btoc(pre + (pa - mp->start)); - pre += mp->size; - } - return -1; -} - -static __inline struct pv_entry * -pmap_find_pv(paddr_t pa) -{ - int bank, off; - - bank = vm_physseg_find(atop(pa), &off); - if (bank != -1) { - return &vm_physmem[bank].pmseg.pvent[off]; - } - return NULL; -} -static __inline char * -pmap_find_attr(paddr_t pa) -{ - int bank, off; - - bank = vm_physseg_find(atop(pa), &off); - if (bank != -1) { - return &vm_physmem[bank].pmseg.attrs[off]; - } - return NULL; -} - -vm_offset_t ppc_kvm_size = VM_KERN_ADDR_SIZE_DEF; - -/* - * How much virtual space is available to the kernel? - */ -void -pmap_virtual_space(start, end) - vm_offset_t *start, *end; -{ - /* - * Reserve one segment for kernel virtual memory - */ - *start = (vm_offset_t)(KERNEL_SR << ADDR_SR_SHFT); - *end = *start + VM_KERN_ADDRESS_SIZE; -} - -/* - * Return the number of possible page indices returned - * from pmap_page_index for any page provided by pmap_next_page. - */ -u_int -pmap_free_pages() -{ - return npgs; -} - -/* - * If there are still physical pages available, put the address of - * the next available one at paddr and return TRUE. Otherwise, - * return FALSE to indicate that there are no more free pages. - */ -int -pmap_next_page(paddr) - vm_offset_t *paddr; -{ - static int lastidx = -1; - - if (lastidx == -1) { - nextavail = avail->start; - } - if (lastidx < 0 - || nextavail >= avail[lastidx].start + avail[lastidx].size) { - if (avail[++lastidx].size == 0) - return FALSE; - nextavail = avail[lastidx].start; - } - *paddr = nextavail; - nextavail += NBPG; - return TRUE; -} - -/* - * Create and return a physical map. - */ -struct pmap * -pmap_create() -{ - struct pmap *pm; - - pm = (struct pmap *)malloc(sizeof *pm, M_VMPMAP, M_WAITOK); - bzero((caddr_t)pm, sizeof *pm); - pmap_pinit(pm); - return pm; -} - -/* - * Initialize a preallocated and zeroed pmap structure. - */ -void -pmap_pinit(pm) - struct pmap *pm; -{ - int i, j, k; - int s, seg; - - /* - * Allocate some segment registers for this pmap. - */ - s = splimp(); - pm->pm_refs = 1; - for (i = 0; i < sizeof usedsr / sizeof usedsr[0]; i++) - if (usedsr[i] != 0xffffffff) { - j = ffs(~usedsr[i]) - 1; - usedsr[i] |= 1 << j; - seg = (i * sizeof usedsr[0] * 8 + j) * 16; - for (k = 0; k < 16; k++) - pm->pm_sr[k] = seg + k; - splx(s); - return; - } - splx(s); - panic("out of segments"); -} - -/* - * Add a reference to the given pmap. - */ -void -pmap_reference(pm) - struct pmap *pm; -{ - pm->pm_refs++; -} - -/* - * Retire the given pmap from service. - * Should only be called if the map contains no valid mappings. - */ -void -pmap_destroy(pm) - struct pmap *pm; -{ - if (--pm->pm_refs == 0) { - pmap_release(pm); - free((caddr_t)pm, M_VMPMAP); - } -} - -/* - * Release any resources held by the given physical map. - * Called when a pmap initialized by pmap_pinit is being released. - */ -void -pmap_release(pm) - struct pmap *pm; -{ - int i, j; - int s; - - pmap_vp_destroy(pm); - if (!pm->pm_sr[0]) - panic("pmap_release"); - i = pm->pm_sr[0] / 16; - j = i % (sizeof usedsr[0] * 8); - i /= sizeof usedsr[0] * 8; - s = splimp(); - usedsr[i] &= ~(1 << j); - splx(s); -} - -/* - * Copy the range specified by src_addr/len - * from the source map to the range dst_addr/len - * in the destination map. - * - * This routine is only advisory and need not do anything. - */ -void -pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr) - struct pmap *dst_pmap, *src_pmap; - vm_offset_t dst_addr, src_addr; - vm_size_t len; -{ -} - -/* - * Require that all active physical maps contain no - * incorrect entries NOW. - */ -void -pmap_update() -{ -} - -/* - * Garbage collects the physical map system for - * pages which are no longer used. - * Success need not be guaranteed -- that is, there - * may well be pages which are not referenced, but - * others may be collected. - * Called by the pageout daemon when pages are scarce. - */ -void -pmap_collect(pm) - struct pmap *pm; -{ -} - -/* - * Fill the given physical page with zeroes. - */ -void -pmap_zero_page(pa) - vm_offset_t pa; -{ -#ifdef SDEBUG - int s = splimp(); -#endif -#if 0 - bzero((caddr_t)pa, NBPG); -#else - int i; - - for (i = NBPG/CACHELINESIZE; i > 0; i--) { -#ifdef SDEBUG - printf("pmap_zero_page() pa = %p\n", pa); -#endif - __asm __volatile ("dcbz 0,%0" :: "r"(pa)); - pa += CACHELINESIZE; - } -#endif -#ifdef SDEBUG - splx(s); - printf("pmap_zero_page() done.\n"); -#endif -} - -/* - * Copy the given physical source page to its destination. - */ -void -pmap_copy_page(src, dst) - vm_offset_t src, dst; -{ - bcopy((caddr_t)src, (caddr_t)dst, NBPG); -} - -static struct pv_entry * -pmap_alloc_pv() -{ - struct pv_entry *pv; - int s; - - /* - * XXX - this splimp can go away once we have PMAP_NEW and - * a correct implementation of pmap_kenter. - */ - /* - * Note that it's completly ok to use a pool here because it will - * never map anything or call pmap_enter because we have - * PMAP_MAP_POOLPAGE. - */ - s = splimp(); - pv = pool_get(&pmap_pv_pool, PR_NOWAIT); - splx(s); - /* - * XXX - some day we might want to implement pv stealing, or - * to pass down flags from pmap_enter about allowed failure. - * Right now - just panic. - */ - if (pv == NULL) - panic("pmap_alloc_pv: failed to allocate pv"); - - return pv; -} - -static void -pmap_free_pv(pv) - struct pv_entry *pv; -{ - int s; - - /* XXX - see pmap_alloc_pv */ - s = splimp(); - pool_put(&pmap_pv_pool, pv); - splx(s); -} - -/* - * We really hope that we don't need overflow entries - * before the VM system is initialized! XXX - * XXX - see pmap_alloc_pv - */ -static struct pte_ovfl * -poalloc() -{ - struct pte_ovfl *po; - int s; - -#ifdef DIAGNOSTIC - if (!pmap_initialized) - panic("poalloc"); -#endif - s = splimp(); - po = pool_get(&pmap_po_pool, PR_NOWAIT); - splx(s); - if (po == NULL) - panic("poalloc: failed to alloc po"); - return po; -} - -static void -pofree(po, freepage) - struct pte_ovfl *po; - int freepage; -{ - int s; - s = splimp(); - pool_put(&pmap_po_pool, po); - splx(s); -} - -/* - * This returns whether this is the first mapping of a page. - */ -static inline int -pmap_enter_pv(pm, pteidx, va, pa) - struct pmap *pm; - int pteidx; - vm_offset_t va; - vm_offset_t pa; -{ - struct pv_entry *npv; - int s, first; - struct pv_entry *pv; - - if (!pmap_initialized) - return 0; - - pv = pmap_find_pv( pa ); - if (pv == NULL) - return 0; - - s = splimp(); - - if (first = pv->pv_idx == -1) { - /* - * No entries yet, use header as the first entry. - */ - pv->pv_va = va; - pv->pv_idx = pteidx; - pv->pv_pmap = pm; - pv->pv_next = NULL; - } else { - /* - * There is at least one other VA mapping this page. - * Place this entry after the header. - */ - npv = pmap_alloc_pv(); - npv->pv_va = va; - npv->pv_idx = pteidx; - npv->pv_pmap = pm; - npv->pv_next = pv->pv_next; - pv->pv_next = npv; - } - splx(s); - return first; -} - -static void -pmap_remove_pv(pm, pteidx, va, pte_lo) - struct pmap *pm; - int pteidx; - vm_offset_t va; - u_int32_t pte_lo; -{ - struct pv_entry *pv, *npv; - - int bank, pg; - vm_offset_t pa; - char *attr; - - pa = pte_lo & ~PGOFSET; - - bank = vm_physseg_find(atop(pa), &pg); - if (bank == -1) - return; - pv = &vm_physmem[bank].pmseg.pvent[pg]; - attr = &vm_physmem[bank].pmseg.attrs[pg]; - - /* - * First transfer reference/change bits to cache. - */ - *attr |= (pte_lo & (PTE_REF | PTE_CHG)) >> ATTRSHFT; - - /* - * Remove from the PV table. - * - * If it is the first entry on the list, it is actually - * in the header and we must copy the following entry up - * to the header. Otherwise we must search the list for - * the entry. In either case we free the now unused entry. - */ - if (va == pv->pv_va && pm == pv->pv_pmap) { - npv = pv->pv_next; - if (npv) { - *pv = *npv; - pmap_free_pv(npv); - } else { - pv->pv_pmap = 0; - pv->pv_idx = -1; - } - } else { - for (; npv = pv->pv_next; pv = npv) { - if (va == npv->pv_va && pm == npv->pv_pmap) - { - break; - } - } - if (npv) { - pv->pv_next = npv->pv_next; - pmap_free_pv(npv); - } -#if 1 -#ifdef DIAGNOSTIC - else { - printf("pmap_remove_pv: not on list\n"); - /* - panic("pmap_remove_pv: not on list"); - */ - } -#endif -#endif - } -} - -/* - * Insert physical page at pa into the given pmap at virtual address va. - */ -int -pmap_enter(pm, va, pa, prot, flags) - struct pmap *pm; - vm_offset_t va, pa; - vm_prot_t prot; - int flags; -{ - sr_t sr; - int idx, i, s; - pte_t pte; - struct pte_ovfl *po; - struct mem_region *mp; - - /* - * Have to remove any existing mapping first. - */ - pmap_remove(pm, va, va + NBPG-1); - - pm->pm_stats.resident_count++; - - pmap_vp_enter(pm, va, pa); - - /* - * Compute the HTAB index. - */ - sr = ptesr(pm->pm_sr, va); - idx = pteidx(sr, va); - /* - * Construct the PTE. - * - * Note: Don't set the valid bit for correct operation of tlb update. - */ - pte.pte_hi = ((sr & SR_VSID) << PTE_VSID_SHFT) - | ((va & ADDR_PIDX) >> ADDR_API_SHFT); - pte.pte_lo = (pa & PTE_RPGN) | PTE_M | PTE_I | PTE_G; - for (mp = mem; mp->size; mp++) { - if (pa >= mp->start && pa < mp->start + mp->size) { - pte.pte_lo &= ~(PTE_I | PTE_G); - break; - } - } - if (prot & VM_PROT_WRITE) - pte.pte_lo |= PTE_RW; - else - pte.pte_lo |= PTE_RO; - - /* - * Now record mapping for later back-translation. - */ - if (pmap_enter_pv(pm, idx, va, pa)) { - /* - * Flush the real memory from the cache. - */ - syncicache((void *)pa, NBPG); - } - - s = splimp(); - /* - * Try to insert directly into HTAB. - */ - if (pte_insert(idx, &pte)) { - splx(s); - return (KERN_SUCCESS); - } - - /* - * Have to allocate overflow entry. - * - * Note, that we must use real addresses for these. - */ - po = poalloc(); - po->po_pte = pte; - LIST_INSERT_HEAD(potable + idx, po, po_list); - splx(s); - - return (KERN_SUCCESS); -} - -void -pmap_kenter_pa(va, pa, prot) - vaddr_t va; - paddr_t pa; - vm_prot_t prot; -{ - pmap_enter(pmap_kernel(), va, pa, prot, PMAP_WIRED); -} - -void -pmap_kenter_pgs(va, pgs, npgs) - vaddr_t va; - struct vm_page **pgs; - int npgs; -{ - int i; - - for (i = 0; i < npgs; i++, va += PAGE_SIZE) { - pmap_enter(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]), - VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); - } -} - -void -pmap_kremove(va, len) - vaddr_t va; - vsize_t len; -{ - for (len >>= PAGE_SHIFT; len > 0; len--, va += PAGE_SIZE) { - pmap_remove(pmap_kernel(), va, va + PAGE_SIZE); - } -} - - -/* - * Remove the given range of mapping entries. - */ -void -pmap_remove(pm, va, endva) - struct pmap *pm; - vm_offset_t va, endva; -{ - int idx, i, s; - int found; /* if found, we are done, only one mapping per va */ - sr_t sr; - pte_t *ptp; - struct pte_ovfl *po, *npo; - struct pv_entry *pv; - - s = splimp(); - for (; va < endva; va += NBPG) { - if (0 == pmap_vp_remove(pm, va)) { - /* no mapping */ - continue; - } - found = 0; - sr = ptesr(pm->pm_sr, va); - idx = pteidx(sr, va); - for (ptp = ptable + idx * 8, i = 8; --i >= 0; ptp++) - if (ptematch(ptp, sr, va, PTE_VALID)) { - ptp->pte_hi &= ~PTE_VALID; - asm volatile ("sync"); - tlbie(va); - tlbsync(); - pmap_remove_pv(pm, idx, va, ptp->pte_lo); - pm->pm_stats.resident_count--; - found = 1; - break; - } - if (found) { - continue; - } - for (ptp = ptable + (idx ^ ptab_mask) * 8, i = 8; --i >= 0; ptp++) - if (ptematch(ptp, sr, va, PTE_VALID | PTE_HID)) { - ptp->pte_hi &= ~PTE_VALID; - asm volatile ("sync"); - tlbie(va); - tlbsync(); - pmap_remove_pv(pm, idx, va, ptp->pte_lo); - pm->pm_stats.resident_count--; - found = 1; - break; - } - if (found) { - continue; - } - for (po = potable[idx].lh_first; po; po = npo) { - npo = po->po_list.le_next; - if (ptematch(&po->po_pte, sr, va, 0)) { - pmap_remove_pv(pm, idx, va, po->po_pte.pte_lo); - LIST_REMOVE(po, po_list); - pofree(po, 1); - pm->pm_stats.resident_count--; - break; - } - } - } - splx(s); -} - -static pte_t * -pte_find(pm, va) - struct pmap *pm; - vm_offset_t va; -{ - int idx, i; - sr_t sr; - pte_t *ptp; - struct pte_ovfl *po; - - sr = ptesr(pm->pm_sr, va); - idx = pteidx(sr, va); - for (ptp = ptable + idx * 8, i = 8; --i >= 0; ptp++) - if (ptematch(ptp, sr, va, PTE_VALID)) - return ptp; - for (ptp = ptable + (idx ^ ptab_mask) * 8, i = 8; --i >= 0; ptp++) - if (ptematch(ptp, sr, va, PTE_VALID | PTE_HID)) - return ptp; - for (po = potable[idx].lh_first; po; po = po->po_list.le_next) - if (ptematch(&po->po_pte, sr, va, 0)) - return &po->po_pte; - return 0; -} - -/* - * Get the physical page address for the given pmap/virtual address. - */ -boolean_t -pmap_extract(pm, va, pap) - struct pmap *pm; - vaddr_t va; - paddr_t *pap; -{ - pte_t *ptp; - int s = splimp(); - - if (!(ptp = pte_find(pm, va))) { - splx(s); - return (FALSE); - } - *pap = (ptp->pte_lo & PTE_RPGN) | (va & ADDR_POFF); - splx(s); - return (TRUE); -} - -/* - * Lower the protection on the specified range of this pmap. - * - * There are only two cases: either the protection is going to 0, - * or it is going to read-only. - */ -void -pmap_protect(pm, sva, eva, prot) - struct pmap *pm; - vm_offset_t sva, eva; - vm_prot_t prot; -{ - pte_t *ptp; - int valid, s; - - if (prot & VM_PROT_READ) { - s = splimp(); - while (sva < eva) { - if (ptp = pte_find(pm, sva)) { - valid = ptp->pte_hi & PTE_VALID; - ptp->pte_hi &= ~PTE_VALID; - asm volatile ("sync"); - tlbie(sva); - tlbsync(); - ptp->pte_lo &= ~PTE_PP; - ptp->pte_lo |= PTE_RO; - asm volatile ("sync"); - ptp->pte_hi |= valid; - } - sva += NBPG; - } - splx(s); - return; - } - pmap_remove(pm, sva, eva); -} - -boolean_t -ptemodify(pa, mask, val) - paddr_t pa; - u_int mask; - u_int val; -{ - struct pv_entry *pv; - pte_t *ptp; - struct pte_ovfl *po; - int i, s; - char * pattr; - boolean_t ret; - - ret = ptebits(pa, mask); - - pv = pmap_find_pv(pa); - if (pv == NULL) - return (ret); - pattr = pmap_find_attr(pa); - - /* - * First modify bits in cache. - */ - *pattr &= ~mask >> ATTRSHFT; - *pattr |= val >> ATTRSHFT; - - if (pv->pv_idx < 0) - return (ret); - - s = splimp(); - for (; pv; pv = pv->pv_next) { - for (ptp = ptable + pv->pv_idx * 8, i = 8; --i >= 0; ptp++) - if ((ptp->pte_hi & PTE_VALID) - && (ptp->pte_lo & PTE_RPGN) == pa) { - ptp->pte_hi &= ~PTE_VALID; - asm volatile ("sync"); - tlbie(pv->pv_va); - tlbsync(); - ptp->pte_lo &= ~mask; - ptp->pte_lo |= val; - asm volatile ("sync"); - ptp->pte_hi |= PTE_VALID; - } - for (ptp = ptable + (pv->pv_idx ^ ptab_mask) * 8, i = 8; --i >= 0; ptp++) - if ((ptp->pte_hi & PTE_VALID) - && (ptp->pte_lo & PTE_RPGN) == pa) { - ptp->pte_hi &= ~PTE_VALID; - asm volatile ("sync"); - tlbie(pv->pv_va); - tlbsync(); - ptp->pte_lo &= ~mask; - ptp->pte_lo |= val; - asm volatile ("sync"); - ptp->pte_hi |= PTE_VALID; - } - for (po = potable[pv->pv_idx].lh_first; po; po = po->po_list.le_next) - if ((po->po_pte.pte_lo & PTE_RPGN) == pa) { - po->po_pte.pte_lo &= ~mask; - po->po_pte.pte_lo |= val; - } - } - splx(s); - - return (ret); -} - -int -ptebits(pa, bit) - vm_offset_t pa; - int bit; -{ - struct pv_entry *pv; - pte_t *ptp; - struct pte_ovfl *po; - int i, s, bits = 0; - char *pattr; - - pv = pmap_find_pv(pa); - if (pv == NULL) - return 0; - pattr = pmap_find_attr(pa); - - /* - * First try the cache. - */ - bits |= ((*pattr) << ATTRSHFT) & bit; - if (bits == bit) - return bits; - - if (pv->pv_idx < 0) - return 0; - - s = splimp(); - for (; pv; pv = pv->pv_next) { - for (ptp = ptable + pv->pv_idx * 8, i = 8; --i >= 0; ptp++) - if ((ptp->pte_hi & PTE_VALID) - && (ptp->pte_lo & PTE_RPGN) == pa) { - bits |= ptp->pte_lo & bit; - if (bits == bit) { - splx(s); - return bits; - } - } - for (ptp = ptable + (pv->pv_idx ^ ptab_mask) * 8, i = 8; --i >= 0; ptp++) - if ((ptp->pte_hi & PTE_VALID) - && (ptp->pte_lo & PTE_RPGN) == pa) { - bits |= ptp->pte_lo & bit; - if (bits == bit) { - splx(s); - return bits; - } - } - for (po = potable[pv->pv_idx].lh_first; po; po = po->po_list.le_next) - if ((po->po_pte.pte_lo & PTE_RPGN) == pa) { - bits |= po->po_pte.pte_lo & bit; - if (bits == bit) { - splx(s); - return bits; - } - } - } - splx(s); - return bits; -} - -/* - * Lower the protection on the specified physical page. - * - * There are only two cases: either the protection is going to 0, - * or it is going to read-only. - */ -void -pmap_page_protect(pg, prot) - struct vm_page *pg; - vm_prot_t prot; -{ - vm_offset_t pa = VM_PAGE_TO_PHYS(pg); - vm_offset_t va; - pte_t *ptp; - struct pte_ovfl *po, *npo; - int i, s, pind, idx; - struct pmap *pm; - struct pv_entry *pv; - - pa &= ~ADDR_POFF; - if (prot & VM_PROT_READ) { - ptemodify(pg, PTE_PP, PTE_RO); - return; - } - - pv = pmap_find_pv(pa); - if (pv == NULL) - return; - - s = splimp(); - while (pv->pv_idx != -1) { - va = pv->pv_va; - pm = pv->pv_pmap; - if ((va >=uvm.pager_sva) && (va < uvm.pager_eva)) { - continue; - } - pmap_remove(pm, va, va + NBPG); - } - splx(s); -} -/* - * this code to manipulate the BAT tables was added here - * because it is closely related to the vm system. - * --dsr - */ - -#include <machine/bat.h> - -/* one major problem of mapping IO with bats, is that it - * is not possible to use caching on any level of granularity - * that is reasonable. - * This is just enhancing an existing design (that should be - * replaced in my opinion). - * - * Current design only allow mapping of 256 MB block. (normally 1-1) - * but not necessarily (in the case of PCI io at 0xf0000000 where - * it might be desireable to map it elsewhere because that is - * where the stack is?) - */ -void -addbatmap(u_int32_t vaddr, u_int32_t raddr, u_int32_t wimg) -{ - u_int32_t segment; - segment = vaddr >> (32 - 4); - battable[segment].batu = BATU(vaddr); - battable[segment].batl = BATL(raddr, wimg); -} - -/* ??? */ -void -pmap_activate(struct proc *p) -{ -#if 0 - struct pcb *pcb = &p->p_addr->u_pcb; - pmap_t pmap = p->p_vmspace->vm_map.pmap; - - /* - * XXX Normally performed in cpu_fork(); - */ - if (pcb->pcb_pm != pmap) { - pcb->pcb_pm = pmap; - (void) pmap_extract(pmap_kernel(), (vaddr_t)pcb->pcb_pm, - (paddr_t *)&pcb->pcb_pmreal); - } - curpcb=pcb; - if (p == curproc) { - /* Disable interrupts while switching. */ - __asm __volatile("mfmsr %0" : "=r"(psl) :); - psl &= ~PSL_EE; - __asm __volatile("mtmsr %0" :: "r"(psl)); - - /* Store pointer to new current pmap. */ - curpm = pcb->pcb_pmreal; - - /* Save kernel SR. */ - __asm __volatile("mfsr %0,14" : "=r"(ksr) :); - - /* - * Set new segment registers. We use the pmap's real - * address to avoid accessibility problems. - */ - rpm = pcb->pcb_pmreal; - for (i = 0; i < 16; i++) { - seg = rpm->pm_sr[i]; - __asm __volatile("mtsrin %0,%1" - :: "r"(seg), "r"(i << ADDR_SR_SHFT)); - } - - /* Restore kernel SR. */ - __asm __volatile("mtsr 14,%0" :: "r"(ksr)); - - /* Interrupts are OK again. */ - psl |= PSL_EE; - __asm __volatile("mtmsr %0" :: "r"(psl)); - } -#endif - return; -} -/* ??? */ -void -pmap_deactivate(struct proc *p) -{ - return; -} diff --git a/sys/arch/mvmeppc/mvmeppc/process_machdep.c b/sys/arch/mvmeppc/mvmeppc/process_machdep.c deleted file mode 100644 index 8cf911b8236..00000000000 --- a/sys/arch/mvmeppc/mvmeppc/process_machdep.c +++ /dev/null @@ -1,107 +0,0 @@ -/* $OpenBSD: process_machdep.c,v 1.1 2001/06/26 21:57:55 smurph Exp $ */ -/* $NetBSD: process_machdep.c,v 1.1 1996/09/30 16:34:53 ws 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. - */ -#include <sys/param.h> -#include <sys/proc.h> -#include <machine/reg.h> - -/* - * Set the process's program counter. - */ -int -process_set_pc(p, addr) - struct proc *p; - caddr_t addr; -{ - struct trapframe *tf = trapframe(p); - - tf->srr0 = (int)addr; - return 0; -} - -int -process_sstep(p, sstep) - struct proc *p; - int sstep; -{ - struct trapframe *tf = trapframe(p); - - if (sstep) - tf->srr1 |= PSL_SE; - else - tf->srr1 &= ~PSL_SE; - return 0; -} -int -process_read_regs(p, regs) - struct proc *p; - struct reg *regs; -{ - struct trapframe *tf = trapframe(p); - - bcopy(&(tf->fixreg[0]), &(regs->gpr[0]), sizeof(regs->gpr)); - bzero(&(regs->fpr[0]), sizeof(regs->fpr)); - /* - * need to do floating point here - */ - regs->pc = tf->srr0; - regs->ps = tf->srr1; /* is this the correct value for this ? */ - regs->cnd = tf->cr; - regs->lr = tf->lr; - regs->cnt = tf->ctr; - regs->xer = tf->xer; - regs->mq = 0; /* what should this really be? */ - - return (0); -} -int -process_write_regs(p, regs) - struct proc *p; - struct reg *regs; -{ - struct trapframe *tf = trapframe(p); - - bcopy(&(regs->gpr[0]), &(tf->fixreg[0]), sizeof(regs->gpr)); - /* - * need to do floating point here - */ - tf->srr0 = regs->pc; - tf->srr1 = regs->ps; /* is this the correct value for this ? */ - tf->cr = regs->cnd; - tf->lr = regs->lr; - tf->ctr = regs->cnt; - tf->xer = regs->xer; - /* regs->mq = 0; what should this really be? */ - - return (0); -} diff --git a/sys/arch/mvmeppc/mvmeppc/sys_machdep.c b/sys/arch/mvmeppc/mvmeppc/sys_machdep.c deleted file mode 100644 index 3afbcf27fb5..00000000000 --- a/sys/arch/mvmeppc/mvmeppc/sys_machdep.c +++ /dev/null @@ -1,47 +0,0 @@ -/* $OpenBSD: sys_machdep.c,v 1.1 2001/06/26 21:57:55 smurph Exp $ */ -/* $NetBSD: sys_machdep.c,v 1.1 1996/09/30 16:34:56 ws Exp $ */ - -/* - * Copyright (C) 1996 Wolfgang Solfrank. - * Copyright (C) 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. - */ - -#include <sys/param.h> - -int -sys_sysarch(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - /* - * Currently no special system calls - */ - return EINVAL; -} diff --git a/sys/arch/mvmeppc/mvmeppc/trap.c b/sys/arch/mvmeppc/mvmeppc/trap.c deleted file mode 100644 index bbfb99325b6..00000000000 --- a/sys/arch/mvmeppc/mvmeppc/trap.c +++ /dev/null @@ -1,630 +0,0 @@ -/* $OpenBSD: trap.c,v 1.3 2001/07/06 05:14:30 smurph Exp $ */ -/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos 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. - */ -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/signalvar.h> -#include <sys/reboot.h> -#include <sys/syscall.h> -#include <sys/systm.h> -#include <sys/user.h> -#include <sys/ktrace.h> - -#include <vm/vm.h> -#include <vm/vm_kern.h> - -#include <uvm/uvm_extern.h> - -#include <machine/cpu.h> -#include <machine/frame.h> -#include <machine/pcb.h> -#include <machine/pmap.h> -#include <machine/psl.h> -#include <machine/trap.h> -#include <machine/db_machdep.h> - -static int fix_unaligned __P((struct proc *p, struct trapframe *frame)); - -/* These definitions should probably be somewhere else XXX */ -#define FIRSTARG 3 /* first argument is in reg 3 */ -#define NARGREG 8 /* 8 args are in registers */ -#define MOREARGS(sp) ((caddr_t)((int)(sp) + 8)) /* more args go here */ - -volatile int want_resched; - -#ifdef DDB -u_int32_t db_dumpframe(u_int32_t); -void -ppc_dumpbt(struct trapframe *frame) -{ - u_int32_t addr; - /* dumpframe is defined in db_trace.c */ - addr=frame->fixreg[1]; - while (addr != 0) { - addr = db_dumpframe(addr); - } - return; -} -#endif -void -trap(frame) - struct trapframe *frame; -{ - struct proc *p = curproc; - int type = frame->exc; - u_quad_t sticks; - union sigval sv; - - if (frame->srr1 & PSL_PR) { - type |= EXC_USER; - sticks = p->p_sticks; - } - - switch (type) { - case EXC_TRC|EXC_USER: - { - sv.sival_int = frame->srr0; - trapsignal(p, SIGTRAP, type, TRAP_TRACE, sv); - } - break; - - case EXC_MCHK: - { - faultbuf *fb; - - if (fb = p->p_addr->u_pcb.pcb_onfault) { - p->p_addr->u_pcb.pcb_onfault = 0; - frame->srr0 = fb->pc; /* PC */ - frame->srr1 = fb->sr; /* SR */ - frame->fixreg[1] = fb->sp; /* SP */ - frame->fixreg[3] = 1; /* != 0 */ - frame->cr = fb->cr; - bcopy(&fb->regs[0], &frame->fixreg[13], 19*4); - return; - } - } - goto brain_damage; - - case EXC_DSI: - { - vm_map_t map; - vm_offset_t va; - int ftype; - faultbuf *fb; - - map = kernel_map; - va = frame->dar; - if ((va >> ADDR_SR_SHFT) == USER_SR) { - sr_t user_sr; - - asm ("mfsr %0, %1" - : "=r"(user_sr) : "K"(USER_SR)); - va &= ADDR_PIDX | ADDR_POFF; - va |= user_sr << ADDR_SR_SHFT; - map = &p->p_vmspace->vm_map; - } - if (frame->dsisr & DSISR_STORE) - ftype = VM_PROT_READ | VM_PROT_WRITE; - else - ftype = VM_PROT_READ; - if (uvm_fault(map, trunc_page(va), 0, ftype) - == KERN_SUCCESS) - { - return; - } - if (fb = p->p_addr->u_pcb.pcb_onfault) { - p->p_addr->u_pcb.pcb_onfault = 0; - frame->srr0 = fb->pc; /* PC */ - frame->fixreg[1] = fb->sp; /* SP */ - frame->fixreg[3] = 1; /* != 0 */ - frame->cr = fb->cr; - bcopy(&fb->regs[0], &frame->fixreg[13], 19*4); - return; - } - map = kernel_map; - } - printf("kern dsi on addr %x iar %x\n", frame->dar, frame->srr0); - goto brain_damage; - case EXC_DSI|EXC_USER: - { - int ftype, vftype; - - if (frame->dsisr & DSISR_STORE) { - ftype = VM_PROT_READ | VM_PROT_WRITE; - vftype = VM_PROT_WRITE; - } else - vftype = ftype = VM_PROT_READ; - if (uvm_fault(&p->p_vmspace->vm_map, - trunc_page(frame->dar), 0, ftype) - == KERN_SUCCESS) { - break; - } -#if 0 - printf("dsi on addr %x iar %x lr %x\n", frame->dar, frame->srr0,frame->lr); -#endif -/* - * keep this for later in case we want it later. -*/ - sv.sival_int = frame->dar; - trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, sv); - } - break; - case EXC_ISI|EXC_USER: - { - int ftype; - - ftype = VM_PROT_READ | VM_PROT_EXECUTE; - if (uvm_fault(&p->p_vmspace->vm_map, - trunc_page(frame->srr0), 0, ftype) - == KERN_SUCCESS) { - break; - } - } -#if 0 -printf("isi iar %x\n", frame->srr0); -#endif - case EXC_MCHK|EXC_USER: -/* XXX Likely that returning from this trap is bogus... */ -/* XXX Have to make sure that sigreturn does the right thing. */ - sv.sival_int = frame->srr0; - trapsignal(p, SIGSEGV, VM_PROT_EXECUTE, SEGV_MAPERR, sv); - break; - case EXC_SC|EXC_USER: - { - struct sysent *callp; - size_t argsize; - register_t code, error; - register_t *params, rval[2]; - int nsys, n; - register_t args[10]; - - uvmexp.syscalls++; - - nsys = p->p_emul->e_nsysent; - callp = p->p_emul->e_sysent; - - code = frame->fixreg[0]; - params = frame->fixreg + FIRSTARG; - - switch (code) { - case SYS_syscall: - /* - * code is first argument, - * followed by actual args. - */ - code = *params++; - break; - case SYS___syscall: - /* - * Like syscall, but code is a quad, - * so as to maintain quad alignment - * for the rest of the args. - */ - if (callp != sysent) - break; - params++; - code = *params++; - break; - default: - break; - } - if (code < 0 || code >= nsys) - callp += p->p_emul->e_nosys; - else - callp += code; - argsize = callp->sy_argsize; - n = NARGREG - (params - (frame->fixreg + FIRSTARG)); - if (argsize > n * sizeof(register_t)) { - bcopy(params, args, n * sizeof(register_t)); - if (error = copyin(MOREARGS(frame->fixreg[1]), - args + n, - argsize - n * sizeof(register_t))) { -#ifdef KTRACE - /* Can't get all the arguments! */ - if (KTRPOINT(p, KTR_SYSCALL)) - ktrsyscall(p, code, - argsize, args); -#endif - goto syscall_bad; - } - params = args; - } -#ifdef KTRACE - if (KTRPOINT(p, KTR_SYSCALL)) - ktrsyscall(p, code, argsize, params); -#endif - rval[0] = 0; - rval[1] = frame->fixreg[FIRSTARG + 1]; - -#ifdef SYSCALL_DEBUG - scdebug_call(p, code, params); -#endif - - - switch (error = (*callp->sy_call)(p, params, rval)) { - case 0: - frame->fixreg[0] = error; - frame->fixreg[FIRSTARG] = rval[0]; - frame->fixreg[FIRSTARG + 1] = rval[1]; - frame->cr &= ~0x10000000; - break; - case ERESTART: - /* - * Set user's pc back to redo the system call. - */ - frame->srr0 -= 4; - break; - case EJUSTRETURN: - /* nothing to do */ - break; - default: -syscall_bad: - if (p->p_emul->e_errno) - error = p->p_emul->e_errno[error]; - frame->fixreg[0] = error; - frame->fixreg[FIRSTARG] = error; - frame->fixreg[FIRSTARG + 1] = rval[1]; - frame->cr |= 0x10000000; - break; - } -#ifdef SYSCALL_DEBUG - scdebug_ret(p, code, error, rval); -#endif -#ifdef KTRACE - if (KTRPOINT(p, KTR_SYSRET)) - ktrsysret(p, code, error, rval[0]); -#endif - } - break; - - case EXC_FPU|EXC_USER: - if (fpuproc) - save_fpu(fpuproc); - fpuproc = p; - enable_fpu(p); - break; - - case EXC_ALI: - if (EXC_ALI_OPCODE_INDICATOR(frame->dsisr) == EXC_ALI_DCBZ) { - bzero((void*)frame->dar, CACHELINESIZE); - frame->srr0 += 4; - } else - goto brain_damage; - break; - - case EXC_ALI|EXC_USER: - /* alignment exception - * we check to see if this can be fixed up - * by the code that fixes the typical gcc misaligned code - * then kill the process if not. - */ - if (fix_unaligned(p, frame) == 0) { - frame->srr0 += 4; - } else { - sv.sival_int = frame->srr0; - trapsignal(p, SIGSEGV, VM_PROT_EXECUTE, SEGV_MAPERR, - sv); - } - break; - - default: - -brain_damage: -/* -mpc_print_pci_stat(); -*/ - -#ifdef DDB - /* set up registers */ - db_save_regs(frame); -#endif - panic ("trap type %x at %x lr %x\n", - type, frame->srr0, frame->lr); - - - case EXC_PGM|EXC_USER: - { - char *errstr[8]; - int errnum = 0; - - if (frame->srr1 & (1<<(31-11))) { - /* floating point enabled program exception */ - errstr[errnum] = "floating point"; - errnum++; - } - if (frame->srr1 & (1<<(31-12))) { - /* illegal instruction program exception */ - errstr[errnum] = "illegal instruction"; - errnum++; - } - if (frame->srr1 & (1<<(31-13))) { - /* privileged instruction exception */ - errstr[errnum] = "priviledged instr"; - errnum++; - } - if (frame->srr1 & (1<<(31-14))) { - errstr[errnum] = "trap instr"; - errnum++; - /* trap instruction exception */ - /* - instr = copyin (srr0) - if (instr == BKPT_INST && uid == 0) { - db_trap(T_BREAKPOINT?) - break; - } - */ - } - if (frame->srr1 & (1<<(31-15))) { - errstr[errnum] = "previous address"; - errnum++; - } -#if 0 -printf("pgm iar %x srr1 %x\n", frame->srr0, frame->srr1); -for (i = 0; i < errnum; i++) { - printf("\t[%s]\n", errstr[i]); -} -#endif - sv.sival_int = frame->srr0; - trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); - break; - case EXC_PGM: - /* should check for correct byte here or panic */ -#ifdef DDB - db_save_regs(frame); - db_trap(T_BREAKPOINT); -#else - panic("trap EXC_PGM"); -#endif - break; - - } - case EXC_AST|EXC_USER: - /* This is just here that we trap */ - break; - } - - astpending = 0; /* we are about to do it */ - - uvmexp.softs++; - - if (p->p_flag & P_OWEUPC) { - p->p_flag &= ~P_OWEUPC; - ADDUPROF(p); - } - - /* take pending signals */ - { - int sig; - - while (sig = CURSIG(p)) - postsig(sig); - } - - p->p_priority = p->p_usrpri; - if (want_resched) { - int s, sig; - - /* - * Since we are curproc, a clock interrupt could - * change our priority without changing run queues - * (the running process is not kept on a run queue). - * If this happened after we setrunqueue ourselves but - * before switch()'ed, we might not be on the queue - * indicated by our priority. - */ - s = splstatclock(); - setrunqueue(p); - p->p_stats->p_ru.ru_nivcsw++; - mi_switch(); - splx(s); - while (sig = CURSIG(p)) - postsig(sig); - } - - /* - * If profiling, charge recent system time to the trapped pc. - */ - if (p->p_flag & P_PROFIL) { - extern int psratio; - - addupc_task(p, frame->srr0, - (int)(p->p_sticks - sticks) * psratio); - } - /* - * If someone stole the fpu while we were away, disable it - */ - if (p != fpuproc) - frame->srr1 &= ~PSL_FP; - curpriority = p->p_priority; -} - -void -child_return(p) - struct proc *p; -{ - struct trapframe *tf = trapframe(p); - - tf->fixreg[0] = 0; - tf->fixreg[FIRSTARG] = 0; - tf->fixreg[FIRSTARG + 1] = 1; - tf->cr &= ~0x10000000; - tf->srr1 &= ~PSL_FP; /* Disable FPU, as we can't be fpuproc */ -#ifdef KTRACE - if (KTRPOINT(p, KTR_SYSRET)) - ktrsysret(p, SYS_fork, 0, 0); -#endif - /* Profiling? XXX */ - curpriority = p->p_priority; -} - -static inline void -setusr(content) - int content; -{ - asm volatile ("isync; mtsr %0,%1; isync" - :: "n"(USER_SR), "r"(content)); -} - -int -badaddr(addr, len) - char *addr; - u_int32_t len; -{ - faultbuf env; - u_int32_t v; - - if (setfault(env)) { - curpcb->pcb_onfault = 0; - return EFAULT; - } - switch(len) { - case 4: - v = *((volatile u_int32_t *)addr); - break; - case 2: - v = *((volatile u_int16_t *)addr); - break; - default: - v = *((volatile u_int8_t *)addr); - break; - } - curpcb->pcb_onfault = 0; - return(0); -} - -int -copyin(udaddr, kaddr, len) - const void *udaddr; - void *kaddr; - size_t len; -{ - void *p; - size_t l; - faultbuf env; - - if (setfault(env)) { - curpcb->pcb_onfault = 0; - return EFAULT; - } - while (len > 0) { - p = USER_ADDR + ((u_int)udaddr & ~SEGMENT_MASK); - l = (USER_ADDR + SEGMENT_LENGTH) - p; - if (l > len) - l = len; - setusr(curpcb->pcb_pm->pm_sr[(u_int)udaddr >> ADDR_SR_SHFT]); - bcopy(p, kaddr, l); - udaddr += l; - kaddr += l; - len -= l; - } - curpcb->pcb_onfault = 0; - return 0; -} - -int -copyout(kaddr, udaddr, len) - const void *kaddr; - void *udaddr; - size_t len; -{ - void *p; - size_t l; - faultbuf env; - - if (setfault(env)) { - curpcb->pcb_onfault = 0; - return EFAULT; - } - while (len > 0) { - p = USER_ADDR + ((u_int)udaddr & ~SEGMENT_MASK); - l = (USER_ADDR + SEGMENT_LENGTH) - p; - if (l > len) - l = len; - setusr(curpcb->pcb_pm->pm_sr[(u_int)udaddr >> ADDR_SR_SHFT]); - bcopy(kaddr, p, l); - udaddr += l; - kaddr += l; - len -= l; - } - curpcb->pcb_onfault = 0; - return 0; -} - -/* - * For now, this only deals with the particular unaligned access case - * that gcc tends to generate. Eventually it should handle all of the - * possibilities that can happen on a 32-bit PowerPC in big-endian mode. - */ - -static int -fix_unaligned(p, frame) - struct proc *p; - struct trapframe *frame; -{ - int indicator = EXC_ALI_OPCODE_INDICATOR(frame->dsisr); - - switch (indicator) { - case EXC_ALI_LFD: - case EXC_ALI_STFD: - { - int reg = EXC_ALI_RST(frame->dsisr); - double *fpr = &p->p_addr->u_pcb.pcb_fpu.fpr[reg]; - - /* Juggle the FPU to ensure that we've initialized - * the FPRs, and that their current state is in - * the PCB. - */ - if (fpuproc != p) { - if (fpuproc) - save_fpu(fpuproc); - enable_fpu(p); - } - save_fpu(p); - - if (indicator == EXC_ALI_LFD) { - if (copyin((void *)frame->dar, fpr, - sizeof(double)) != 0) - return -1; - enable_fpu(p); - } else { - if (copyout(fpr, (void *)frame->dar, - sizeof(double)) != 0) - return -1; - } - return 0; - } - break; - } - - return -1; -} diff --git a/sys/arch/mvmeppc/mvmeppc/vm_machdep.c b/sys/arch/mvmeppc/mvmeppc/vm_machdep.c deleted file mode 100644 index 50029fd5375..00000000000 --- a/sys/arch/mvmeppc/mvmeppc/vm_machdep.c +++ /dev/null @@ -1,275 +0,0 @@ -/* $OpenBSD: vm_machdep.c,v 1.3 2001/07/25 13:25:32 art Exp $ */ -/* $NetBSD: vm_machdep.c,v 1.1 1996/09/30 16:34:57 ws 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. - */ -#include <sys/param.h> -#include <sys/core.h> -#include <sys/exec.h> -#include <sys/proc.h> -#include <sys/signalvar.h> -#include <sys/user.h> -#include <sys/vnode.h> - -#include <vm/vm.h> -#include <vm/vm_kern.h> - -#include <uvm/uvm_extern.h> - -#include <machine/pcb.h> - -/* - * Finish a fork operation, with process p2 nearly set up. - */ -void -cpu_fork(p1, p2, stack, stacksize) - struct proc *p1, *p2; - void *stack; - size_t stacksize; -{ - struct trapframe *tf; - struct callframe *cf; - struct switchframe *sf; - caddr_t stktop1, stktop2; - extern void fork_trampoline __P((void)); - extern void child_return __P((struct proc *)); - struct pcb *pcb = &p2->p_addr->u_pcb; - - if (p1 == fpuproc) - save_fpu(p1); - *pcb = p1->p_addr->u_pcb; - - pcb->pcb_pm = p2->p_vmspace->vm_map.pmap; - - pmap_extract(pmap_kernel(), - (vm_offset_t)pcb->pcb_pm, (paddr_t *)&pcb->pcb_pmreal); - - /* - * Setup the trap frame for the new process - */ - stktop1 = (caddr_t)trapframe(p1); - stktop2 = (caddr_t)trapframe(p2); - bcopy(stktop1, stktop2, sizeof(struct trapframe)); - - /* - * If specified, give the child a different stack. - */ - if (stack != NULL) - tf->fixreg[1] = (register_t)stack + stacksize; - - stktop2 = (caddr_t)((u_long)stktop2 & ~15); /* Align stack pointer */ - - /* - * There happens to be a callframe, too. - */ - cf = (struct callframe *)stktop2; - cf->lr = (int)fork_trampoline; - - /* - * Below the trap frame, there is another call frame: - */ - stktop2 -= 16; - cf = (struct callframe *)stktop2; - cf->r31 = (register_t)child_return; - cf->r30 = (register_t)p2; - - /* - * Below that, we allocate the switch frame: - */ - stktop2 -= roundup(sizeof *sf, 16); /* must match SFRAMELEN in genassym */ - sf = (struct switchframe *)stktop2; - bzero((void *)sf, sizeof *sf); /* just in case */ - sf->sp = (int)cf; - sf->user_sr = pmap_kernel()->pm_sr[USER_SR]; /* again, just in case */ - pcb->pcb_sp = (int)stktop2; - pcb->pcb_spl = 0; -} - -/* - * Set initial pc of process forked by above. - */ -void -cpu_set_kpc(p, pc, arg) - struct proc *p; - void (*pc) __P((void *)); - void *arg; -{ - struct switchframe *sf = (struct switchframe *)p->p_addr->u_pcb.pcb_sp; - struct callframe *cf = (struct callframe *)sf->sp; - - cf->r30 = (register_t)arg; - cf->r31 = (register_t)pc; - cf++->lr = (register_t)pc; -} - -void -cpu_swapin(p) - struct proc *p; -{ - struct pcb *pcb = &p->p_addr->u_pcb; - - pmap_extract(pmap_kernel(), - (vm_offset_t)pcb->pcb_pm, (paddr_t *)pcb->pcb_pmreal); -} - -/* - * Move pages from one kernel virtual address to another. - */ -void -pagemove(from, to, size) - caddr_t from, to; - size_t size; -{ - vaddr_t va; - paddr_t pa; - - for (va = (vm_offset_t)from; size > 0; size -= NBPG) { - pmap_extract(pmap_kernel(), va, &pa); - pmap_remove(pmap_kernel(), va, va + NBPG); - pmap_enter(pmap_kernel(), (vm_offset_t)to, pa, - VM_PROT_READ | VM_PROT_WRITE, - VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); - va += NBPG; - to += NBPG; - } -} - -/* - * cpu_exit is called as the last action during exit. - * We release the address space and machine-dependent resources, - * including the memory for the user structure and kernel stack. - * - * Since we don't have curproc anymore, we cannot sleep, and therefor - * this is at least incorrect for the multiprocessor version. - * Not sure whether we can get away with this in the single proc version. XXX - */ -void -cpu_exit(p) - struct proc *p; -{ - if (p == fpuproc) /* release the fpu */ - fpuproc = 0; - - (void)splhigh(); - switchexit(p); -} - -/* - * Write the machine-dependent part of a core dump. - */ -int -cpu_coredump(p, vp, cred, chdr) - struct proc *p; - struct vnode *vp; - struct ucred *cred; - struct core *chdr; -{ - struct coreseg cseg; - struct md_coredump md_core; - struct trapframe *tf; - int error; - -#if 1 - CORE_SETMAGIC(*chdr, COREMAGIC, MID_ZERO, 0); - chdr->c_hdrsize = ALIGN(sizeof *chdr); - chdr->c_seghdrsize = ALIGN(sizeof cseg); - chdr->c_cpusize = sizeof md_core; - - process_read_regs(p, &md_core); - - CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_ZERO, CORE_CPU); - cseg.c_addr = 0; - cseg.c_size = chdr->c_cpusize; - - if (error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize, - (off_t)chdr->c_hdrsize, UIO_SYSSPACE, - IO_NODELOCKED|IO_UNIT, cred, NULL, p)) - return error; - if (error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&md_core, sizeof md_core, - (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE, - IO_NODELOCKED|IO_UNIT, cred, NULL, p)) - return error; - - chdr->c_nseg++; -#endif - return 0; -} - -/* - * Map an IO request into kernel virtual address space. - */ -void -vmapbuf(bp, len) - struct buf *bp; - vm_size_t len; -{ - vm_offset_t faddr, taddr, off; - vm_offset_t pa; - -#ifdef DIAGNOSTIC - if (!(bp->b_flags & B_PHYS)) - panic("vmapbuf"); -#endif - faddr = trunc_page((vaddr_t)(bp->b_saveaddr = bp->b_data)); - off = (vm_offset_t)bp->b_data - faddr; - len = round_page(off + len); - taddr = uvm_km_valloc_wait(phys_map, len); - bp->b_data = (caddr_t)(taddr + off); - for (; len > 0; len -= NBPG) { - pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map), faddr, &pa); - pmap_enter(vm_map_pmap(phys_map), taddr, pa, - VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED); - faddr += NBPG; - taddr += NBPG; - } -} - -/* - * Free the io map addresses associated with this IO operation. - */ -void -vunmapbuf(bp, len) - struct buf *bp; - vm_size_t len; -{ - vm_offset_t addr, off; - -#ifdef DIAGNOSTIC - if (!(bp->b_flags & B_PHYS)) - panic("vunmapbuf"); -#endif - addr = trunc_page((vaddr_t)bp->b_data); - off = (vm_offset_t)bp->b_data - addr; - len = round_page(off + len); - uvm_km_free_wakeup(phys_map, addr, len); - bp->b_data = bp->b_saveaddr; - bp->b_saveaddr = 0; -} |