Motorola PowerPC asm warning

Chris Johns chrisj at rtems.org
Tue Apr 11 04:39:31 UTC 2023



On 9/4/2023 1:26 am, Joel Sherrill wrote:
> 
> 
> On Fri, Apr 7, 2023, 6:55 PM Joel Sherrill <joel at rtems.org
> <mailto:joel at rtems.org>> wrote:
> 
> 
> 
>     On Fri, Apr 7, 2023, 5:54 PM Chris Johns <chrisj at rtems.org
>     <mailto:chrisj at rtems.org>> wrote:
> 
>         Hi
> 
>         Building the motorola_powerpc BSPs I noticed this warning:
> 
>         ../../../bsps/powerpc/shared/exceptions/ppc_exc.S: Assembler messages:
>         ../../../bsps/powerpc/shared/exceptions/ppc_exc.S:132: Warning: invalid
>         register
>         expression
>         ../../../bsps/powerpc/shared/exceptions/ppc_exc.S:135: Warning: invalid
>         register
>         expression
> 
>         https://git.rtems.org/rtems/tree/bsps/powerpc/shared/exceptions/ppc_exc.S#n132 <https://git.rtems.org/rtems/tree/bsps/powerpc/shared/exceptions/ppc_exc.S#n132>
> 
>         Can someone with an understanding of the PowerPC processors please
>         comment if
>         this is an issue or how we can remove the warning?
> 
> 
>     It's from something in the macro. Any chance of a cut down of the
>     preprocessed output and command it fails with?
> 
> 
> With that, we can compare the PPC model being compiled against with the
> instructions and registers. 
> 
> If it is Book E for an old PPC model, I don't think they will work since Book E
> is way newer.

There are 3 machine flags used to build the file in the motorola_powerpc:

 -mcpu=603e
 -mcpu=604
 -mcpu=7400

and all have the warning. This is the command line for the mvme2100 BSP:

powerpc-rtems6-gcc -MMD -mcpu=603e -DASM -g \
  -Icpukit/include -I../../../cpukit/include \
  -Icpukit/score/cpu/powerpc/include \
  -I../../../cpukit/score/cpu/powerpc/include \
  -Ibsps/include -I../../../bsps/include -Ibsps/powerpc/include \
  -I../../../bsps/powerpc/include \
  -Ibsps/powerpc/motorola_powerpc/include \
  -I../../../bsps/powerpc/motorola_powerpc/include \
  ../../../bsps/powerpc/shared/exceptions/ppc_exc.S -c \
  -obsps/powerpc/shared/exceptions/ppc_exc.S.46.o

The warning is from the WRAP assembler macro:

https://git.rtems.org/rtems/tree/bsps/powerpc/shared/exceptions/ppc_exc_asm_macros.h#n730

The instruction in the TEST_LOCK_ assembler macro that is generating the warning is:

https://git.rtems.org/rtems/tree/bsps/powerpc/shared/exceptions/ppc_exc_asm_macros.h#n242

If I comment this instruction the warning goes away. The assembled object file
shows the instruction as:

000006ac <TEST_LOCK_crit_done_bookE_crit>:
 6ac:   4e 52 11 02     crandc  4*cr4+eq,4*cr4+eq,eq

The pre-processed code is:

TEST_LOCK_crit_done_\_FLVR:
 crandc ((4)*4+2), ((4)*4+2), ((cr0)*4+2)

And in this case FLVR is bookE_crit. I have no idea what is happening in the code.

Chris


More information about the devel mailing list