Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64 Have separate data and text segments, make ...
details: https://anonhg.NetBSD.org/src/rev/8b5a1317ae4f
branches: trunk
changeset: 488165:8b5a1317ae4f
user: eeh <eeh%NetBSD.org@localhost>
date: Mon Jun 19 23:30:32 2000 +0000
description:
Have separate data and text segments, make text read-only.
diffstat:
sys/arch/sparc64/conf/GENERIC | 12 +-
sys/arch/sparc64/conf/Makefile.sparc64 | 5 +-
sys/arch/sparc64/conf/NONPLUS64 | 4 +-
sys/arch/sparc64/conf/std.sparc64 | 3 +-
sys/arch/sparc64/dev/iommu.c | 9 +-
sys/arch/sparc64/include/cpu.h | 34 +-
sys/arch/sparc64/include/ctlreg.h | 7 +-
sys/arch/sparc64/include/param.h | 66 +-
sys/arch/sparc64/sparc64/autoconf.c | 16 +-
sys/arch/sparc64/sparc64/cpu.c | 5 +-
sys/arch/sparc64/sparc64/db_disasm.c | 4 +-
sys/arch/sparc64/sparc64/db_interface.c | 11 +-
sys/arch/sparc64/sparc64/genassym.c | 62 +-
sys/arch/sparc64/sparc64/genassym.cf | 60 +-
sys/arch/sparc64/sparc64/locore.s | 956 +++++++++++++++++--------------
sys/arch/sparc64/sparc64/mem.c | 22 +-
sys/arch/sparc64/sparc64/pmap.c | 681 ++++++++++++++--------
sys/arch/sparc64/sparc64/trap.c | 9 +-
sys/arch/sparc64/sparc64/vaddrs.h | 18 +-
19 files changed, 1108 insertions(+), 876 deletions(-)
diffs (truncated from 4332 to 300 lines):
diff -r fa6ec7e80068 -r 8b5a1317ae4f sys/arch/sparc64/conf/GENERIC
--- a/sys/arch/sparc64/conf/GENERIC Mon Jun 19 23:19:20 2000 +0000
+++ b/sys/arch/sparc64/conf/GENERIC Mon Jun 19 23:30:32 2000 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: GENERIC,v 1.34 2000/06/14 22:02:37 veego Exp $
+# $NetBSD: GENERIC,v 1.35 2000/06/19 23:30:32 eeh Exp $
include "arch/sparc64/conf/std.sparc64"
-#ident "GENERIC-$Revision: 1.34 $"
+#ident "GENERIC-$Revision: 1.35 $"
maxusers 32
@@ -83,7 +83,7 @@
## Compile the kernel with debugging symbols (`netbsd.gdb' is the debug file),
## such that gdb(1) can be used on a kernel coredump.
-#makeoptions DEBUG="-g"
+makeoptions DEBUG="-g"
## Adds code to the kernel that does internal consistency checks, and will
@@ -93,7 +93,7 @@
## Enable (possibly expensive) debugging code that may also display messages
## on the system console
-#options DEBUG
+options DEBUG
## Make SCSI error messages more verbose when explaining their meanings.
options SCSIVERBOSE
@@ -273,8 +273,8 @@
#scsibus* at fas?
## GLM support missing
-#sym* at pci? # 53C875 "glm" compatible
-#scsibus* at sym?
+siop* at pci? # 53C875 "glm" compatible
+scsibus* at siop?
## These entries find devices on all SCSI busses and assign
## unit numbers dynamically.
diff -r fa6ec7e80068 -r 8b5a1317ae4f sys/arch/sparc64/conf/Makefile.sparc64
--- a/sys/arch/sparc64/conf/Makefile.sparc64 Mon Jun 19 23:19:20 2000 +0000
+++ b/sys/arch/sparc64/conf/Makefile.sparc64 Mon Jun 19 23:30:32 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.sparc64,v 1.25 2000/06/09 15:28:21 eeh Exp $
+# $NetBSD: Makefile.sparc64,v 1.26 2000/06/19 23:30:32 eeh Exp $
# Makefile for NetBSD
#
@@ -69,7 +69,8 @@
#CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
CFLAGS= ${DEBUG} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
AFLAGS= -x assembler-with-cpp -Wa,-Av9a -traditional-cpp -D_LOCORE
-LINKFLAGS= -N -p -Ttext f1000000 -e start >lderr
+LINKFLAGS= -p -Ttext f1000000 -Tdata f1400000 -e start >lderr
+#LINKFLAGS= -N -p -Ttext f1000000 -e start >lderr
STRIPFLAGS= -g
%INCLUDES
diff -r fa6ec7e80068 -r 8b5a1317ae4f sys/arch/sparc64/conf/NONPLUS64
--- a/sys/arch/sparc64/conf/NONPLUS64 Mon Jun 19 23:19:20 2000 +0000
+++ b/sys/arch/sparc64/conf/NONPLUS64 Mon Jun 19 23:30:32 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: NONPLUS64,v 1.12 1999/11/20 18:09:52 eeh Exp $
+# $NetBSD: NONPLUS64,v 1.13 2000/06/19 23:30:32 eeh Exp $
include "arch/sparc64/conf/std.sparc64"
@@ -10,9 +10,9 @@
# Options for variants of the Sun SPARC architecure.
# We currently support three architecture types; at least one is required.
options SUN4U # sun4u - Ultra 140 and 170
-options TRAPWIN # use a new window for traps
options __ELF__ # we use elf
options _LP64 # we're using a 64-bit compiler
+makeoptions SPARC64_BINARIES=1
## System options specific to the sparc machine type
diff -r fa6ec7e80068 -r 8b5a1317ae4f sys/arch/sparc64/conf/std.sparc64
--- a/sys/arch/sparc64/conf/std.sparc64 Mon Jun 19 23:19:20 2000 +0000
+++ b/sys/arch/sparc64/conf/std.sparc64 Mon Jun 19 23:30:32 2000 +0000
@@ -1,10 +1,11 @@
-# $NetBSD: std.sparc64,v 1.6 1999/11/15 19:00:30 fvdl Exp $
+# $NetBSD: std.sparc64,v 1.7 2000/06/19 23:30:32 eeh Exp $
#
# Mandatory NetBSD/sparc kernel options.
#
machine sparc64 # Machine architecture; required by config(8)
+makeoptions MACHINE=sparc64
prefix ../gnu/sys
cinclude "conf/files.softdep"
diff -r fa6ec7e80068 -r 8b5a1317ae4f sys/arch/sparc64/dev/iommu.c
--- a/sys/arch/sparc64/dev/iommu.c Mon Jun 19 23:19:20 2000 +0000
+++ b/sys/arch/sparc64/dev/iommu.c Mon Jun 19 23:30:32 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iommu.c,v 1.14 2000/06/18 07:17:40 mrg Exp $ */
+/* $NetBSD: iommu.c,v 1.15 2000/06/19 23:30:33 eeh Exp $ */
/*
* Copyright (c) 1999, 2000 Matthew R. Green
@@ -181,11 +181,8 @@
is->is_dvmabase = IOTSB_VSTART(is->is_tsbsize) + NBPG;
/*
- * Allocate memory for I/O pagetables.
- * This takes 64K of contiguous physical memory to map 64M of
- * DVMA space (starting at IOMMU_DVMA_BASE).
- * The table must be aligned on a (-IOMMU_DVMA_BASE/pagesize)
- * boundary (i.e. 64K for 64M of DVMA space).
+ * Allocate memory for I/O pagetables. They need to be physically
+ * contiguous.
*/
size = NBPG<<(is->is_tsbsize);
diff -r fa6ec7e80068 -r 8b5a1317ae4f sys/arch/sparc64/include/cpu.h
--- a/sys/arch/sparc64/include/cpu.h Mon Jun 19 23:19:20 2000 +0000
+++ b/sys/arch/sparc64/include/cpu.h Mon Jun 19 23:30:32 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.19 2000/06/12 23:32:46 eeh Exp $ */
+/* $NetBSD: cpu.h,v 1.20 2000/06/19 23:30:34 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -91,21 +91,34 @@
*/
struct cpu_info {
+ /* Most important fields first */
struct proc *ci_curproc;
- struct pcb *ci_cpcb;
+ struct pcb *ci_cpcb; /* also initial stack */
struct cpu_info *ci_next;
+
+ struct proc *ci_fpproc;
int ci_number;
+ int ci_upaid;
struct schedstate_percpu ci_schedstate; /* scheduler state */
-#if defined(DIAGNOSTIC) || defined(LOCKDEBUG)
+
+ /* DEBUG/DIAGNOSTIC stuff */
u_long ci_spin_locks; /* # of spin locks held */
u_long ci_simple_locks;/* # of simple locks held */
-#endif
+
+ /* Spinning up the CPU */
+ void (*ci_spinup) __P((void)); /* spinup routine */
+ void *ci_initstack;
+ paddr_t ci_paddr; /* Phys addr of this structure. */
};
extern struct cpu_info *cpus;
extern struct cpu_info cpu_info_store;
+#if 1
#define curcpu() (&cpu_info_store)
+#else
+#define curcpu() ((struct cpu_info *)CPUINFO_VA)
+#endif
/*
* definitions of cpu-dependent requirements
@@ -114,7 +127,11 @@
#define cpu_swapin(p) /* nothing */
#define cpu_swapout(p) /* nothing */
#define cpu_wait(p) /* nothing */
+#if 1
+#define cpu_number() 0
+#else
#define cpu_number() (curcpu()->ci_number)
+#endif
/*
* Arguments to hardclock, softclock and gatherstats encapsulate the
@@ -132,12 +149,13 @@
#define CLKF_BASEPRI(framep) (((framep)->t.tf_oldpil) == 0)
#define CLKF_PC(framep) ((framep)->t.tf_pc)
#define CLKF_INTR(framep) ((!CLKF_USERMODE(framep))&&\
- (((framep)->t.tf_kstack < (u_int)eintstack)&&\
- ((framep)->t.tf_kstack > (u_int)intstack)))
+ (((framep)->t.tf_kstack < (vaddr_t)EINTSTACK)&&\
+ ((framep)->t.tf_kstack > (vaddr_t)INTSTACK)))
/*
* Software interrupt request `register'.
*/
+#ifdef DEPRECATED
union sir {
int sir_any;
char sir_which[4];
@@ -145,6 +163,7 @@
#define SIR_NET 0
#define SIR_CLOCK 1
+#endif
extern struct intrhand soft01intr, soft01net, soft01clock;
@@ -210,7 +229,8 @@
void intr_establish __P((int level, struct intrhand *));
/* cpu.c */
-u_int64_t cpu_start __P((int));
+paddr_t cpu_alloc __P((void));
+u_int64_t cpu_init __P((paddr_t, int));
/* disksubr.c */
struct dkbad;
int isbad __P((struct dkbad *bt, int, int, int));
diff -r fa6ec7e80068 -r 8b5a1317ae4f sys/arch/sparc64/include/ctlreg.h
--- a/sys/arch/sparc64/include/ctlreg.h Mon Jun 19 23:19:20 2000 +0000
+++ b/sys/arch/sparc64/include/ctlreg.h Mon Jun 19 23:30:32 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ctlreg.h,v 1.17 2000/06/10 20:51:43 eeh Exp $ */
+/* $NetBSD: ctlreg.h,v 1.18 2000/06/19 23:30:34 eeh Exp $ */
/*
* Copyright (c) 1996-1999 Eduardo Horvath
@@ -171,6 +171,11 @@
* The following are 4u control registers
*/
+
+/* Get the CPU's UPAID */
+#define UPA_CR_MID(x) (((x)>>17)&0x1f)
+#define CPU_UPAID UPA_CR_MID(ldxa(0, ASI_MID_REG))
+
/*
* [4u] MMU and Cache Control Register (MCCR)
* use ASI = 0x45
diff -r fa6ec7e80068 -r 8b5a1317ae4f sys/arch/sparc64/include/param.h
--- a/sys/arch/sparc64/include/param.h Mon Jun 19 23:19:20 2000 +0000
+++ b/sys/arch/sparc64/include/param.h Mon Jun 19 23:30:32 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.19 2000/06/13 05:04:05 eeh Exp $ */
+/* $NetBSD: param.h,v 1.20 2000/06/19 23:30:34 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -120,10 +120,6 @@
extern int nbpg, pgofset, pgshift;
#endif
-#define KERNBASE 0x0f1000000 /* start of kernel virtual space */
-#define KERNEND 0x0fe000000 /* end of kernel virtual space */
-#define VM_MAX_KERNEL_BUF ((KERNEND-KERNBASE)/4)
-
#define DEV_BSIZE 512
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
#define BLKDEV_IOSIZE 2048
@@ -137,11 +133,67 @@
#endif
#define USPACE (SSIZE*8192)
+
+/*
+ * Here are all the magic kernel virtual addresses and how they're allocated.
+ *
+ * First, the PROM is usually a fixed-sized block from 0x00000000f0000000 to
+ * 0x00000000f0100000. It also uses some space around 0x00000000fff00000 to
+ * map in device registers. The rest is pretty much ours to play with.
+ *
+ * The kernel starts at KERNBASE. Here's they layout. We use macros to set
+ * the addresses so we can relocate everything easily. We use 4MB locked TTEs
+ * to map in the kernel text and data segments. Any extra pages are recycled,
+ * so they can potentially be double-mapped. This shouldn't really be a
+ * problem since they're unused, but wild pointers can cause silent data
+ * corruption if they are in those segments.
+ *
+ * 0x0000000000000000: 64K NFO page zero
+ * 0x0000000000010000: Userland or PROM
+ * KERNBASE: 4MB kernel text and read only data
+ * This is mapped in the ITLB and
+ * Read-Only in the DTLB
+ * KERNBASE+0x400000: 4MB kernel data and BSS -- not in ITLB
+ * Contains context table, kernel pmap,
+ * and other important structures.
+ * KERNBASE+0x800000: Unmapped page -- redzone
+ * KERNBASE+0x802000: Process 0 stack and u-area
+ * KERNBASE+0x806000: 2 pages for pmap_copy_page and /dev/mem
+ * KERNBASE+0x80a000: Start of kernel VA segment
+ * KERNEND: End of kernel VA segment
+ * KERNEND+0x02000: Auxreg_va (unused?)
+ * KERNEND+0x04000: TMPMAP_VA (unused?)
+ * KERNEND+0x06000: message buffer.
+ * KERNEND+0x010000: 64K locked TTE -- different for each CPU
+ * Contains interrupt stack, cpu_info structure,
+ * and 32KB kernel TSB.
+ * KERNEND+0x020000: IODEV_BASE -- begin mapping IO devices here.
+ * 0x00000000fe000000: IODEV_END -- end of device mapping space.
+ *
+ */
+#define KERNBASE 0x0f1000000 /* start of kernel virtual space */
+#define KERNEND 0x0fe000000 /* end of kernel virtual space */
+#define VM_MAX_KERNEL_BUF ((KERNEND-KERNBASE)/4)
Home |
Main Index |
Thread Index |
Old Index