Abusing the EFLAGS ID bit
Abusing the EFLAGS ID bit
The other day, I found myself wishing that there were a few "available" bits in the EFLAGS register, just like the bits they were nice enough to leave free for OS use in page table entries, descriptor table entries, etc. I eventually coded a different solution, but while brainstorming for ideas for a quick place to store a flag that would be saved/restored automatically during context and task switches, I briefly toyed with the idea of using the ID bit. You can set it to whatever you want (assuming your processor is new enough to support it), and as far as I know, it doesn't actually affect anything. Is this bit "stable", or does it end up getting clobbered in certain circumstances? Has anyone ever tried this before, or is this just too bizarre to seriously consider?