Mail Archives: djgpp/1998/12/18/08:12:44
A follow the last thread on task switching since I'm involved in writing a
real-time multi-thread enviroment running on PC based embedded HW.
It is possible/reasonable to use the following approach ?
- DPMI at ring 0 with virtual memory disable, as CWSDPR0, that do not
switch stack on HW interrupt
- Write a custom routine to install raw protected-mode interrupt handlers
directly in the CPU Interrupt Table (get IDT base address, translate to
logical, change the required slot). Of course, the handler must be written
in assembler
- Install a raw interrupt handler to manage the timer interrupt and use
this handler to change stack (only SP) by changing the return address of
the intr handler (writing onto the stack) to a routine that perform the
stack switching. The IRET will return to the dispatcher instead of the
interrupted point. The dispatched change stack and RET to the new thread or
simple RET to the old thread
(I'm writing the code - the cooperative task switching just work - but it
is not yet ready to run)
Thanks, Alberto.
- Raw text -