Memory reverse lookup problem
I'm looking for an algorithm (any language) to deal with the following problem:
I have an emulator for an obscure control system. Global variables are stored in a contiguous region of memory. When certain 'hot' globals are referenced, I want to jump to a special routine that accesses I/O instead reading/writing the actual memory assigned to that global. (All variables are accessed by calls to a read or write routine that I can modify, so there is no clever stuff there, and I can tell if it is a global easily since I know the start and end address of the global space.)
In other words, I need some method that, given a particular memory location, will tell me very quickly whether it is one of the 'hot' globals, and if so, which one. There are several hundred globals in total, ranging from single-byte logicals to large arrays. They are not stored in any logical order.
My initial thoughs were some kind of hash table, but I can't see how to apply this, especially given the vastly varying sizes in memory of the different globals.
Can anyone supply any pointers, keywords to look up on Google, etc to help me on my way? I can't imagine this is a completely new problem.
Thanks very much.
Ian