I use a physical device, not a vicual one.
Here are the information. 
# cat /proc/cpuinfo 
system type             : Atheros AR934x
processor               : 0
cpu model               : MIPS 74Kc V4.12
BogoMIPS                : 279.55
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 4, address/irw mask: [0x0000, 0x0ff8, 
0x0ff8, 0x0ff8]
ASEs implemented        : mips16 dsp
shadow register sets    : 1
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available


 
From: Dave Barach (dbarach)
Date: 2017-03-20 19:56
To: 薛欣颖; vpp-dev
Subject: RE: RE: [vpp-dev] problems in mips32
Perhaps someone in the community can help you. I have neither cycles nor 
equipment available to work on the problem. Just to ask: what kind of hardware 
are you using, or are you using a qemu model?
 
From: 薛欣颖 [mailto:[email protected]] 
Sent: Sunday, March 19, 2017 11:18 PM
To: Dave Barach (dbarach) <[email protected]>; vpp-dev <[email protected]>
Subject: Re: RE: [vpp-dev] problems in mips32
 
 
 
According to your suggestion,I re-write "clib_calljmp" in longjmp.S,and it also 
passes test_longjmp.c;but it doesn't work in vpp, still segmentation fault when 
excute a system call.

At last time, I saving return address(ra) and old stack-pointer(old sp) in 
register s6 and s7, this time I saved them in new stack.

I don't think Ra and old stack is the key of the question, becuase the function 
crashes before it returns. 

Here is the code;

.text
.global clib_calljmp
.align 4;
.ent clib_calljmp,0;
.type clib_calljmp,@function
clib_calljmp:

    move $10, $29                                           //sp->t2  backup 
old sp       
    li   $9, 4                                                       //t1 = 4
    subu $8, $6, $9                   //t0 = a2 - t1 new sp -4
    move $29, $8                                             //t0->sp  write 
new sp in register sp
    
    addiu $29,$29,-8
    sw   $31,4($29)                   //push ra
    sw   $10,0($29)                   //push old stack       

                        move $25, $4                                     
//a0->t9 new function
                        move $4, $5                                             
      //a1->a0 new function arg
    jalr $25                                                                   
//jump
    nop

    lw   $31,4($29)                   //pop ra   
    lw   $29,0($29)                   //pop old stack
    jr   $31                                                                    
//return
            .end     clib_calljmp;

 
Regards,
Xinying Xue
 
From: Dave Barach (dbarach)
Date: 2017-03-16 21:03
To: 薛欣颖; vpp-dev
Subject: RE: [vpp-dev] problems in mips32
Please make sure that src/vppinfra/test_longjmp.c passes before you move on. 
You’ve undoubtedly pickled the stack and/or one or more of the registers. 
Clib_calljmp is always the source of subsequent issues. 
 
The code you wrote belongs in longjmp.S. Trying to write clib_calljmp(...) in C 
/ doing the dirty work in an asm volatile makes it all but inevitable that GCC 
will get in the way.   
 
Even though it’s been a long time since I wrote MIPS assembler code: I don’t 
see where you’re saving clib_calljmp’s return address and old stack-pointer on 
the new stack.  
 
If you expect people to even try to help you with assembly code, comments are 
essential. 
 
Thanks… Dave
 
From: [email protected] [mailto:[email protected]] On 
Behalf Of ???
Sent: Wednesday, March 15, 2017 9:52 PM
To: vpp-dev <[email protected]>
Subject: [vpp-dev] problems in mips32
 
 
Guys,
 
I'm looking forward to run vpp in mips32 arch,but problem was caused by 
"clib_calljmp","clib_setjmp" and "clib_longjmp". There is no code for mips32 in 
vpp, so I wrote them by myself, and they worked very well in my test program, 
However,when I run vpp with them, segmentation fault was happend when excute a 
system call like "open","SYS_clock_gettime",etc.

The "stack" in "clib_calljmp" was alloced by "clib_mem_alloc_aligned", It is 
strange that if I did not use "clib_mem_alloc_aligned" but with "malloc", the 
problem is still there but less happened. Sometimes it occurs, but sometimes 
it's ok.

Here is the code I worte for mips32.

uword clib_calljmp (uword (*func) (uword func_arg), uword func_arg, void *stack)
{
     unsigned long ret=0;
     __asm__ volatile (
        ".set push \n" 
        "move $23, $29\n" 
        "li   $9, 4\n\t"
        "subu $8, %3, $9\n\t"
        "sll  $8, $8, 0\n\t"
        "move $29, $8\n\t"
        "move $9, %1\n\t"  
        "move $4, %2\n\t" 
        "move $25,$9\n\t"
        "move $22, $31\n\t"  
        "jalr.hb $25\n\t" 
        "nop\n\t"
                     "move %0, $2\n\t"
        "move $29,$23\n"
        "move $31, $22\n\t"   
        ".set pop\n" 
        :"=r"(ret)
        :"r"(func),"r"(func_arg),"r"(stack)
        :"$8","$9","$23","$22"
        );
                                             return ret;
}





Thanks,
Xinying Xue
 
_______________________________________________
vpp-dev mailing list
[email protected]
https://lists.fd.io/mailman/listinfo/vpp-dev

Reply via email to