summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale S. Rahn <rahnds@cvs.openbsd.org>1996-12-28 06:09:33 +0000
committerDale S. Rahn <rahnds@cvs.openbsd.org>1996-12-28 06:09:33 +0000
commit64b3ce59bcd0839f7d76e38d308f8e1ca29dcffc (patch)
tree3dbd07d1df74f0ab56be3d79cd8dc9ccd2551486
parent1709f310d1c13c7d5bb9ade080f1009c782bc9d7 (diff)
Changes necessary to make the kernel compile and boot.
Some merging with NetBSD port.
-rw-r--r--sys/arch/powerpc/compile/.cvsignore4
-rw-r--r--sys/arch/powerpc/compile/.keep_me3
-rw-r--r--sys/arch/powerpc/conf/DDB70
-rw-r--r--sys/arch/powerpc/conf/files.powerpc10
-rw-r--r--sys/arch/powerpc/include/ansi.h4
-rw-r--r--sys/arch/powerpc/include/asm.h1
-rw-r--r--sys/arch/powerpc/include/db_machdep.h130
-rw-r--r--sys/arch/powerpc/include/endian.h8
-rw-r--r--sys/arch/powerpc/include/ptrace.h48
-rw-r--r--sys/arch/powerpc/include/types.h5
-rw-r--r--sys/arch/powerpc/powerpc/Locore.c6
-rw-r--r--sys/arch/powerpc/powerpc/trap.c7
-rw-r--r--sys/arch/powerpc/stand/ofdev.h3
13 files changed, 280 insertions, 19 deletions
diff --git a/sys/arch/powerpc/compile/.cvsignore b/sys/arch/powerpc/compile/.cvsignore
new file mode 100644
index 00000000000..c60645c1115
--- /dev/null
+++ b/sys/arch/powerpc/compile/.cvsignore
@@ -0,0 +1,4 @@
+GENERIC
+NFS
+TST
+DDB
diff --git a/sys/arch/powerpc/compile/.keep_me b/sys/arch/powerpc/compile/.keep_me
new file mode 100644
index 00000000000..f899121e3eb
--- /dev/null
+++ b/sys/arch/powerpc/compile/.keep_me
@@ -0,0 +1,3 @@
+$NetBSD: .keep_me,v 1.2 1994/10/26 02:32:30 cgd Exp $
+
+This normally empty directory needs to be kept in the distribution.
diff --git a/sys/arch/powerpc/conf/DDB b/sys/arch/powerpc/conf/DDB
new file mode 100644
index 00000000000..6e6c03ce70b
--- /dev/null
+++ b/sys/arch/powerpc/conf/DDB
@@ -0,0 +1,70 @@
+#
+# First try for PPC GENERIC config file
+#
+
+machine powerpc
+
+maxusers 32
+
+# Standard system options (should go into std.powerpc?)
+options SWAPPAGER, VNODEPAGER, DEVPAGER
+options MACHINE_NONCONTIG
+options EXEC_ELF
+options EXEC_SCRIPT
+
+# various hacks due to bugs in Openfirmware implementation
+options FIREPOWERBUGS
+
+#options IPKDBUSERHACK
+#makeoptions DEBUG="-g"
+
+options DDB
+options KTRACE
+options SYSCALL_DEBUG
+options TCP_COMPAT_42
+options COMPAT_43
+options COMPAT_09
+options COMPAT_10
+options COMPAT_12
+
+options FFS
+options MFS
+
+options NFSCLIENT
+options NFSSERVER
+
+options CD9660
+options MSDOSFS
+options FDESC
+options FIFO
+options KERNFS
+options NULLFS
+options PORTAL
+options PROCFS
+options UMAPFS
+options UNION
+
+options INET
+options NMBCLUSTERS=1024
+
+options MAXUSERS=20
+#options TARGET_ELF
+
+config netbsd swap generic
+
+ofroot* at root
+
+ofbus* at openfirm?
+
+ofdisk* at openfirm?
+
+ofnet* at openfirm?
+#ipkdbif0 at ofnet?
+
+ofcons* at openfirm?
+
+ofrtc* at openfirm?
+
+pseudo-device loop
+pseudo-device pty 64
+pseudo-device random 1
diff --git a/sys/arch/powerpc/conf/files.powerpc b/sys/arch/powerpc/conf/files.powerpc
index d39c334d57e..55e0e95de36 100644
--- a/sys/arch/powerpc/conf/files.powerpc
+++ b/sys/arch/powerpc/conf/files.powerpc
@@ -39,11 +39,11 @@ file arch/powerpc/powerpc/trap.c
file arch/powerpc/powerpc/vm_machdep.c
file dev/cons.c
file dev/cninit.c
-file arch/ppc/ppc/setjmp.S ddb
-file arch/ppc/ppc/db_memrw.c ddb
-file arch/ppc/ppc/db_disasm.c ddb
-file arch/ppc/ppc/db_interface.c ddb
-file arch/ppc/ppc/db_trace.c ddb
+file arch/powerpc/powerpc/setjmp.S ddb
+file arch/powerpc/powerpc/db_memrw.c ddb
+file arch/powerpc/powerpc/db_disasm.c ddb
+file arch/powerpc/powerpc/db_interface.c ddb
+file arch/powerpc/powerpc/db_trace.c ddb
# FirePower specific code
#device firepower: openfirm
diff --git a/sys/arch/powerpc/include/ansi.h b/sys/arch/powerpc/include/ansi.h
index 403bc133c6c..6c871a419cf 100644
--- a/sys/arch/powerpc/include/ansi.h
+++ b/sys/arch/powerpc/include/ansi.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ansi.h,v 1.1 1996/09/30 16:34:19 ws Exp $ */
+/* $NetBSD: ansi.h,v 1.2 1996/11/15 22:38:57 jtc Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -54,6 +54,8 @@
#define _BSD_TIME_T_ long /* time() */
struct __gnuc_va_list__;
#define _BSD_VA_LIST_ struct __gnuc_va_list__ * /* 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
diff --git a/sys/arch/powerpc/include/asm.h b/sys/arch/powerpc/include/asm.h
index 36f110da136..5d38fb5fc5c 100644
--- a/sys/arch/powerpc/include/asm.h
+++ b/sys/arch/powerpc/include/asm.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: asm.h,v 1.2 1996/12/28 06:09:16 rahnds Exp $ */
/* $NetBSD: asm.h,v 1.1 1996/09/30 16:34:20 ws Exp $ */
/*
diff --git a/sys/arch/powerpc/include/db_machdep.h b/sys/arch/powerpc/include/db_machdep.h
new file mode 100644
index 00000000000..da7ae99fab6
--- /dev/null
+++ b/sys/arch/powerpc/include/db_machdep.h
@@ -0,0 +1,130 @@
+/* $OpenBSD: db_machdep.h,v 1.1 1996/12/28 06:09:17 rahnds Exp $ */
+/* $NetBSD: db_machdep.h,v 1.13 1996/04/29 20:50:08 leo Exp $ */
+
+/*
+ * Mach Operating System
+ * Copyright (c) 1992 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * 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 Mellon
+ * the rights to redistribute these changes.
+ */
+
+/*
+ * Machine-dependent defines for new kernel debugger.
+ */
+#ifndef _PPC_DB_MACHDEP_H_
+#define _PPC_DB_MACHDEP_H_
+
+#include <vm/vm_prot.h>
+#include <vm/vm_param.h>
+#include <vm/vm_inherit.h>
+#include <vm/lock.h>
+#include <machine/trap.h>
+
+typedef vm_offset_t db_addr_t; /* address - unsigned */
+typedef int db_expr_t; /* expression - signed */
+struct powerpc_saved_state {
+ u_int32_t r0; /* data registers */
+ u_int32_t r1;
+ u_int32_t r2;
+ u_int32_t r3;
+ u_int32_t r4;
+ u_int32_t r5;
+ u_int32_t r6;
+ u_int32_t r7;
+ u_int32_t r8;
+ u_int32_t r9;
+ u_int32_t r10;
+ u_int32_t r11;
+ u_int32_t r12;
+ u_int32_t r13;
+ u_int32_t r14;
+ u_int32_t r15;
+ u_int32_t r16;
+ u_int32_t r17;
+ u_int32_t r18;
+ u_int32_t r19;
+ u_int32_t r20;
+ u_int32_t r21;
+ u_int32_t r22;
+ u_int32_t r23;
+ u_int32_t r24;
+ u_int32_t r25;
+ u_int32_t r26;
+ u_int32_t r27;
+ u_int32_t r28;
+ u_int32_t r29;
+ u_int32_t r30;
+ u_int32_t r31;
+ u_int32_t r32;
+ u_int32_t iar;
+ u_int32_t msr;
+};
+typedef struct powerpc_saved_state db_regs_t;
+db_regs_t ddb_regs; /* register state */
+#define DDB_REGS (&ddb_regs)
+
+#define PC_REGS(regs) ((db_addr_t)(regs)->iar)
+
+#define BKPT_INST 0x7C810808 /* breakpoint instruction */
+
+#define BKPT_SIZE (4) /* size of breakpoint inst */
+#define BKPT_SET(inst) (BKPT_INST)
+
+#define FIXUP_PC_AFTER_BREAK ddb_regs.iar -= 4;
+
+#define SR_SINGLESTEP 0x8000
+#define db_clear_single_step(regs) ((regs)->msr &= ~SR_SINGLESTEP)
+#define db_set_single_step(regs) ((regs)->msr |= SR_SINGLESTEP)
+
+#define T_BREAKPOINT 0xffff
+#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAKPOINT)
+
+#ifdef T_WATCHPOINT
+#define IS_WATCHPOINT_TRAP(type, code) ((type) == T_WATCHPOINT)
+#else
+#define IS_WATCHPOINT_TRAP(type, code) 0
+#endif
+
+#define M_RTS 0xfc0007fe
+#define I_RTS 0x4c000020
+#define M_BC 0xfc000000
+#define I_BC 0x40000000
+#define M_B 0xfc000000
+#define I_B 0x50000000
+#define M_RFI 0xfc0007fe
+#define I_RFI 0x4c000064
+
+#define inst_trap_return(ins) (((ins)&M_RFI) == I_RFI)
+#define inst_return(ins) (((ins)&M_RTS) == I_RTS)
+#define inst_call(ins) (((ins)&M_BC ) == I_BC || \
+ ((ins)&M_B ) == I_B )
+#define inst_load(ins) 0
+#define inst_store(ins) 0
+
+#ifdef _KERNEL
+
+void kdb_kintr __P((void *));
+int kdb_trap __P((int, void *));
+
+#endif /* _KERNEL */
+
+#endif /* _PPC_DB_MACHDEP_H_ */
diff --git a/sys/arch/powerpc/include/endian.h b/sys/arch/powerpc/include/endian.h
index 6f5c4c62297..ef8ca26ff9b 100644
--- a/sys/arch/powerpc/include/endian.h
+++ b/sys/arch/powerpc/include/endian.h
@@ -52,10 +52,10 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
-unsigned long htonl __P((unsigned long));
-unsigned short htons __P((unsigned short));
-unsigned long ntohl __P((unsigned long));
-unsigned short ntohs __P((unsigned short));
+u_int32_t htonl __P((u_int32_t));
+u_int16_t htons __P((u_int16_t));
+u_int32_t ntohl __P((u_int32_t));
+u_int16_t ntohs __P((u_int16_t));
__END_DECLS
/*
diff --git a/sys/arch/powerpc/include/ptrace.h b/sys/arch/powerpc/include/ptrace.h
new file mode 100644
index 00000000000..321320297e6
--- /dev/null
+++ b/sys/arch/powerpc/include/ptrace.h
@@ -0,0 +1,48 @@
+/* $OpenBSD: ptrace.h,v 1.1 1996/12/28 06:09:22 rahnds Exp $ */
+/* $NetBSD: ptrace.h,v 1.7 1995/01/26 19:47:10 mycroft 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)
+#if NOT_SUPPORTED
+#define PT_GETREGS (PT_FIRSTMACH + 1)
+#define PT_SETREGS (PT_FIRSTMACH + 2)
+
+#define PT_GETFPREGS (PT_FIRSTMACH + 3)
+#define PT_SETFPREGS (PT_FIRSTMACH + 4)
+#endif
+
+#endif /* !_POWERPC_PTRACE_H_ */
diff --git a/sys/arch/powerpc/include/types.h b/sys/arch/powerpc/include/types.h
index 0097cc04d5e..3233b6e6f03 100644
--- a/sys/arch/powerpc/include/types.h
+++ b/sys/arch/powerpc/include/types.h
@@ -51,7 +51,8 @@ typedef int32_t register_t;
typedef unsigned long vm_size_t;
typedef unsigned long vm_offset_t;
-/* This is only to make some unneeded function declaration happy */
-#define label_t void
+typedef struct label_t {
+ int val[40]; /* double check this XXX */
+} label_t;
#endif /* _MACHTYPES_H_ */
diff --git a/sys/arch/powerpc/powerpc/Locore.c b/sys/arch/powerpc/powerpc/Locore.c
index d4665a9dec9..3c9fd694cda 100644
--- a/sys/arch/powerpc/powerpc/Locore.c
+++ b/sys/arch/powerpc/powerpc/Locore.c
@@ -1,4 +1,4 @@
-/* $NetBSD: Locore.c,v 1.1 1996/09/30 16:34:39 ws Exp $ */
+/* $NetBSD: Locore.c,v 1.2 1996/11/06 20:19:50 cgd Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -71,7 +71,7 @@ setrunqueue(p)
* Calls should be made at splstatclock().
*/
void
-remrq(p)
+remrunqueue(p)
struct proc *p;
{
int which = p->p_priority >> 2;
@@ -79,7 +79,7 @@ remrq(p)
#ifdef DIAGNOSTIC
if (!(whichqs & (0x80000000 >> which)))
- panic("remrq");
+ panic("remrunqueue");
#endif
p->p_forw->p_back = p->p_back;
p->p_back->p_forw = p->p_forw;
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index d09927293f5..9d73c100b76 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -107,6 +107,7 @@ trap(frame)
}
map = kernel_map;
}
+printf("kern dsi on addr %x iar %x\n", frame->dar, frame->srr0);
goto brain_damage;
case EXC_DSI|EXC_USER:
{
@@ -121,7 +122,7 @@ trap(frame)
== KERN_SUCCESS)
break;
}
-printf("dsi on addr %x iar %x\n", frame->dsisr, frame->srr0);
+printf("dsi on addr %x iar %x\n", frame->dar, frame->srr0);
trapsignal(p, SIGSEGV, EXC_DSI);
break;
case EXC_ISI|EXC_USER:
@@ -350,7 +351,7 @@ setusr(content)
int
copyin(udaddr, kaddr, len)
- void *udaddr;
+ const void *udaddr;
void *kaddr;
size_t len;
{
@@ -377,7 +378,7 @@ copyin(udaddr, kaddr, len)
int
copyout(kaddr, udaddr, len)
- void *kaddr;
+ const void *kaddr;
void *udaddr;
size_t len;
{
diff --git a/sys/arch/powerpc/stand/ofdev.h b/sys/arch/powerpc/stand/ofdev.h
index d6e0d5231aa..64b1a944a3f 100644
--- a/sys/arch/powerpc/stand/ofdev.h
+++ b/sys/arch/powerpc/stand/ofdev.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: ofdev.h,v 1.2 1996/12/28 06:09:32 rahnds Exp $ */
/* $NetBSD: ofdev.h,v 1.1 1996/09/30 16:35:04 ws Exp $ */
/*
@@ -44,7 +45,7 @@ struct of_dev {
#define OFDEV_NET 1
#define OFDEV_DISK 2
-#define DEFAULT_KERNEL "/netbsd"
+#define DEFAULT_KERNEL "/bsd"
extern char opened_name[];
extern int floppyboot;