- // update range to not clear still alive blocks
- for (entry = *blist; entry != NULL; entry = entry->next) {
- block = entry->block;
- if (block->addr > a) {
- if (to > block->addr)
- to = block->addr;
- }
- else {
- if (from < block->end_addr)
- from = block->end_addr;
+ if (from >= to)
+ return;
+
+ // update range around a to match latest state
+ from &= ~(INVAL_PAGE_SIZE - 1);
+ to |= (INVAL_PAGE_SIZE - 1);
+ for (taddr = from; taddr < to; taddr += INVAL_PAGE_SIZE) {
+ i = (taddr & mask) / INVAL_PAGE_SIZE;
+ entry = inval_lookup[tcache_id][i];
+
+ for (; entry != NULL; entry = entry->next) {
+ block = entry->block;
+
+ if (block->addr > a) {
+ if (to > block->addr)
+ to = block->addr;
+ }
+ else {
+ end_addr = block->addr + block->size;
+ if (from < end_addr)
+ from = end_addr;
+ }