Hi Steve --

" The M100 during normal operation isn't in disabled state."

Right. Otherwise, interrupts would be broken.

"In fact I am relying on the TIMER hook to enable all those functions of
REX -* so the timer hook has to happen."*

Not sure I understand what you're saying.

The code you showed in the first post proves that dispatch of hooks is not
atomic and it's not protected from interrupt.

It could be made atomic by adding DI/SI or maybe using a different
instruction but we can't because it's ROM code.

However, I think that to address that, all you should have to do is DI/SI
around the hook install, as Philip suggested

In fact I think what you've proven is to safely install a hook you MUST
DI/SI around the hook install.

Once you "DI" then that should mean

a) That implies it's your code doing the DI, so it's your code is running,
not the timer hook dispatch code.
b) the timer hook dispatch code will not be able to run until you SI

Walking back the stack is fraught... I think I've seen cases where it's
necessary but they are very rare and it's hard to make it work.

So I guess I'm asking, are you sure that protecting the hook install point
doesn't fix the issue for you? It definitely seems like it should.

Guess I better go fix SET_HOOK/CLEAR_HOOK macros in HTERM source.

-- John.

Reply via email to