summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authoruch <uch@NetBSD.org>2002-04-22 18:57:43 +0000
committeruch <uch@NetBSD.org>2002-04-22 18:57:43 +0000
commitd1b987309003475e2e60cc14e50f07a024f4edbf (patch)
tree30f20a02f65eb018a276ca2e546157260aefb49f /sys
parent0b82377f112d31ae37cc54610375c84ae20f8595 (diff)
make these compile with gcc -O0
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sh3/sh3/cache.c8
-rw-r--r--sys/arch/sh3/sh3/db_interface.c26
-rw-r--r--sys/arch/sh3/sh3/exception_vector.S5
-rw-r--r--sys/arch/sh3/sh3/locore_subr.S5
-rw-r--r--sys/arch/sh3/sh3/mmu.c8
-rw-r--r--sys/arch/sh3/sh3/sh3_machdep.c23
6 files changed, 55 insertions, 20 deletions
diff --git a/sys/arch/sh3/sh3/cache.c b/sys/arch/sh3/sh3/cache.c
index 79cc5f67c95..940d63f4b5e 100644
--- a/sys/arch/sh3/sh3/cache.c
+++ b/sys/arch/sh3/sh3/cache.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cache.c,v 1.3 2002/03/10 07:46:51 uch Exp $ */
+/* $NetBSD: cache.c,v 1.4 2002/04/22 18:57:43 uch Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -81,10 +81,14 @@ sh_cache_init()
#ifdef CACHE_DEBUG
return;
#endif
+#ifdef SH3
if (CPU_IS_SH3)
sh3_cache_config();
- else
+#endif
+#ifdef SH4
+ if (CPU_IS_SH4)
sh4_cache_config();
+#endif
}
void
diff --git a/sys/arch/sh3/sh3/db_interface.c b/sys/arch/sh3/sh3/db_interface.c
index c99750952ad..731f80c729c 100644
--- a/sys/arch/sh3/sh3/db_interface.c
+++ b/sys/arch/sh3/sh3/db_interface.c
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.14 2002/03/24 18:04:40 uch Exp $ */
+/* $NetBSD: db_interface.c,v 1.15 2002/04/22 18:57:43 uch Exp $ */
/*-
* Copyright (C) 2002 UCHIYAMA Yasushi. All rights reserved.
@@ -65,11 +65,17 @@ extern int trap_types;
void kdb_printtrap(u_int, int);
void db_tlbdump_cmd(db_expr_t, int, db_expr_t, char *);
+
void __db_tlbdump_page_size_sh4(u_int32_t);
+
void __db_tlbdump_pfn(u_int32_t);
void db_cachedump_cmd(db_expr_t, int, db_expr_t, char *);
+
void __db_cachedump_sh3(vaddr_t);
+
+
void __db_cachedump_sh4(vaddr_t);
+
void db_stackcheck_cmd(db_expr_t, int, db_expr_t, char *);
void db_frame_cmd(db_expr_t, int, db_expr_t, char *);
void __db_print_symbol(db_expr_t);
@@ -219,9 +225,9 @@ db_tlbdump_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
static const char title[] =
" VPN ASID PFN AREA VDCGWtPR SZ";
static const char title2[] = "\t\t\t (user/kernel)";
- u_int32_t r, e, a;
+ u_int32_t r, e;
int i;
-
+#ifdef SH3
if (CPU_IS_SH3) {
/* MMU configuration. */
r = _reg_read_4(SH3_MMUCR);
@@ -233,6 +239,7 @@ db_tlbdump_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
for (i = 0; i < SH3_MMU_WAY; i++) {
db_printf(" [way %d]\n", i);
for (e = 0; e < SH3_MMU_ENTRY; e++) {
+ u_int32_t a;
/* address/data array common offset. */
a = (e << SH3_MMU_VPN_SHIFT) |
(i << SH3_MMU_WAY_SHIFT);
@@ -254,7 +261,10 @@ db_tlbdump_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
r & SH3_MMUDA_D_SZ ? 4 : 1);
}
}
- } else {
+ }
+#endif /* SH3 */
+#ifdef SH4
+ if (CPU_IS_SH4) {
/* MMU configuration */
r = _reg_read_4(SH4_MMUCR);
db_printf("%s virtual storage mode, SQ access: (kernel%s)\n",
@@ -311,6 +321,7 @@ db_tlbdump_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
r & SH4_UTLB_DA2_SA_MASK);
}
}
+#endif /* SH4 */
}
void
@@ -348,11 +359,14 @@ __db_tlbdump_page_size_sh4(u_int32_t r)
void
db_cachedump_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
-
+#ifdef SH3
if (CPU_IS_SH3)
__db_cachedump_sh3(have_addr ? addr : 0);
- else
+#endif
+#ifdef SH4
+ if (CPU_IS_SH4)
__db_cachedump_sh4(have_addr ? addr : 0);
+#endif
}
#ifdef SH3
diff --git a/sys/arch/sh3/sh3/exception_vector.S b/sys/arch/sh3/sh3/exception_vector.S
index b52ce4e0eb4..4324a35b27d 100644
--- a/sys/arch/sh3/sh3/exception_vector.S
+++ b/sys/arch/sh3/sh3/exception_vector.S
@@ -1,4 +1,4 @@
-/* $NetBSD: exception_vector.S,v 1.6 2002/03/28 15:34:20 uch Exp $ */
+/* $NetBSD: exception_vector.S,v 1.7 2002/04/22 18:57:43 uch Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,8 @@
*/
#include "assym.h"
-
+#include "opt_cputype.h"
+
#include <sh3/param.h>
#include <sh3/asm.h>
#include <sh3/locore.h>
diff --git a/sys/arch/sh3/sh3/locore_subr.S b/sys/arch/sh3/sh3/locore_subr.S
index 46778c2af71..db666511783 100644
--- a/sys/arch/sh3/sh3/locore_subr.S
+++ b/sys/arch/sh3/sh3/locore_subr.S
@@ -1,4 +1,4 @@
-/* $NetBSD: locore_subr.S,v 1.7 2002/03/24 18:04:41 uch Exp $ */
+/* $NetBSD: locore_subr.S,v 1.8 2002/04/22 18:57:43 uch Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -35,7 +35,8 @@
#include "opt_ddb.h"
#include "opt_kgdb.h"
-
+#include "opt_cputype.h"
+
#include "assym.h"
#include <sys/syscall.h> /* SYS___sigreturn14, SYS_exit */
diff --git a/sys/arch/sh3/sh3/mmu.c b/sys/arch/sh3/sh3/mmu.c
index 8b65a37eeb7..03ae4cf59b5 100644
--- a/sys/arch/sh3/sh3/mmu.c
+++ b/sys/arch/sh3/sh3/mmu.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mmu.c,v 1.5 2002/03/17 14:03:34 uch Exp $ */
+/* $NetBSD: mmu.c,v 1.6 2002/04/22 18:57:43 uch Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -72,6 +72,7 @@ sh_mmu_init()
* Assing function hook. but if only defined SH3 or SH4, it is called
* directly. see sh3/mmu.h
*/
+#ifdef SH3
if (CPU_IS_SH3) {
__sh_mmu_start = sh3_mmu_start;
__sh_tlb_invalidate_addr = sh3_tlb_invalidate_addr;
@@ -83,7 +84,8 @@ sh_mmu_init()
__sh_mmu_ttb_write = sh3_mmu_ttb_write;
__sh_mmu_pd_area = __sh3_mmu_pd_area;
}
-
+#endif /* SH3 */
+#ifdef SH4
if (CPU_IS_SH4) {
__sh_mmu_start = sh4_mmu_start;
__sh_tlb_invalidate_addr = sh4_tlb_invalidate_addr;
@@ -95,7 +97,7 @@ sh_mmu_init()
__sh_mmu_ttb_write = sh4_mmu_ttb_write;
__sh_mmu_pd_area = __sh4_mmu_pd_area;
}
-
+#endif /* SH4 */
}
void
diff --git a/sys/arch/sh3/sh3/sh3_machdep.c b/sys/arch/sh3/sh3/sh3_machdep.c
index 4b0b838e6c8..d00a718ecc5 100644
--- a/sys/arch/sh3/sh3/sh3_machdep.c
+++ b/sys/arch/sh3/sh3/sh3_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sh3_machdep.c,v 1.36 2002/03/24 18:04:41 uch Exp $ */
+/* $NetBSD: sh3_machdep.c,v 1.37 2002/04/22 18:57:43 uch Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2002 The NetBSD Foundation, Inc.
@@ -133,9 +133,12 @@ vaddr_t ram_start = IOM_RAM_BEGIN;
/* exception handler holder (sh3/sh3/exception_vector.S) */
extern char sh_vector_generic[], sh_vector_generic_end[];
extern char sh_vector_interrupt[], sh_vector_interrupt_end[];
+#ifdef SH3
extern char sh3_vector_tlbmiss[], sh3_vector_tlbmiss_end[];
+#endif
+#ifdef SH4
extern char sh4_vector_tlbmiss[], sh4_vector_tlbmiss_end[];
-
+#endif
/*
* These variables are needed by /sbin/savecore
*/
@@ -169,13 +172,16 @@ sh_cpu_init(int arch, int product)
/* Exception vector. */
memcpy(VBR + 0x100, sh_vector_generic,
sh_vector_generic_end - sh_vector_generic);
+#ifdef SH3
if (CPU_IS_SH3)
memcpy(VBR + 0x400, sh3_vector_tlbmiss,
sh3_vector_tlbmiss_end - sh3_vector_tlbmiss);
+#endif
+#ifdef SH4
if (CPU_IS_SH4)
memcpy(VBR + 0x400, sh4_vector_tlbmiss,
sh4_vector_tlbmiss_end - sh4_vector_tlbmiss);
-
+#endif
memcpy(VBR + 0x600, sh_vector_interrupt,
sh_vector_interrupt_end - sh_vector_interrupt);
@@ -300,8 +306,15 @@ sh_startup()
printf("general exception handler:\t%d byte\n",
sh_vector_generic_end - sh_vector_generic);
printf("TLB miss exception handler:\t%d byte\n",
- CPU_IS_SH3 ? sh3_vector_tlbmiss_end - sh3_vector_tlbmiss :
- sh4_vector_tlbmiss_end - sh4_vector_tlbmiss);
+#if defined(SH3) && defined(SH4)
+ CPU_IS_SH3 ? sh3_vector_tlbmiss_end - sh3_vector_tlbmiss :
+ sh4_vector_tlbmiss_end - sh4_vector_tlbmiss
+#elif defined(SH3)
+ sh3_vector_tlbmiss_end - sh3_vector_tlbmiss
+#elif defined(SH4)
+ sh4_vector_tlbmiss_end - sh4_vector_tlbmiss
+#endif
+ );
printf("interrupt exception handler:\t%d byte\n",
sh_vector_interrupt_end - sh_vector_interrupt);
#endif /* DEBUG */