TiROS runs within a posix process. This port provides the context switching and time functions to TiROS. It simulates interrupts using posix signals. The posix port does not use kernel traps (They work on Linux but do not work reliably on Cygwin). The signal implementation under Cygwin is such that storing and restoring a context within a signal handler does not work properly. So we bypass this for the Cygwin environment and use direct Win32 api calls. This port has been tested on Linux 2.6.x kernel series/Glibc and on Cygwin 5.1. This port does not work on Mac OS X (as of 10.4), because the needed posix functions are not implemented.
This port does not allow the time to be set.
Currently, this port does not use the user provided stack memory for the task stack. This port stores the context on the user provided memory. For the task stack, it allocates new memory (memory size defined by TIROS_POSIX_STKSZ)
The posix port uses unix/posix signals to fake interrupts. Interrupt handlers are thus signal handlers. The posix port does not use kernel traps (for compatibility). So the form of the ISR must be as follows.
extern int halint_kernel_trap_flagged; // Flag in hal extern uint8_t os_isr_nesting; void signal_handler(int sig) { OS_ISR_BEGIN(); halint_kernel_trap_flagged = 0; // Perform actions xxx(); // Re-enable interrupts if desired if (os_isr_nesting < TIROS_MAX_ISR_NESTING) { OS_INT_ENABLE(); yyy(); } zzz(); // End actions OS_ISR_END(); if (halint_kernel_trap_flagged) { hal_ctxt_switch(); } }