I'm running into a bug with gcc 3.4.3:
I've got syscall code for user-land to our kernel that trashes r14/lr.
The code is inlined, and works find in ARM mode. When compiling in thumb, gcc does not preserve lr. With an older gcc 3.3.3, the code was not inlined, but generated correctly.
L4_INLINE void * L4_KernelInterface (L4_Word_t *ApiVersion, L4_Word_t *ApiFlags, L4_Word_t *KernelId) { register L4_Word_t base_address asm ("r0"); register L4_Word_t _ApiVersion asm ("r1"); register L4_Word_t _ApiFlags asm ("r2"); register L4_Word_t _KernelId asm ("r3");
__asm__ __volatile__ ( "mov lr, pc\n" "mov pc, %[trap_kip]\n" : "=r" (base_address), "=r" (_ApiVersion), "=r" (_ApiFlags), "=r" (_KernelId) : [trap_kip] "r" (L4_TRAP_KIP) : "lr", "memory" );
if (ApiVersion) *ApiVersion = _ApiVersion; if (ApiFlags) *ApiFlags = _ApiFlags; if (KernelId) *KernelId = _KernelId;
return (void *)base_address; }
--- inline asm marked at '*'
00051bac <__L4_Init>: 51bac: 204c mov r0, #76 51bae: 4240 neg r0, r0 * 51bb0: 46fe mov lr, pc * 51bb2: 4687 mov pc, r0 51bb4: 2298 mov r2, #152 51bb6: 0052 lsl r2, r2, #1 51bb8: 1883 add r3, r0, r2 51bba: 681b ldr r3, [r3, #0] ...
---
Reading specs from /home/extra/opt/tools/3.4.3-elf/bin/../lib/gcc/arm-elf/3.4.3/specs
Configured with: ../gcc-3.4.3/configure --prefix=/opt/tools/3.4.3-elf --target=arm-elf --with-float=soft --with-arch=armv5te --enable-cxx-flags=-march=armv5te --enable-languages=c,c++ : (reconfigured) ../gcc-3.4.3/configure --prefix=/opt/tools/3.4.3-elf --target=arm-elf --with-float=soft --enable-languages=c,c++
Thread model: single
gcc version 3.4.3
thanks, Carl van Schaik
_________________________________________________________________
Get your e-mail, your way - get MSN Hotmail Plus! http://join.msn.com/?pgmarket=en-xe&DI=1054&XAPID=1816