2010-10-30 11:24:29     vfork() fails at BF561

Document created by Aaronwu Employee on Aug 23, 2013
Version 1Show Document
  • View in full screen mode

2010-10-30 11:24:29     vfork() fails at BF561

Fisher Ho (TAIWAN)

Message: 95414   

 

Hi Sirs,

 

 

 

         I simply wrote a program fork_test.c to test vfork() on BF561 development board.

 

 

 

#include <stdio.h>

#include <stdlib.h>

#include <unistd.h>

 

int main(int argc, char *argv[])

{  

    pid_t pid;

    if ((pid = vfork()) < 0 )

    {

        printf ("fork failed with error code= %d\n", pid);      

    }

 

    return 0;

}

 

 

 

And I use bfin-linux-uclibc-gcc -Wall fork_Test.c to compile it. No message showed. It passed.

 

 

 

But it crashed when running. Is there any problem?

 

root:/> ./a.out

Undefined instruction

<5> - May be used to emulate instructions that are not defined for

<5>   a particular processor implementation.

Deferred Exception context

CURRENT PROCESS:

COMM=a.out PID=157  CPU=0

TEXT = 0x02409000-0x0240973c        DATA = 0x0240a73c-0x0240a8a0

BSS = 0x0240a8a0-0x02420000  USER-STACK = 0x0243fec0

 

return address: [0x0243ff62]; contents of:

0x0243ff40:  000e  0000  0000  0000  0017  0000  0000  0000

0x0243ff50:  001f  0000  fff4  0001  0000  0000  0000  0000

0x0243ff60:  0000 [0002] 0000  0241  0000  0000  4b38  0000

0x0243ff70:  eb38  0240  5b38  0000  0268  0000  0000  0000

 

ADSP-BF561-0.3(Detected 0.5) 600(MHz CCLK) 100(MHz SCLK) (mpu off)

Linux version 2.6.34.5-ADI-2010R1-pre-svn9094 (fisher@fisher-desktop) (gcc versi

on 4.3.5 (ADI-trunk/svn-4697) ) #80 Wed Oct 27 12:45:20 CST 2010

 

SEQUENCER STATUS:               Not tainted

SEQSTAT: 00000021  IPEND: 0008  IMASK: ffff  SYSCFG: 0006

  EXCAUSE   : 0x21

  physical IVG3 asserted : <0xffa00954> { _trap + 0x0 }

RETE: <0x00000000> /* Maybe null pointer? */

RETN: <0x02402000> /* kernel dynamic memory */

RETX: <0x00000480> /* Maybe fixed code section */

RETS: <0x0243ff60> [ a.out + 0x1ff60 ]

PC  : <0x0243ff62> [ a.out + 0x1ff62 ]

DCPLB_FAULT_ADDR: <0x0248c0a4> [ /lib/libc.so.0 + 0xc0a4 ]

ICPLB_FAULT_ADDR: <0x0243ff62> [ a.out + 0x1ff62 ]

PROCESSOR STATE:

R0 : 00000000    R1 : 0243fec4    R2 : 0243fecc    R3 : 0000c0a4

R4 : 00000001    R5 : 0243ff80    R6 : 0243ff60    R7 : 0243ffa4

P0 : 000000be    P1 : 0248c0a4    P2 : 0240528c    P3 : 024d9240

P4 : 024055a8    P5 : 024d9240    FP : 0243ffa4    SP : 02401f24

LB0: 024145cf    LT0: 024145ce    LC0: 00000000

LB1: 02413ffb    LT1: 02413ff8    LC1: 00000000

B0 : 00000137    L0 : 00000000    M0 : fffffffc    I0 : 0243ff48

B1 : 000000c0    L1 : 00000000    M1 : 00000001    I1 : 02409738

B2 : 7ffff000    L2 : 00000000    M2 : 00001802    I2 : 00000003

B3 : 00000000    L3 : 00000000    M3 : 0000005b    I3 : 00000006

A0.w: 00000000   A0.x: 00000000   A1.w: 00000000   A1.x: 00000000

USP : 0243fe00  ASTAT: 02003044

 

