PowerPC Assembly Question

Till Straumann strauman at slac.stanford.edu
Wed Jan 26 00:25:31 UTC 2011


The PPC extension to the SVR4 ABI specifies that
the caller of a vararg list function must set the
CR[6] (CR1 - "equal-to-zero") bit to announce that
it passes floating-point arguments in one or more
FP registers.

Hence, you'd have to call e.g.,

printk("%f\n", 5.8);

in order to exercise that path. However, I'm not
sure if printk even implements floating-point
numbers (but that fact is unknown to the compiler)
so I don't know if the path can be tested.

HTH
-- Till

On 01/25/2011 05:27 PM, Joel Sherrill wrote:
> Hi,
>
> When looking at coverage on qemuppc, I came across this
> fragment at
>
> http://www.rtems.org/ftp/pub/rtems/people/joel/coverage/qemuppc-OsPD-20110125-1704/annotated.html#range346
>
>
> Notice that the code saves a handful of general purpose
> registers, then tests cr1 and jumps around saving FP
> registers. Can someone explain how to trip the
> fp code in this path?
>
> ffc04ffc <printk>:
> * printk
> *
> * Kernel printf function requiring minimal infrastrure.
> */
> void printk(const char *fmt, ...)
> {
>
> ffc04ffc: 94 21 ff 88 stwu r1,-120(r1)
> ffc05000: 7c 08 02 a6 mflr r0
> ffc05004: 90 81 00 1c stw r4,28(r1)
> ffc05008: 90 01 00 7c stw r0,124(r1)
> ffc0500c: 90 a1 00 20 stw r5,32(r1)
> ffc05010: 90 c1 00 24 stw r6,36(r1)
> ffc05014: 90 e1 00 28 stw r7,40(r1)
> ffc05018: 91 01 00 2c stw r8,44(r1)
> ffc0501c: 91 21 00 30 stw r9,48(r1)
> ffc05020: 91 41 00 34 stw r10,52(r1)
>
> ffc05024: 40 86 00 24 bne- cr1,ffc05048 <printk+0x4c> <== ALWAYS TAKEN
>
> ffc05028: d8 21 00 38 stfd f1,56(r1) <== NOT EXECUTED
> ffc0502c: d8 41 00 40 stfd f2,64(r1) <== NOT EXECUTED
> ffc05030: d8 61 00 48 stfd f3,72(r1) <== NOT EXECUTED
> ffc05034: d8 81 00 50 stfd f4,80(r1) <== NOT EXECUTED
> ffc05038: d8 a1 00 58 stfd f5,88(r1) <== NOT EXECUTED
> ffc0503c: d8 c1 00 60 stfd f6,96(r1) <== NOT EXECUTED
> ffc05040: d8 e1 00 68 stfd f7,104(r1) <== NOT EXECUTED
> ffc05044: d9 01 00 70 stfd f8,112(r1) <== NOT EXECUTED
>




More information about the users mailing list