Re: assertion failure with pthreads

Christian Groessler <[email protected]>
Newsgroups gmane.os.netbsd.ports.sh3
Message-ID <[email protected]>
> Christian Groessler wrote:
> > Hi,
> > 
> > I'm trying to implement the missing bits in libpthread. Now I'm at a
> > point where more often than not I get a kernel panic:
> > 
> > panic: kernel debugging assertion "!(l1 != curlwp && l1 != &lwp0)" failed: file "../../../../arch/sh3/sh3/vm_machdep.c", line 104
> > Stopped in pid 283.1 (sem) at   cpu_Debugger+0x6:       mov     r14, r15
> > 
> > What could be the cause for this?
> > 
> > regards,
> > chris
> > 
> > 
> Have you implemented the files in lib/libpthread/arch/sh3?
> Can you post them here?

I've put it up on
ftp.groessler.org/pub/chris/dreamcast/netbsd/tmp/pthread-sh3.tgz .

Beware, it's not working. When the above panic does not happen,
sa_upcall_userret fails because of a wrong address of the context...

regards,
chris



PS: that's the test program I use:

#include <assert.h>
#include <err.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void *threadfunc(void *arg);

pthread_mutex_t mutex;

int
main(int argc, char *argv[])
{
        int x,ret;
	pthread_t new;
	printf("now start... (main = %p)\n", main); fflush(stdout);

        ret = pthread_create(&new, NULL, threadfunc, &x);
	printf("pthread create returned...\n"); fflush(stdout);
        if (ret != 0)
                err(1, "pthread_create");

	while (2) {
		printf("still in main thread\n");
		sleep(2);
	}
}

void *
threadfunc(void *arg)
{
	printf("...entering threadfunc...\n"); fflush(stdout);
	/*dumpiter();*/
	while (1) {
		printf("in 2nd thread\n");
		sleep(1);
	}
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.