Hardware Trace:

   0 Target : <0x00003fb8> { _trap_c + 0x0 }

     Source : <0xffa008e8> { _exception_to_level5 + 0xa4 } CALL pcrel

   1 Target : <0xffa00844> { _exception_to_level5 + 0x0 }

     Source : <0xffa006f8> { _bfin_return_from_exception + 0x20 } RTX

   2 Target : <0xffa006d8> { _bfin_return_from_exception + 0x0 }

     Source : <0xffa0079c> { _ex_trap_c + 0x74 } JUMP.S

   3 Target : <0xffa00728> { _ex_trap_c + 0x0 }

     Source : <0xffa009bc> { _trap + 0x68 } JUMP (P4)

   4 Target : <0xffa00972> { _trap + 0x1e }

     Source : <0xffa0096e> { _trap + 0x1a } IF CC JUMP pcrel

   5 Target : <0xffa00954> { _trap + 0x0 }

      FAULT : <0x0243ff62> [ a.out + 0x1ff62 ] 0x0002

     Source : <0x0243ff60> [ a.out + 0x1ff60 ] NOP

   6 Target : <0x0243ff60> [ a.out + 0x1ff60 ]

     Source : <0x024096a4> [ /a.out + 0x6a4 ] RTS

   7 Target : <0x0240969e> [ /a.out + 0x69e ]

     Source : <0x0240968e> [ /a.out + 0x68e ] IF !CC JUMP pcrel

   8 Target : <0x02409688> [ /a.out + 0x688 ]

     Source : <0x0248c0aa> [ /lib/libc.so.0 + 0xc0aa ] RTS

   9 Target : <0x0248c0aa> [ /lib/libc.so.0 + 0xc0aa ]

     Source : <0xffa00eba> { __common_int_entry + 0xda } RTI

  10 Target : <0xffa00e58> { __common_int_entry + 0x78 }

     Source : <0xffa0129c> { _evt_system_call + 0x64 } JUMP.S

  11 Target : <0xffa0129c> { _evt_system_call + 0x64 }

     Source : <0xffa00b4a> { _system_call + 0xbe } RTS

  12 Target : <0xffa00b46> { _system_call + 0xba }

     Source : <0xffa00b36> { _system_call + 0xaa } IF !CC JUMP pcrel

  13 Target : <0xffa00b2c> { _system_call + 0xa0 }

     Source : <0xffa00b1c> { _system_call + 0x90 } IF !CC JUMP pcrel

  14 Target : <0xffa00af6> { _system_call + 0x6a }

     Source : <0xffa000f0> { _sys_vfork + 0x10 } RTS

  15 Target : <0xffa000ec> { _sys_vfork + 0xc }

     Source : <0x00001980> { _bfin_vfork + 0x1c } RTS

Userspace Stack

Stack info:

SP: [0x0243fe00] <0x0243fe00> [ a.out + 0x1fe00 ]

FP: (0x0243fec8)

Memory from 0x0243fe00 to 02440000

0243fe00:[00000001] 0243fec4  00000000  00000000  00000000  00000000  00000000

00000000

0243fe20: 00000000  00000003  02409034  00000004  00000020  00000005  00000006

00000006

0243fe40: 00001000  00000007  02410000  00000008  00000000  00000009  024093f4

00000000

0243fe60: 00000000  0000000b  00000000  0000000c  00000000  0000000d  00000000

0000000e

0243fe80: 00000000  00000000  02409422  0240ec08  024093f4  0240ebf0  0243ff60

0243ff80

0243fea0: 024093f8  024055a8  0243ff60  0243fec4  024055b8  024055b0  0240ebf0

0243ff8c

0243fec0: 00000001  0243ffa4 (00000000)<0243ffac> 0243ffb7  0243ffda  0243ffee

00000000

0243fee0: 00000010  00000000  00000006  00001000  00000011  00000064  00000003

02409034

0243ff00: 00000004  00000020  00000005  00000006  00000007  02410000  00000008

00000000

0243ff20: 00000009  024093f4  0000000b  00000000  0000000c  00000000  0000000d

00000000

0243ff40: 0000000e  00000000  00000017  00000000  0000001f  0001fff4  00000000

00000000

0243ff60: 00020000  02410000  00000000  00004b38  0240eb38  00005b38  00000268

00000000

0243ff80: 00020000  02409000  00000000  0000073c  0240a73c  0000173c  00000164

00000000

0243ffa0: 00000000  2e612f2e  0074756f  4d524554  6e696c3d  50007875  3d485441

6e69622f

0243ffc0: 73752f3a  69622f72  732f3a6e  3a6e6962  7273752f  6962732f  5548006e

565f4853

0243ffe0: 49535245  313d4e4f  2e36312e  57500032  002f3d44  2e612f2e  0074756f

00000000

Return addresses in stack:

   frame  1 : <0x0243ffac> [ a.out + 0x1ffac ]

ILL

root:/>

TranslateQuoteReplyEditDelete

 

 

2010-11-01 02:17:23     Re: vfork() fails at BF561

Aaron Wu (CHINA)

Message: 95433   

 

What do you want to do with your test code?  Generally you fork a new process, do sth and exit, I tried on your code like this and it works fine, the print run twice in both parent and child and then exit.

 

bfin-linux-uclibc-gcc vfork_test.c -o vfork_test.o

 

int main()

{

    pid_t pid;

    if ((pid = vfork()) < 0 )

    {

                printf ("fork failed \n");

    }

 

        printf ("111 \n");

        sleep(1);

        printf ("222 \n");

        sleep(2);

 

 

         _exit (0);

}

QuoteReplyEditDelete

 

 

2010-11-01 08:08:35     Re: vfork() fails at BF561

Fisher Ho (TAIWAN)

Message: 95443   

 

Oh my God, I forgot to terminate calling process

 

 

 

      _exit(0);

 

 

 

Thank you for your kindly reply.

 

I am not familiar with multi-process coding...QQ

Attachments

    Outcomes