I don't think that works. Look:
main code interrupt
set k0 to zero
load A from addr
store B at addr
set k0 to zero
load B from addr
store C at addr
return (i assume this makes k0 non-zero)
k0 is non-zero, so loop again
load C from addr
store B at addr
And you've lost the original A. I came up with a similar scheme while
taking a long walk today (many people seem to prefer the shower for their
good ideas. I find Japanese stroll gardens are ideal, and a nice long
walk is almost as good.)
The idea is to flag whether we're in the middle of an xchg operation in
a register such as k0, then have the interrupt handler's exit routine fix
it up:
move k0, one
lw A, addr
sw B. addr
move k0, zero
would then be the typical non-interrupted case.
The modified interrupt code looks like:
int xchging = (k0 == 1);
... normal irq code ...
if (!xchging)
return;
if (instruction we will return to is a store)
return to addr - 4;
return;
This should work, and have a minimal cost per interrupt.
Now to find out whether we have a suitable register on PA-RISC..
-- Matthew Wilcox <willy@bofh.ai> "Windows and MacOS are products, contrived by engineers in the service of specific companies. Unix, by contrast, is not so much a product as it is a painstakingly compiled oral history of the hacker subculture." - N Stephenson- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/