Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Move common exception vector and scheduler code to
details: https://anonhg.NetBSD.org/src/rev/eb2c47095529
branches: trunk
changeset: 522705:eb2c47095529
user: uch <uch%NetBSD.org@localhost>
date: Sun Feb 24 18:19:40 2002 +0000
description:
Move common exception vector and scheduler code to
sh3/sh3/exception_vector.S and sh3/sh3/locore_subr.S. exception
vectors are installed by sh_cpu_init(). machine/locore.S contains
kernel entry, interrupt handler, and some MD code.
diffstat:
sys/arch/dreamcast/dreamcast/genassym.cf | 109 -
sys/arch/dreamcast/dreamcast/locore.S | 176 +++
sys/arch/dreamcast/dreamcast/locore.s | 1653 -----------------------------
sys/arch/dreamcast/dreamcast/machdep.c | 292 +----
sys/arch/evbsh3/evbsh3/genassym.cf | 110 -
sys/arch/evbsh3/evbsh3/locore.S | 354 ++++++
sys/arch/evbsh3/evbsh3/locore.s | 1655 ------------------------------
sys/arch/evbsh3/evbsh3/machdep.c | 26 +-
sys/arch/hpcsh/conf/files.hpcsh | 4 +-
sys/arch/hpcsh/conf/shl-_elf.x | 6 +-
sys/arch/hpcsh/conf/shl-coff.x | 4 +-
sys/arch/hpcsh/conf/shl-elf.x | 6 +-
sys/arch/hpcsh/conf/std.hpcsh | 3 +-
sys/arch/hpcsh/hpcsh/genassym.cf | 96 -
sys/arch/hpcsh/hpcsh/locore.S | 138 ++
sys/arch/hpcsh/hpcsh/locore.s | 1243 ----------------------
sys/arch/hpcsh/hpcsh/machdep.c | 48 +-
sys/arch/mmeye/mmeye/genassym.cf | 100 -
sys/arch/mmeye/mmeye/locore.S | 306 +++++
sys/arch/mmeye/mmeye/locore.s | 1411 -------------------------
sys/arch/mmeye/mmeye/machdep.c | 23 +-
sys/arch/sh3/Makefile.inc | 4 +
sys/arch/sh3/conf/Makefile.sh3 | 8 +-
sys/arch/sh3/conf/files.sh3 | 3 +-
sys/arch/sh3/include/cpu.h | 15 +-
sys/arch/sh3/include/frame.h | 34 +-
sys/arch/sh3/include/locore.h | 221 ++++
sys/arch/sh3/sh3/exception_vector.S | 163 ++
sys/arch/sh3/sh3/genassym.cf | 91 +
sys/arch/sh3/sh3/locore_subr.S | 685 ++++++++++++-
sys/arch/sh3/sh3/sh3_machdep.c | 32 +-
sys/arch/sh3/sh3/trap.c | 138 +--
32 files changed, 2251 insertions(+), 6906 deletions(-)
diffs (truncated from 9752 to 300 lines):
diff -r b0888cee6cc4 -r eb2c47095529 sys/arch/dreamcast/dreamcast/genassym.cf
--- a/sys/arch/dreamcast/dreamcast/genassym.cf Sun Feb 24 18:13:06 2002 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-# $NetBSD: genassym.cf,v 1.2 2001/02/15 18:30:31 marcus Exp $
-
-#
-# Copyright (c) 1995, 1997 Charles M. Hannum. All rights reserved.
-# Copyright (c) 1982, 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.
-#
-# @(#)genassym.c 5.11 (Berkeley) 5/10/91
-#
-
-include "opt_memsize.h"
-include "opt_led_addr.h"
-
-include <sys/param.h>
-include <sys/proc.h>
-include <sys/resourcevar.h>
-include <sys/device.h>
-include <sys/user.h>
-include <sys/mbuf.h>
-
-include <uvm/uvm_extern.h>
-
-include <sh3/mmureg.h>
-include <machine/trap.h>
-include <machine/pmap.h>
-include <machine/vmparam.h>
-
-define SRUN SRUN
-define SONPROC SONPROC
-
-define PDSLOT_PTE PDSLOT_PTE
-define PDSLOT_APTE PDSLOT_APTE
-define PDSLOT_KERN PDSLOT_KERN
-define NKPTP_MIN NKPTP_MIN
-define NKPTP_MAX NKPTP_MAX
-
-define VM_MAXUSER_ADDRESS (int)VM_MAXUSER_ADDRESS
-
-define P_ADDR offsetof(struct proc, p_addr)
-define P_BACK offsetof(struct proc, p_back)
-define P_FORW offsetof(struct proc, p_forw)
-define P_PRIORITY offsetof(struct proc, p_priority)
-define P_STAT offsetof(struct proc, p_stat)
-define P_WCHAN offsetof(struct proc, p_wchan)
-define P_VMSPACE offsetof(struct proc, p_vmspace)
-define P_FLAG offsetof(struct proc, p_flag)
-
-define P_SYSTEM P_SYSTEM
-
-define M_DATA offsetof(struct mbuf, m_data)
-define M_LEN offsetof(struct mbuf, m_len)
-define M_NEXT offsetof(struct mbuf, m_next)
-
-define V_TRAP offsetof(struct uvmexp, traps)
-define V_INTR offsetof(struct uvmexp, intrs)
-
-define PCB_PAGEDIRREG offsetof(struct pcb, pageDirReg)
-define PCB_ONFAULT offsetof(struct pcb, pcb_onfault)
-define PCB_R15 offsetof(struct pcb, r15)
-define PCB_R14 offsetof(struct pcb, r14)
-define PCB_KR15 offsetof(struct pcb, kr15)
-
-define TF_SPC offsetof(struct trapframe, tf_spc)
-define TF_TRAPNO offsetof(struct trapframe, tf_trapno)
-
-define SIGF_HANDLER offsetof(struct sigframe, sf_handler)
-define SIGF_SC offsetof(struct sigframe, sf_sc)
-define SC_EFLAGS offsetof(struct sigcontext, sc_ssr)
-
-define IOM_RAM_BEGIN IOM_RAM_BEGIN
-define IOM_RAM_SIZE IOM_RAM_SIZE
-define IOM_ROM_BEGIN IOM_ROM_BEGIN
-
-# XXX SH4 only
-ifdef MMUCR_VALIDBITS
-define MMUCR_VALIDBITS MMUCR_VALIDBITS
-endif
-
diff -r b0888cee6cc4 -r eb2c47095529 sys/arch/dreamcast/dreamcast/locore.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/dreamcast/dreamcast/locore.S Sun Feb 24 18:19:40 2002 +0000
@@ -0,0 +1,176 @@
+/* $NetBSD: locore.S,v 1.1 2002/02/24 18:19:41 uch Exp $ */
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "opt_memsize.h"
+#include "assym.h"
+
+#include <sh3/asm.h>
+#include <sh3/locore.h>
+#include <sh3/mmu_sh4.h>
+#include <sh3/cache_sh4.h>
+
+/* bootstrap stack is near upper address of RAM. don't increase MSGBUFSIZE */
+#define INIT_STACK IOM_RAM_BEGIN + IOM_RAM_SIZE - 0x00001000
+
+/*
+ * void start(void) __attribute__((__noreturn__)):
+ * Kernel entry point.
+ */
+NENTRY(start)
+ /* Set bootstrap stack pointer */
+ mov.l _L.bootstrap_stack, r15
+
+ /* Mask all interrupt */
+ __INTR_MASK_r0_r1
+
+ /*
+ * Cache initialize.
+ * I/D-cache enable, P0, U0, P3 write-back P1 write-through.
+ */
+ mov.l _L.sh4_icache_sync_all, r0
+ jsr @r0
+ nop
+ mov.l _L.CCR, r0
+ mov.l _L.CCRconfig, r1
+ mov.l r1, @r0
+
+ /* MMU off */
+ mov.l _L.MMUCR, r0
+ xor r1, r1
+ mov.l r1, @r0
+
+ /* Make sure to change register bank 0 */
+ mov #0x20, r1
+ stc sr, r0
+ swap.b r1, r1
+ swap.w r1, r1
+ not r1, r1
+ and r1, r0
+ ldc r0, sr /* SR.RB = 0 */
+
+ /* Go! */
+ mov.l _L.dreamcast_startup, r0
+ jmp @r0
+ nop
+ /* NOTREACHED */
+ .align 2
+_L.dreamcast_startup: .long _C_LABEL(dreamcast_startup)
+_L.bootstrap_stack: .long INIT_STACK
+_L.sh4_icache_sync_all: .long _C_LABEL(sh4_icache_sync_all)
+_L.CCR: .long SH4_CCR
+_L.CCRconfig: .long 0x00000909
+_L.MMUCR: .long SH4_MMUCR
+
+/*
+ * void interrupt_exp(int, int, int, int, stuct trapframe)
+ * __attribute__((__noreturn__)):
+ * on entry, SR.BL = 1, SR_RB = 0, all regsiters are saved,
+ * stack is already setuped.
+ */
+ .align 2
+recurse:
+ stc sr, r4
+ ldc r5, spc
+ ldc r4, ssr
+ RECURSEENTRY
+ bra 1f
+ nop
+NENTRY(interrupt_exp)
+1:
+ MOV (INTEVT, r0)
+ mov.l @r0, r0
+ mov.l r0, @(TF_TRAPNO, r15) /* trapframe->tf_trapno = INTEVT */
+ __INTR_MASK_r0_r1 /* mask all interrupt */
+ __EXCEPTION_UNBLOCK_r0_r1 /* enable exception for TLB handling */
+ mov.l _L.intrhandler, r0
+ jsr @r0
+ nop
+ tst r0, r0 /* intrhandler() == 0, fast intr return */
+ bt 2f
+
+ mov.l _L.check_ipending, r0
+ jsr @r0
+ nop
+ tst r0, r0
+ bf 1b /* handle pending interrupt. */
+
+ /* Check for ASTs on exit to user mode. */
+ mov.l _L.ast, r0
+ jsr @r0
+ mov r15, r4
+2:
+ EXCEPTION_RETURN
+ /* NOTREACHED */
+ .align 2
+REG_SYMBOL(INTEVT)
+_L.intrhandler: .long _C_LABEL(intrhandler)
+_L.ast: .long _C_LABEL(ast)
+
+NENTRY(Xspllower)
+ sts.l pr, @-r15
+
+restart:
+ __INTR_MASK_r0_r1
+ __EXCEPTION_UNBLOCK_r0_r1
+ mov.l _L.check_ipending, r0
+ jsr @r0
+ nop
+ tst r0, r0
+ bt 1f
+
+ mov.l _L.restart, r5
+ mov.l _L.recurse, r0
+ jmp @r0
+ nop
+
+1:
+ __INTR_UNMASK_r0_r1
+ lds.l @r15+, pr
+ rts
+ nop
+
+ .align 2
+_L.check_ipending: .long _C_LABEL(check_ipending)
+_L.recurse: .long recurse
+_L.restart: .long restart
+
+ .data
+ .align 2
+ .globl _C_LABEL(intrcnt), _C_LABEL(eintrcnt)
+ .globl _C_LABEL(intrnames), _C_LABEL(eintrnames)
+_C_LABEL(intrcnt):
+_C_LABEL(eintrcnt):
+_C_LABEL(intrnames):
+_C_LABEL(eintrnames):
diff -r b0888cee6cc4 -r eb2c47095529 sys/arch/dreamcast/dreamcast/locore.s
--- a/sys/arch/dreamcast/dreamcast/locore.s Sun Feb 24 18:13:06 2002 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1653 +0,0 @@
-/* $NetBSD: locore.s,v 1.13 2002/02/22 19:45:33 uch Exp $ */
-
-/*-
Home |
Main Index |
Thread Index |
Old Index