diff --git a/stix/kernel/Collection.st b/stix/kernel/Collect.st similarity index 100% rename from stix/kernel/Collection.st rename to stix/kernel/Collect.st diff --git a/stix/kernel/Stix.st b/stix/kernel/Stix.st index a44d889..915a768 100644 --- a/stix/kernel/Stix.st +++ b/stix/kernel/Stix.st @@ -246,8 +246,7 @@ } -#include 'Collection.st'. -## #include 'Collec~1.st'. +#include 'Collect.st'. #class(#pointer) CompiledMethod(Object) { diff --git a/stix/kernel/test-010.st b/stix/kernel/test-010.st index e463ef3..f79d1e1 100644 --- a/stix/kernel/test-010.st +++ b/stix/kernel/test-010.st @@ -58,13 +58,13 @@ s2 := Semaphore new. t1 := [ - 10000 timesRepeat: ['BLOCK #1' dump]. + 100 timesRepeat: ['BLOCK #1' dump]. ##s2 critical: [ ## 10 timesRepeat: ['BLOCK #1' dump ] ##] ] newProcess. t2 := [ - 10000 timesRepeat: ['BLOCK #2' dump]. + 100 timesRepeat: ['BLOCK #2' dump]. ##s2 critical: [ ## 10 timesRepeat: ['BLOCK #2' dump. ] ##]. diff --git a/stix/lib/exec.c b/stix/lib/exec.c index 66d7ba4..2be9714 100644 --- a/stix/lib/exec.c +++ b/stix/lib/exec.c @@ -90,6 +90,7 @@ #define LOAD_ACTIVE_SP(stix) LOAD_SP(stix, (stix)->processor->active) #define STORE_ACTIVE_SP(stix) STORE_SP(stix, (stix)->processor->active) +/* TODO: stack bound check when pushing */ #define ACTIVE_STACK_PUSH(stix,v) \ do { \ (stix)->sp = (stix)->sp + 1; \ diff --git a/stix/lib/main.c b/stix/lib/main.c index a175934..b23b765 100644 --- a/stix/lib/main.c +++ b/stix/lib/main.c @@ -45,7 +45,7 @@ # define INCL_DOSERRORS # include #elif defined(__MSDOS__) - /* nothing to include */ +# include #elif defined(macintosh) /* nothing to include */ #else @@ -386,14 +386,39 @@ stix_ooch_t str_main[] = { 'm', 'a', 'i', 'n' }; stix_t* g_stix = STIX_NULL; +#if defined(__MSDOS__) && defined(_INTELC32_) +static void (*prev_timer_intr_handler) (void); + +#pragma interrupt(timer_intr_handler) +static void timer_intr_handler (void) +{ + /* + _XSTACK *stk; + int r; + stk = (_XSTACK *)_get_stk_frame(); + r = (unsigned short)stk_ptr->eax; + */ + + /* The timer interrupt (normally) occurs 18.2 times per second. */ + if (g_stix) stix_switchprocess (g_stix); + _chain_intr(prev_timer_intr_handler); +} + +#else static void arrange_process_switching (int sig) { if (g_stix) stix_switchprocess (g_stix); } +#endif static void setup_tick (void) { -#if defined(HAVE_SETITIMER) && defined(SIGVTALRM) && defined(ITIMER_VIRTUAL) +#if defined(__MSDOS__) && defined(_INTELC32_) + + prev_timer_intr_handler = _dos_getvect (0x1C); + _dos_setvect (0x1C, timer_intr_handler); + +#elif defined(HAVE_SETITIMER) && defined(SIGVTALRM) && defined(ITIMER_VIRTUAL) struct itimerval itv; struct sigaction act; @@ -407,12 +432,19 @@ static void setup_tick (void) itv.it_value.tv_sec = 0; itv.it_value.tv_usec = 100; setitimer (ITIMER_VIRTUAL, &itv, STIX_NULL); +#else + +# error UNSUPPORTED #endif } static void cancel_tick (void) { -#if defined(HAVE_SETITIMER) && defined(SIGVTALRM) && defined(ITIMER_VIRTUAL) +#if defined(__MSDOS__) && defined(_INTELC32_) + + _dos_setvect (0x1C, prev_timer_intr_handler); + +#elif defined(HAVE_SETITIMER) && defined(SIGVTALRM) && defined(ITIMER_VIRTUAL) struct itimerval itv; struct sigaction act; @@ -427,6 +459,9 @@ static void cancel_tick (void) act.sa_handler = SIG_DFL; act.sa_flags = 0; sigaction (SIGVTALRM, &act, STIX_NULL); + +#else +# error UNSUPPORTED #endif } diff --git a/stix/lib/stix-prv.h b/stix/lib/stix-prv.h index 03b38bf..33df748 100644 --- a/stix/lib/stix-prv.h +++ b/stix/lib/stix-prv.h @@ -54,7 +54,7 @@ /* this is for gc debugging */ /*#define STIX_DEBUG_PROCESSOR*/ -#define STIX_DEBUG_GC_001 +/*#define STIX_DEBUG_GC_001*/ /*#define STIX_DEBUG_GC_002*/ #define STIX_DEBUG_COMP_001 /*#define STIX_DEBUG_COMP_002*/