Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sh5/include Add a macro which verifies that a 64-bi...



details:   https://anonhg.NetBSD.org/src/rev/0be429d192f5
branches:  trunk
changeset: 533979:0be429d192f5
user:      scw <scw%NetBSD.org@localhost>
date:      Thu Jul 11 21:21:58 2002 +0000

description:
Add a macro which verifies that a 64-bit value is a valid effective
address as defined by the cpu's Implemented Effective Address bits.

diffstat:

 sys/arch/sh5/include/cpu.h |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r cef1fcbada19 -r 0be429d192f5 sys/arch/sh5/include/cpu.h
--- a/sys/arch/sh5/include/cpu.h        Thu Jul 11 21:21:53 2002 +0000
+++ b/sys/arch/sh5/include/cpu.h        Thu Jul 11 21:21:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.2 2002/07/11 14:10:39 scw Exp $      */
+/*     $NetBSD: cpu.h,v 1.3 2002/07/11 21:21:58 scw Exp $      */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -104,11 +104,26 @@
 #define        SH5_KSEG0_SIZE          0x20000000
 #define        SH5_KSEG1_SIZE          0x20000000
 
-
+/*
+ * Default to NEFF == 32 if port-specific code doesn't define it
+ */
 #ifndef SH5_NEFF_BITS
 #define        SH5_NEFF_BITS 32
 #endif
 
+/*
+ * This hairy macro evaluates true if (register_t)`eff' is a valid
+ * effective address for the CPU's Implemented Effective Address space.
+ */
+#if SH5_NEFF_BITS < 64
+#define        SH5_EFF_IS_VALID(eff)   (((((eff) & (1ULL << 63)) ?     \
+    ((eff) ^ 0xffffffff00000000ULL) : (eff)) &                 \
+       ~((1ULL << SH5_NEFF_BITS) - 1)) == 0)
+#else
+#define        SH5_EFF_IS_VALID(eff)   1       /* Everything's valid in this case */
+#endif
+
+
 #ifndef SH5_ASID_BITS
 #define        SH5_ASID_BITS 8
 #endif



Home | Main Index | Thread Index | Old Index