Mail Archives: djgpp/1995/09/13/20:02:08
Mat Hostetter (mat AT ardi DOT com) wrote:
: ----------------------------------------------------------------------
: void interrupt_memory_start (void) { }
: void my_interrupt_handler (void)
: {
: ...
: }
: void interrupt_memory_end (void) { }
: ----------------------------------------------------------------------
: and then lock:
: (char *) interrupt_memory_end - (char *) interrupt_memory_start
: bytes, starting at:
: (char *) interrupt_memory_start
: Of course, there's no guarantee that this will work (I think even
: casting a function pointer to a char * is forbidden) but it happens to
: be the case that this works with the latest djgpp (just make sure all
: of your functions are non-static).
It will work, casting a function pointer is allowed (just another type of
pointer, nothing special). There are a few other things to watch for.
Make sure you do not compile with optimizations (esp. not -O3) as these
can shift code about. If your interrupt routine uses any static variables
(ie in the data seg) then lock these as well. And a question. Is the
stack locked? (It seems like a funny question to ask, but I can't think
of an answer)
Malcolm
: -Mat
- Raw text -