[VxW] Power PC stack frame with "gnu ccppc" and "diab dcc"

mgovind at hss.hns.com mgovind at hss.hns.com
Mon Jul 14 20:19:36 PDT 2003




HI  All,

I am new to power PC assesmby .I  have some doubts about the stack frame  .
I have gone through power PC eabi docs.
I have tried to generate  the assembly code for   a very simple C program
.The code is given below.
I have tried  using diab C compiler and  ccppc .  I am very much confused
by the code generated by  the compilers.
Diab and ccppc are forming the stack frames  differently .The offsets they
are taking are  different .Diab takes an offset 8 and
ccppc takes 16 . If we are writing an assembly function by hand  , which
will be called from a c program  ,how  can I know the
minimal stack size .I got confused because both of the compilers uses
different offsets, for the same purpose .
Even if nothing is being done in the function some stack is allocated and
deallocated.
Also where can I get the documentation of ccppc  .We have a windriver
installation of VxWorks here , but it does not seem to
have ccppc specific documentation .

The diab  generated code seems to be straight forward.
Why GPR31 is used in  the ccppc generated listing ???

Thanks in advance
mahesh

Please find the code given below.

********************************************
/* simple.c
  function test()  will call one()
*/
one ()
{

}

test()
{

one();
}
************************************************
/**********************************************************/
Listing generated by  ccppc


#$$m2          - PowerPC mnemonics
#$$pPPC        - PowerPC instructions
#$$oPPC8260    - Optimized for PowerPC 8260
#$$ko 0        - Reorder info
     .file          "ex.c"
# -X options:
#$$x X7=1 X8=1 X12=1 X15=2 X16=20 X18=4 X19=1 X23=1
#$$x X32=2 X35=1 X36=1 X39=8260 X55=7 X56=1 X57=2 X74=255
#$$x X80=3 X86=6 X91=1 X93=1 X95=29360128 X97=8 X98=8 X111=1
#$$x X114=7 X115=32767 X119=44 X126=4410 X128=1 X130=6 X145=2 X146=6
#$$x X147=3 X153=1 X154=15 X201=256
     .text

#$$bf
     .align         2
     .globl         one
one:
     stwu      r1,-8(r1)
     mfspr          r0,lr
     stw       r0,12(r1)
#$$ee
#$$be
     lwz       r0,12(r1)
     mtspr          lr,r0
     addi      r1,r1,8
#$$tl 0x0 0x0 0x0
     blr
#$$ef
     .type          one, at function
     .size          one,.-one

# Allocations for one

#$$bf
     .align         2
     .globl         test
test:
     stwu      r1,-8(r1)
     mfspr          r0,lr
     stw       r0,12(r1)
#$$ee
     lwz       r0,12(r1)
     mtspr          lr,r0
     addi      r1,r1,8
#$$tl 0xffffc000 0x0 0xfff00000
#$$rs 4
     b         one
#$$be
#$$ef
     .type          test, at function
     .size          test,.-test

# Allocations for test

# Allocations for module

/*********************************************************************/


Listing generated by Diab
/************************************************************************/
#$$m2          - PowerPC mnemonics
#$$pPPC        - PowerPC instructions
#$$oPPC8260    - Optimized for PowerPC 8260
#$$ko 0        - Reorder info
     .file          "ex.c"
# -X options:
#$$x X7=1 X8=1 X12=1 X15=2 X16=20 X18=4 X19=1 X23=1
#$$x X32=2 X35=1 X36=1 X39=8260 X55=7 X56=1 X57=2 X74=255
#$$x X80=3 X86=6 X91=1 X93=1 X95=29360128 X97=8 X98=8 X111=1
#$$x X114=7 X115=32767 X119=44 X126=4410 X128=1 X130=6 X145=2 X146=6
#$$x X147=3 X153=1 X154=15 X201=256
     .text

#$$bf
     .align         2
     .globl         one
one:
     stwu      r1,-8(r1)
     mfspr          r0,lr
     stw       r0,12(r1)
#$$ee
#$$be
     lwz       r0,12(r1)
     mtspr          lr,r0
     addi      r1,r1,8
#$$tl 0x0 0x0 0x0
     blr
#$$ef
     .type          one, at function
     .size          one,.-one

# Allocations for one

#$$bf
     .align         2
     .globl         test
test:
     stwu      r1,-8(r1)
     mfspr          r0,lr
     stw       r0,12(r1)
#$$ee
     lwz       r0,12(r1)
     mtspr          lr,r0
     addi      r1,r1,8
#$$tl 0xffffc000 0x0 0xfff00000
#$$rs 4
     b         one
#$$be
#$$ef
     .type          test, at function
     .size          test,.-test

# Allocations for test

# Allocations for module
/**************************************************************************
**************/








This message is proprietary to Hughes Software Systems Limited (HSS) and is
intended solely for the use of the individual to whom it is addressed.  It
may contain privileged or confidential information and should not be
circulated or used for any purpose other than for what it is intended.  If
you have received this message in error, please notify the originator
immediately.  If you are not the intended recipient, you are notified that
you are strictly prohibited from using, copying, altering, or disclosing
the contents of this message.  HSS accepts no responsibility for loss or
damage arising from the use of the information transmitted by this email
including damage from virus.




More information about the VxWexplo mailing list