Re: [uCsimm] newbie needing help

From: Phil Wilshire (philw@lineo.com)
Date: Mon Mar 05 2001 - 04:55:06 EST


liu qingyao wrote:
>
> hi all:
> I am a newbie to linux(not only uclinux) and ucsimm,mabey my questions is stupid:

No actually this is a nice question.....

>
> 1 There aren't the good debug tools for ucsimm(really?).The gdb/gdbserver is still puzzling develper(from mail list).So the dump(by platform/68EZ328/traps.c) is very important.But how can I explain the dump format? especially for the "KERNEL STACK" and "USER STACK".

gdbserver should be working. I'll check on this again sometime this
week.

>
> 2 What does the following mean? I have no knowlege about the gcc assambler.
>
> #define vfork() ({ \
> register unsigned long __res __asm__ ("%d0") = __NR_fork; \
> __asm__ __volatile__ ("trap #0" \
> : "=g" (__res) \
> : "0" (__res) \
> : "%d0"); \
> if (__res >= (unsigned long)-4096) { \
> errno = -__res; \
> __res = (pid_t)-1; \
> } \
> (pid_t)__res; \
> })
>
Here is part of the manual

http://gcc.gnu.org/onlinedocs/gcc_5.html#SEC104

Here is part of a full description of the rest of the answer
others please feel free to comment and add information

I create some C code and then compile it and look at the answer.
I can derive a good idea of what is happening from that output

compile with
   m68k-coff-gcc -O2 -S vf.c
  
examine output with
    cat vf.s

======c code =====
#define __NR_fork 0x88
int errno;
#define pid_t long

#define vfork() ({ \
register unsigned long __res __asm__ ("%d0") = __NR_fork; \
__asm__ __volatile__ ("trap #0" \
                      : "=g" (__res) \
                       : "0" (__res) \
                       : "%d0"); \
 if (__res >= (unsigned long)-4096) { \
         errno = -__res; \
         __res = (pid_t)-1; \
 } \
 (pid_t)__res; \
 })

int test ()
{
  int ret;
  ret = vfork();
  return ret;
}

/* assember output
produced by
   m68k-coff-gcc -O2 -S vf.c
   more more vf.s

=======
gcc2_compiled.:
__gnu_compiled_c:
.text
        .even
.globl test
test:
        link.w %a6,#0 save a6 frame pointer
        moveq.l #119,%d0 put 0X88 into d0
        not.b %d0 # dunno what this is
#APP
        trap #0 # this is a software interrupt to
#NO_APP # execute the system call
        cmp.l #-4097,%d0 # we check res with -4096 >=
        jbls .L2 # we are done
        neg.l %d0 # restore d0
        move.l %d0,errno # move it into errno
        moveq.l #-1,%d0 # put -1 into d0
.L2:
        unlk %a6 restore a6
        rts return
.comm errno,4
=======
*/

> Any hints are welcome. Perhaps you can tell me where I can find the relating information.
>
> thank you.
>
Hope this is some help
  Phil Wilshire
This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/



This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:42 EST