Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Add sh5 kernel support for SAs.
details: https://anonhg.NetBSD.org/src/rev/77c3f2bb3021
branches: trunk
changeset: 541891:77c3f2bb3021
user: scw <scw%NetBSD.org@localhost>
date: Sun Jan 19 19:49:47 2003 +0000
description:
Add sh5 kernel support for SAs.
This gets the Cayman to multi-user with a non-SA aware userland.
diffstat:
sys/arch/evbsh5/include/Makefile | 4 +-
sys/arch/evbsh5/include/mcontext.h | 3 +
sys/arch/sh5/include/Makefile | 4 +-
sys/arch/sh5/include/cpu.h | 11 +-
sys/arch/sh5/include/mcontext.h | 106 ++++++++++++++++
sys/arch/sh5/include/netbsd32_machdep.h | 4 +-
sys/arch/sh5/include/pmap.h | 4 +-
sys/arch/sh5/include/proc.h | 11 +-
sys/arch/sh5/include/reg.h | 16 +-
sys/arch/sh5/include/trap.h | 8 +-
sys/arch/sh5/sh5/cpu_switch.S | 208 ++++++++++++++++---------------
sys/arch/sh5/sh5/db_interface.c | 23 +-
sys/arch/sh5/sh5/db_trace.c | 24 ++-
sys/arch/sh5/sh5/exception.S | 16 +-
sys/arch/sh5/sh5/genassym.cf | 27 ++-
sys/arch/sh5/sh5/locore_subr.S | 16 +-
sys/arch/sh5/sh5/mem.c | 6 +-
sys/arch/sh5/sh5/netbsd32_machdep.c | 23 +-
sys/arch/sh5/sh5/pmap.c | 22 +-
sys/arch/sh5/sh5/process_machdep.c | 36 ++--
sys/arch/sh5/sh5/sig_machdep.c | 136 +++++++++++++++++---
sys/arch/sh5/sh5/syscall.c | 63 +++++++--
sys/arch/sh5/sh5/trap.c | 102 ++++++++-------
sys/arch/sh5/sh5/vm_machdep.c | 65 ++++++----
24 files changed, 612 insertions(+), 326 deletions(-)
diffs (truncated from 2082 to 300 lines):
diff -r b1f0cddc8ed3 -r 77c3f2bb3021 sys/arch/evbsh5/include/Makefile
--- a/sys/arch/evbsh5/include/Makefile Sun Jan 19 19:48:45 2003 +0000
+++ b/sys/arch/evbsh5/include/Makefile Sun Jan 19 19:49:47 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.9 2002/11/26 23:30:26 lukem Exp $
+# $NetBSD: Makefile,v 1.10 2003/01/19 19:49:58 scw Exp $
INCSDIR= /usr/include/evbsh5
@@ -11,7 +11,7 @@
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
limits.h lock.h \
- math.h \
+ math.h mcontext.h \
netbsd32_machdep.h \
param.h pcb.h pci_machdep.h pmap.h pmc.h proc.h profile.h ptrace.h \
reg.h \
diff -r b1f0cddc8ed3 -r 77c3f2bb3021 sys/arch/evbsh5/include/mcontext.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbsh5/include/mcontext.h Sun Jan 19 19:49:47 2003 +0000
@@ -0,0 +1,3 @@
+/* $NetBSD: mcontext.h,v 1.1 2003/01/19 19:49:58 scw Exp $ */
+
+#include <sh5/mcontext.h>
diff -r b1f0cddc8ed3 -r 77c3f2bb3021 sys/arch/sh5/include/Makefile
--- a/sys/arch/sh5/include/Makefile Sun Jan 19 19:48:45 2003 +0000
+++ b/sys/arch/sh5/include/Makefile Sun Jan 19 19:49:47 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.10 2002/11/26 23:30:30 lukem Exp $
+# $NetBSD: Makefile,v 1.11 2003/01/19 19:49:47 scw Exp $
INCSDIR= /usr/include/sh5
@@ -11,7 +11,7 @@
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
limits.h lock.h \
- math.h \
+ math.h mcontext.h \
netbsd32_machdep.h \
param.h pcb.h pmap.h pmc.h proc.h profile.h pte.h ptrace.h \
pci_machdep.h \
diff -r b1f0cddc8ed3 -r 77c3f2bb3021 sys/arch/sh5/include/cpu.h
--- a/sys/arch/sh5/include/cpu.h Sun Jan 19 19:48:45 2003 +0000
+++ b/sys/arch/sh5/include/cpu.h Sun Jan 19 19:49:47 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.8 2002/10/05 11:01:13 scw Exp $ */
+/* $NetBSD: cpu.h,v 1.9 2003/01/19 19:49:48 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -138,7 +138,7 @@
u_int ci_simple_locks; /* # of simple locks held */
#endif
- struct proc *ci_curproc; /* current process on this cpu */
+ struct lwp *ci_curlwp; /* current lwp on this cpu */
struct pcb *ci_curpcb; /* current process' pcb */
vsid_t ci_curvsid; /* current pmap's vsid */
u_int ci_want_resched; /* current process pre-empted */
@@ -156,7 +156,7 @@
return (ci);
}
-#define curproc curcpu()->ci_curproc
+#define curlwp curcpu()->ci_curlwp
#define curpcb curcpu()->ci_curpcb
/*
@@ -165,6 +165,7 @@
*/
#define cpu_wait(p) /* nothing */
#define cpu_number() 0
+#define cpu_proc_fork(p1, p2) /* nothing */
/*
* Can swapout u-area
@@ -200,8 +201,8 @@
#define need_resched(ci) \
do { \
(ci)->ci_want_resched = 1; \
- if ((ci)->ci_curproc != NULL) \
- aston((ci)->ci_curproc); \
+ if (curproc != NULL) \
+ aston(curproc); \
} while (/*CONSTCOND*/0)
/*
diff -r b1f0cddc8ed3 -r 77c3f2bb3021 sys/arch/sh5/include/mcontext.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sh5/include/mcontext.h Sun Jan 19 19:49:47 2003 +0000
@@ -0,0 +1,106 @@
+/* $NetBSD: mcontext.h,v 1.1 2003/01/19 19:49:49 scw Exp $ */
+
+/*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, 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 for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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 _SH5_MCONTEXT_H_
+#define _SH5_MCONTEXT_H_
+
+#ifdef _KERNEL_
+#include <machine/frame.h>
+#endif
+
+/*
+ * General register state
+ *
+ * See notes, below, about the layout of mcontext_t before changing this.
+ */
+#define _NGREG 73 /* PC, USR, R0 -> R62, TR0 -> TR7 */
+
+#define _REG_PC 0
+#define _REG_USR 1
+#define _REG_R(n) (2 + (n))
+#define _REG_TR(n) (65 + (n))
+
+#define _REG_FP _REG_R(14)
+#define _REG_SP _REG_R(15)
+
+#ifndef __ASSEMBLER__
+#ifdef _LP64
+typedef long __greg_t;
+#else
+typedef long long __greg_t;
+#endif
+typedef __greg_t __gregset_t[_NGREG];
+
+/*
+ * Floating point register state
+ *
+ * See notes, below, about the layout of mcontext_t before changing this.
+ */
+typedef float __fpreg_single_t;
+typedef double __fpreg_double_t;
+
+typedef struct {
+ u_int32_t __fp_scr;
+ u_int32_t __fp_pad;
+ union {
+ __fpreg_single_t __u_fp_single[64];
+ __fpreg_double_t __u_fp_double[32];
+ } __fpregs_u;
+} __fpregset_t;
+#define __fp_single __fpregs_u.__u_fp_single
+#define __fp_double __fpregs_u.__u_fp_double
+
+/*
+ * SH5's mcontext_t structure.
+ *
+ * Note: This *exactly* matches the layout of SH5's "struct reg".
+ * Please don't update one without making a similar change to the other.
+ */
+typedef struct {
+ __gregset_t __gregs;
+ __fpregset_t __fpregs;
+} mcontext_t;
+
+#endif /* !__ASSEMBLER__ */
+
+/*
+ * Note: no additional padding required in ucontext_t
+ */
+
+#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_SP])
+
+#endif /* _SH5_MCONTEXT_H_ */
diff -r b1f0cddc8ed3 -r 77c3f2bb3021 sys/arch/sh5/include/netbsd32_machdep.h
--- a/sys/arch/sh5/include/netbsd32_machdep.h Sun Jan 19 19:48:45 2003 +0000
+++ b/sys/arch/sh5/include/netbsd32_machdep.h Sun Jan 19 19:49:47 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.h,v 1.1 2002/10/23 13:26:36 scw Exp $ */
+/* $NetBSD: netbsd32_machdep.h,v 1.2 2003/01/19 19:49:49 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -60,6 +60,6 @@
#define netbsd32_sendsig sendsig
#define netbsd32_syscall_intern syscall_intern
-extern void netbsd32_setregs(struct proc *, struct exec_package *, u_long);
+extern void netbsd32_setregs(struct lwp *, struct exec_package *, u_long);
#endif /* _SH5_NETBSD32_MACHDEP_H */
diff -r b1f0cddc8ed3 -r 77c3f2bb3021 sys/arch/sh5/include/pmap.h
--- a/sys/arch/sh5/include/pmap.h Sun Jan 19 19:48:45 2003 +0000
+++ b/sys/arch/sh5/include/pmap.h Sun Jan 19 19:49:47 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.13 2002/11/23 09:25:54 scw Exp $ */
+/* $NetBSD: pmap.h,v 1.14 2003/01/19 19:49:50 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -70,7 +70,7 @@
extern struct pmap kernel_pmap_store;
#define pmap_kernel() (&kernel_pmap_store)
-extern int pmap_write_trap(int, vaddr_t);
+extern int pmap_write_trap(struct proc *, int, vaddr_t);
extern boolean_t pmap_clear_bit(struct vm_page *, ptel_t);
extern boolean_t pmap_query_bit(struct vm_page *, ptel_t);
diff -r b1f0cddc8ed3 -r 77c3f2bb3021 sys/arch/sh5/include/proc.h
--- a/sys/arch/sh5/include/proc.h Sun Jan 19 19:48:45 2003 +0000
+++ b/sys/arch/sh5/include/proc.h Sun Jan 19 19:49:47 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.h,v 1.1 2002/07/05 13:32:01 scw Exp $ */
+/* $NetBSD: proc.h,v 1.2 2003/01/19 19:49:50 scw Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -42,12 +42,15 @@
/*
* Machine-dependent part of the proc structure for sh5.
*/
-struct mdproc {
+struct mdlwp {
struct trapframe *md_regs; /* user context */
struct pcb *md_pcb; /* pcb access address */
- void (*md_syscall)(struct proc *, struct trapframe *);
+ int md_flags; /* machine-dependent flags */
+};
+
+struct mdproc {
volatile u_int64_t md_astpending; /* AST pending for this process */
- int md_flags; /* machine-dependent flags */
+ void (*md_syscall)(struct lwp *, struct trapframe *);
};
/* md_flags */
diff -r b1f0cddc8ed3 -r 77c3f2bb3021 sys/arch/sh5/include/reg.h
--- a/sys/arch/sh5/include/reg.h Sun Jan 19 19:48:45 2003 +0000
+++ b/sys/arch/sh5/include/reg.h Sun Jan 19 19:49:47 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: reg.h,v 1.2 2002/09/28 11:03:08 scw Exp $ */
+/* $NetBSD: reg.h,v 1.3 2003/01/19 19:49:51 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -38,6 +38,10 @@
#ifndef _SH5_REG_H
#define _SH5_REG_H
+/*
+ * Note: The layout of this structure exactly matches SH5's mcontext_t.
+ * Do not change one without also updating the other.
+ */
struct reg {
register_t r_pc;
register_t r_usr;
@@ -51,10 +55,10 @@
register_t r_fpregs[32];
};
-struct proc;
-int process_read_regs(struct proc *, struct reg *);
-int process_write_regs(struct proc *, struct reg *);
-int process_read_fpregs(struct proc *, struct reg *);
-int process_write_fpregs(struct proc *, struct reg *);
+struct lwp;
+int process_read_regs(struct lwp *, struct reg *);
+int process_write_regs(struct lwp *, struct reg *);
+int process_read_fpregs(struct lwp *, struct reg *);
+int process_write_fpregs(struct lwp *, struct reg *);
#endif /* _SH5_REG_H */
diff -r b1f0cddc8ed3 -r 77c3f2bb3021 sys/arch/sh5/include/trap.h
--- a/sys/arch/sh5/include/trap.h Sun Jan 19 19:48:45 2003 +0000
Home |
Main Index |
Thread Index |
Old Index