+static void add_to_hashlist(struct block_entry *be, int tcache_id)
+{
+ u32 tcmask = hash_table_sizes[tcache_id] - 1;
+
+ be->next = HASH_FUNC(hash_tables[tcache_id], be->pc, tcmask);
+ HASH_FUNC(hash_tables[tcache_id], be->pc, tcmask) = be;
+
+#if (DRC_DEBUG & 2)
+ if (be->next != NULL) {
+ printf(" %08x: hash collision with %08x\n",
+ be->pc, be->next->pc);
+ hash_collisions++;
+ }
+#endif
+}
+
+static void rm_from_hashlist(struct block_entry *be, int tcache_id)
+{
+ u32 tcmask = hash_table_sizes[tcache_id] - 1;
+ struct block_entry *cur, *prev;
+
+ cur = HASH_FUNC(hash_tables[tcache_id], be->pc, tcmask);
+ if (cur == NULL)
+ goto missing;
+
+ if (be == cur) { // first
+ HASH_FUNC(hash_tables[tcache_id], be->pc, tcmask) = be->next;
+ return;
+ }
+
+ for (prev = cur, cur = cur->next; cur != NULL; cur = cur->next) {
+ if (cur == be) {
+ prev->next = cur->next;
+ return;
+ }
+ }
+
+missing:
+ dbg(1, "rm_from_hashlist: be %p %08x missing?", be, be->pc);
+}
+