RES: rtems 4.8 / erc32 bsp / register allocation / FP registers for non FPoperations

Wendell Pereira da Silva wendell.silva at compsisnet.com.br
Mon Apr 27 17:00:26 UTC 2009


Hi Nicolas,

This is old issue. 
There are some messagens in this list that may help you. The cause is an optimization "problem" of the GCC for sparc.

Some useful links: 
 - http://www.rtems.com/ml/rtems-users/2008/march/msg00272.html
 - http://www.rtems.com/ml/rtems-users/2007/august/msg00059.html


Att.
Wendell P. Silva
COMPSIS / Brazil.


-----Mensagem original-----
De: rtems-users-bounces at rtems.org [mailto:rtems-users-bounces at rtems.org] Em nome de Nicolas Horro
Enviada em: segunda-feira, 27 de abril de 2009 12:00
Para: RTEMS Users
Assunto: rtems 4.8 / erc32 bsp / register allocation / FP registers for non FPoperations

Hello,

I noticed a strange behaviour in sparc-rtems4.8-gcc. In rare
occasions, when generating code for 32bit unsigned integer accesseses
it uses %f8 register, which is a FPU register.

This causes an undesired trap, because FP is disabled:

_____________________________
calling foo()
Unexpected trap 0x4 at 0x2001ce0
FP disabled.
_____________________________

Depending on minor changes in source code, this can be the output:

02001cd0 <foo>:
 2001cd0:	03 00 7e 00 	sethi  %hi(0x1f80000), %g1     ;ERC32_MEC> base address
 2001cd4:	c6 02 a0 04 	ld  [ %o2 + 4 ], %g3
 2001cd8:	9a 10 60 00 	mov  %g1, %o5                     ; %g5 =
0x1f8004c (INTERRUPT MASK REGISTER)
 2001cdc:	17 00 80 6c 	sethi  %hi(0x201b000), %o3
 2001ce0:	d1 03 60 4c 	ld  [ %o5 + 0x4c ], %f8           ; <--- why %F8 ????
 2001ce4:	c4 02 e1 d4 	ld  [ %o3 + 0x1d4 ], %g2
(....)

for c source code:

void foo() {
   uint32_t intMask = ERC32_MEC.Interrupt_Mask;
    /* (...) */
   ERC32_MEC.Interrupt_Mask = ERC32_MEC.Interrupt_Mask | 0x00007ffc;
    /* (...) */
}

I could not detect yet which is the combination of changes that
generate the use of %f8 register. Only uint8_t, uint16_t and uint32_t
types are used (there are no floats, doubles, uint64_ts.).

Default Makefiles for ERC32 BSP are used RTEMS 4.8.0. This function is
part of a I/O driver.
Configure options are:

cd bsp-install
../rtems4.8.0/configure --target=sparc-rtems4.8
--enable-rtemsbsp="erc32 sis" --enable-posix --disable-itron
--disable-networking --disable-cxx --disable-tests
--disable-rtems-debug --disable-docs --prefix=/home/bsp-install &&
gmake all && make install

Any direction of where to get more information on register usage or
could this be a bug?

Thanks in advance,

Nicolás
_______________________________________________
rtems-users mailing list
rtems-users at rtems.org
http://www.rtems.org/mailman/listinfo/rtems-users



More information about the users mailing list