[eros-cvs] cvs commit: eros/src/base/sys/kerninc Depend.hxx

shap@eros.cs.jhu.edu shap@eros.cs.jhu.edu
Mon, 19 Nov 2001 22:22:53 -0500


shap        01/11/19 22:22:52

  Modified:    src/base/sys/kernel kern_Depend.cxx
               src/base/sys/kerninc Depend.hxx
  Log:
  Fix the slot tag computation in the depend logic. Thanks to Darren
  Davis for catching this!

Revision  Changes    Path
1.64      +3 -8      eros/src/base/sys/kernel/kern_Depend.cxx

Index: kern_Depend.cxx
===================================================================
RCS file: /cvs/eros/src/base/sys/kernel/kern_Depend.cxx,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- kern_Depend.cxx	2001/06/20 17:01:11	1.63
+++ kern_Depend.cxx	2001/11/20 03:22:52	1.64
@@ -123,9 +123,6 @@
 
   assert(reallyAllowMerge == allowMerge);
 
-  uint32_t slotTag = ((uint32_t) pKey) >> 10;
-  slotTag &= 0xfffffu;		/* 20 bits only! */
-
 #ifdef DEPEND_DEBUG
   MsgLog::printf("Add slot depend entry for slot=0x%08x pte=0x%08x: ",
 	       pKey, pte);
@@ -135,7 +132,7 @@
   KeyDependEntry* entry = &KeyDependTable[whichBucket * KeyBucketSize];
 
   for (uint32_t i = 0; i < KeyBucketSize; i++) {
-    if (entry[i].slotTag == slotTag) {
+    if (entry[i].slotTag == SLOT_TAG(pKey)) {
       PTE *curStart = entry[i].start;
       PTE *curEnd =   entry[i].start + entry[i].pteCount;
 
@@ -212,7 +209,7 @@
     
   entry->start = pte;
   entry->pteCount = 1;
-  entry->slotTag = slotTag;
+  entry->slotTag = SLOT_TAG(pKey);
 
 #ifdef DBG_WILD_PTR
   if (dbg_wild_ptr)
@@ -334,8 +331,6 @@
   KeyDependEntry* bucket
     = &KeyDependTable[whichBucket * KeyBucketSize];
 
-  uint32_t slotTag = ((uint32_t) pKey) >> 10;
-
 #ifdef DBG_WILD_PTR
   if (dbg_wild_ptr)
     if (Check::Contexts("Before really zapping") == false)
@@ -343,7 +338,7 @@
 #endif
 
   for (uint32_t i = 0; i < KeyBucketSize; i++) {
-    if (bucket[i].slotTag == slotTag) {
+    if (bucket[i].slotTag == SLOT_TAG(pKey)) {
       didZap = true;
 
       KeyDependEntry_Invalidate(&bucket[i]);



1.30      +2 -0      eros/src/base/sys/kerninc/Depend.hxx

Index: Depend.hxx
===================================================================
RCS file: /cvs/eros/src/base/sys/kerninc/Depend.hxx,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Depend.hxx	2001/06/10 19:41:51	1.29
+++ Depend.hxx	2001/11/20 03:22:52	1.30
@@ -173,6 +173,8 @@
   uint32_t     slotTag : 20;	/* hash of key address */
 } KeyDependEntry;
 
+#define SLOT_TAG(pKey) ( (((unsigned) pKey) >> 4) & 0xfffffu )
+
 void KeyDependEntry_Invalidate(KeyDependEntry * );
 inline bool KeyDependEntry_InUse(KeyDependEntry const * kde)
 {