Thanks for patch. It fixed issue for my test program. Also error does not occur if thread created with attribute PTHREAD_CREATE_DETACHED. But if thread detached in main then i have same error.
#include <stdio.h>
#include <string.h>
#include <pthread.h>
void *thread(void* arg)
{
int num = (int)arg;
printf("Start thread %d\n", num);
usleep(5000*num);
printf("End thread %d\n", num);
return 0;
}
int main(int argc, char* argv[])
{
pthread_t t1, t2;
int res;
printf("Test pthread\n");
while(1) {
printf("new loop...\n");
pthread_create(&t1, NULL, thread, (void*)1);
res = pthread_detach(&t1);
printf("Detach thread 1 (%d)\n", res);
pthread_create(&t2, NULL, thread, (void*)2);
res = pthread_detach(&t2);
printf("Detach thread 2 (%d)\n", res);
usleep(100000);
}
return 0;
}
Starting kernel ...
L4 Bootstrapper
Build: #8 Птн Сен 16 12:21:37 MSD 2011, 4.4.1
Scanning up to 128 MB RAM
Memory size is 128MB (80000000 - 88000000)
RAM: 0000000080000000 - 0000000087ffffff: 131072kB
Total RAM: 128MB
mod04: 810c5000-810e7938: pthread_test
mod03: 810aa000-810c439c: l4re
mod02: 8106f000-810a9b50: moe
mod01: 81065000-8106e70c: sigma0
mod00: 81015000-81064f74: fiasco
Moving 5 modules to 81100000 with offset eb000
moving module 05 { 810c5000-810e7938 } -> { 811b0000-811d2938 }
moving module 04 { 810aa000-810c439c } -> { 81195000-811af39c }
moving module 03 { 8106f000-810a9b50 } -> { 8115a000-81194b50 }
moving module 02 { 81065000-8106e70c } -> { 81150000-8115970c }
moving module 01 { 81015000-81064f74 } -> { 81100000-8114ff74 }
Scanning fiasco
Scanning sigma0
Scanning moe --init=rom/pthread_test
Relocated mbi to [0x8100f000-0x8100f0e4]
Loading fiasco
Loading sigma0
Loading moe
find kernel info page...
found kernel info page at 0x80002000
Regions of list regions
[ 80001000, 800019ff] { a00} Kern fiasco
[ 80002000, 80061fff] { 60000} Kern fiasco
[ 80090000, 800969bf] { 69c0} Sigma0 sigma0
[ 80098000, 8009e17b] { 617c} Sigma0 sigma0
[ 80140000, 801761f3] { 361f4} Root moe
[ 80178000, 8018ed0f] { 16d10} Root moe
[ 81000000, 810143eb] { 143ec} Boot bootstrap
[ 8100f000, 8100f1e1] { 1e2} Root Multiboot info
[ 81195000, 811d2937] { 3d938} Root Modules Memory
API Version: (87) experimental
Sigma0 config ip:800900e0 sp:81013704
Roottask config ip:801401c0 sp:00000000
Starting kernel fiasco at 80001000
Hello from Startup::stage2
Initialize page table
Vmem_alloc::init()
Cache config: ON
ID_PFR0: 00001031
ID_PFR1: 00000011
ID_DFR0: 00010400
ID_AFR0: 00000000
ID_MMFR0: 31100003
ID_MMFR1: 20000000
ID_MMFR2: 01202000
ID_MMFR3: 00000011
FPU0: Arch: VFPv3(3), Part: VFPv3(30), r: 1, v: c, i: 41, t: hard, p: dbl/sngl
Welcome to Fiasco.OC (arm)!
L4/Fiasco.OC arm microkernel (C) 1998-2011 TU Dresden
Rev: rUNKNOWN compiled with gcc 4.4.1 for Beagleboard []
Build: #1 Птн Сен 16 11:07:29 MSD 2011
Calibrating timer loop... done.
SIGMA0: Hello!
KIP @ 80002000
allocated 4KB for maintenance structures
SIGMA0: Dump of all resource maps
RAM:------------------------
[0:80000000;80000fff]
[0:80062000;8008ffff]
[0:80097000;80097fff]
[0:8009f000;8013ffff]
[4:80140000;80176fff]
[0:80177000;80177fff]
[4:80178000;8018efff]
[0:8018f000;8100efff]
[4:8100f000;8100ffff]
[0:81010000;81194fff]
[4:81195000;811d2fff]
[0:811d3000;86ffffff]
IOMEM:----------------------
[0:0;7fffffff]
[0:88000000;ffffffff]
MOE: Hello world
MOE: found 113680 KByte free memory
MOE: found RAM from 80000000 to 87000000
MOE: allocated 112 KByte for the page array @0x80062000
MOE: virtual user address space [0-bfffffff]
MOE: rom name space cap -> [C:501000]
BOOTFS: [81195000-811af39c] [C:503000] l4re
BOOTFS: [811b0000-811d2938] [C:504000] pthread_test
MOE: cmdline: moe --init=rom/pthread_test
MOE: Starting: rom/pthread_test
MOE: loading 'rom/pthread_test'
Test pthread
new loop...
L4Re[rm]: unhandled read page fault @800080d4 pc=10048fc
L4Re: unhandled exception: pc=0x10048fc
Start thread 1
End thread 1