diff -cr kaffe.old/config/i386/oskit/md.c kaffe/config/i386/oskit/md.c *** kaffe.old/config/i386/oskit/md.c Wed Jan 13 08:49:39 1999 --- kaffe/config/i386/oskit/md.c Wed Mar 31 16:43:41 1999 *************** *** 21,27 **** #include #include ! #include #include #include #include --- 21,27 ---- #include #include ! #include #include #include #include *************** *** 72,78 **** /* * Real OSKIT kernel. */ ! fs_init(oskit_bmod_init()); osenv_process_lock(); oskit_linux_init_devs(); oskit_dev_probe(); --- 72,78 ---- /* * Real OSKIT kernel. */ ! fs_init(start_fs_bmod()); osenv_process_lock(); oskit_linux_init_devs(); oskit_dev_probe(); diff -cr kaffe.old/kaffe/kaffevm/mem/gc-block-mmap.c kaffe/kaffe/kaffevm/mem/gc-block-mmap.c *** kaffe.old/kaffe/kaffevm/mem/gc-block-mmap.c Wed Dec 30 12:38:50 1998 --- kaffe/kaffe/kaffevm/mem/gc-block-mmap.c Wed Mar 10 16:41:04 1999 *************** *** 43,49 **** --- 43,53 ---- #else /* In a sense, this is backwards. */ #define ALL_PROT PROT_READ|PROT_WRITE|PROT_EXEC + #ifndef PROT_NONE + #define NO_PROT 0 + #else #define NO_PROT PROT_NONE + #endif #endif /* Get some page-aligned memory from the system. */ diff -cr kaffe.old/kaffe/kaffevm/systems/oskit-pthreads/pjthread.c kaffe/kaffe/kaffevm/systems/oskit-pthreads/pjthread.c *** kaffe.old/kaffe/kaffevm/systems/oskit-pthreads/pjthread.c Tue Jan 12 19:05:31 1999 --- kaffe/kaffe/kaffevm/systems/oskit-pthreads/pjthread.c Wed Mar 10 16:54:46 1999 *************** *** 48,53 **** --- 48,54 ---- pthread_key_t cookie_key; /* key to map pthread -> Hjava_lang_Thread */ pthread_key_t jthread_key; /* key to map pthread -> jthread */ + pthread_key_t cleanups_key; /* * Function declarations. *************** *** 135,162 **** { struct pthread_state ps; ! if (pthread_getstate(jtid->native_thread, &ps)) panic("jthread_extract_stack: tid(%d)", jtid->native_thread); #if defined(STACK_GROWS_UP) #error FIXME #else - #if notyet *from = (void *)ps.stackptr; ! *len = ps.stackbase + ps.stacksize - ps.stackptr; ! #else ! *from = (void *)ps.stackptr; ! *len = ps.stackbase - ps.stackptr; /* base is top XXX */ ! ! if (*len < 0 || *len > (256*1024)) { ! panic("(%d) pthread_getstate(%d) reported obscene numbers: " ! "base = 0x%x, sp = 0x%x\n", ! pthread_self(), ! jtid->native_thread, ! ps.stackbase, ps.stackptr); ! exit(-1); ! } ! #endif #endif DBG(JTHREAD, dprintf("extract_stack(%) base=%p size=%d sp=%p; from=%p len=%d\n", --- 136,149 ---- { struct pthread_state ps; ! if (oskit_pthread_getstate(jtid->native_thread, &ps)) panic("jthread_extract_stack: tid(%d)", jtid->native_thread); #if defined(STACK_GROWS_UP) #error FIXME #else *from = (void *)ps.stackptr; ! *len = (ps.stackbase + ps.stacksize) - ps.stackptr; #endif DBG(JTHREAD, dprintf("extract_stack(%) base=%p size=%d sp=%p; from=%p len=%d\n", *************** *** 174,188 **** struct pthread_state ps; int rc; ! if (pthread_getstate(pthread_self(), &ps)) ! panic("jthread_on_current_stack: pthread_getstate(%d)", pthread_self()); ! #if notyet rc = (uint32)bp >= ps.stackbase && (uint32)bp < ps.stackbase + ps.stacksize; ! #else ! rc = (uint32)bp < ps.stackbase; /* base is top XXX */ ! #endif DBG(JTHREAD, dprintf("on current stack(%d) base=%p size=%d bp=%p %s\n", pthread_self(), --- 161,173 ---- struct pthread_state ps; int rc; ! if (oskit_pthread_getstate(pthread_self(), &ps)) ! panic("jthread_on_current_stack: oskit_pthread_getstate(%d)", pthread_self()); ! rc = (uint32)bp >= ps.stackbase && (uint32)bp < ps.stackbase + ps.stacksize; ! DBG(JTHREAD, dprintf("on current stack(%d) base=%p size=%d bp=%p %s\n", pthread_self(), *************** *** 191,196 **** --- 176,182 ---- return rc; } + /* * See if there is enough room on the stack. */ *************** *** 199,213 **** { struct pthread_state ps; int room; ! if (pthread_getstate(pthread_self(), &ps)) ! panic("jthread_stackcheck: pthread_getstate(%d)", pthread_self()); #if defined(STACK_GROWS_UP) # error FIXME #else ! room = ps.stacksize - (ps.stackbase - ps.stackptr); #endif DBG(JTHREAD, --- 185,204 ---- { struct pthread_state ps; int room; + int tid = pthread_self(); ! if (oskit_pthread_getstate(tid, &ps)) ! panic("jthread_stackcheck: oskit_pthread_getstate(%d)", pthread_self()); #if defined(STACK_GROWS_UP) # error FIXME #else ! if (ps.stackbase > ps.stackptr) { ! panic("stackptr (%x) is higher than stackbase (%x)!, tid = %d", ! tid, ps.stackptr, ps.stackbase); ! } ! room = ps.stackptr - ps.stackbase; #endif DBG(JTHREAD, *************** *** 250,255 **** --- 241,247 ---- { pthread_t pmain; jthread_t jtid; + pthread_cleanup_t *pc; max_priority = maxpr; min_priority = minpr; *************** *** 265,280 **** * XXX: ignore mapping of min/max priority for now and assume * pthread priorities include java priorities */ ! pthread_setprio(pmain, mainthreadpr); pthread_key_create(&jthread_key, 0 /* destructor */); pthread_key_create(&cookie_key, 0 /* destructor */); jtid = allocator(sizeof (*jtid)); SET_JTHREAD(jtid); jtid->native_thread = pmain; ! pthread_cleanup_push(deathcallback, jtid); jtid->nextlive = liveThreads; liveThreads = jtid; --- 257,277 ---- * XXX: ignore mapping of min/max priority for now and assume * pthread priorities include java priorities */ ! oskit_pthread_setprio(pmain, mainthreadpr); pthread_key_create(&jthread_key, 0 /* destructor */); pthread_key_create(&cookie_key, 0 /* destructor */); + pthread_key_create(&cleanups_key, 0 /* destructor */); jtid = allocator(sizeof (*jtid)); SET_JTHREAD(jtid); jtid->native_thread = pmain; ! ! pc = malloc(sizeof(pthread_cleanup_t)); ! oskit_pthread_cleanup_push(pc, deathcallback, jtid); ! ! pthread_setspecific(cleanups_key, pc); jtid->nextlive = liveThreads; liveThreads = jtid; *************** *** 284,296 **** DBG(JTHREAD, dprintf("main thread has id %d\n", jtid->native_thread); ) return jtid; } /* * set a function to be run when all non-daemon threads have exited */ ! void jthread_atexit(void (*f)(void)) { runOnExit = f; --- 281,294 ---- DBG(JTHREAD, dprintf("main thread has id %d\n", jtid->native_thread); ) + return jtid; } /* * set a function to be run when all non-daemon threads have exited */ ! void jthread_atexit(void (*f)(void)) { runOnExit = f; *************** *** 353,363 **** start_me_up(void *arg) { jthread_t tid = (jthread_t)arg; DBG(JTHREAD, dprintf("starting thread %d\n", tid->native_thread); ) jmutex_lock(&threadLock); ! pthread_cleanup_push(deathcallback, tid); SET_JTHREAD(tid); SET_COOKIE(tid->jlThread); jmutex_unlock(&threadLock); --- 351,367 ---- start_me_up(void *arg) { jthread_t tid = (jthread_t)arg; + pthread_cleanup_t *pc; DBG(JTHREAD, dprintf("starting thread %d\n", tid->native_thread); ) jmutex_lock(&threadLock); ! ! pc = malloc(sizeof(pthread_cleanup_t)); ! oskit_pthread_cleanup_push(pc, deathcallback, tid); ! ! pthread_setspecific(cleanups_key, pc); ! SET_JTHREAD(tid); SET_COOKIE(tid->jlThread); jmutex_unlock(&threadLock); *************** *** 387,393 **** pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, threadStackSize); ! pthread_attr_setprio(&attr, pri); /* * Note that we create the thread in a joinable state, which is the --- 391,397 ---- pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, threadStackSize); ! oskit_pthread_attr_setprio(&attr, pri); /* * Note that we create the thread in a joinable state, which is the *************** *** 433,439 **** void jthread_sleep(jlong time) { ! pthread_sleep((oskit_s64_t)time); } /* --- 437,443 ---- void jthread_sleep(jlong time) { ! oskit_pthread_sleep((oskit_s64_t)time); } /* *************** *** 455,461 **** void jthread_setpriority(jthread_t jtid, int prio) { ! pthread_setprio(jtid->native_thread, prio); } /* --- 459,465 ---- void jthread_setpriority(jthread_t jtid, int prio) { ! oskit_pthread_setprio(jtid->native_thread, prio); } /* *************** *** 530,536 **** /* drop onstop handler if that thread exited by itself */ assert (currentJThread->status != THREAD_DYING); ! pthread_cleanup_pop(0); assert (currentJThread->status != THREAD_DEAD); currentJThread->status = THREAD_DEAD; --- 534,540 ---- /* drop onstop handler if that thread exited by itself */ assert (currentJThread->status != THREAD_DYING); ! oskit_pthread_cleanup_pop(pthread_getspecific(cleanups_key), 0); assert (currentJThread->status != THREAD_DEAD); currentJThread->status = THREAD_DEAD;