[uClibc]ARM floating-point and setjmp/longjmp

Stefan Soucek ssoucek at coactive.com
Wed Feb 20 20:56:10 UTC 2002


Hi,

I ran into the problem of crashing our system with an "illegal
instruction" when running the setjmp_test.c in uClibc. We are using an
MMU-less ARM (v4 arch) w/o hardware floating-point support. We want
software FP though, and therefore have

HAS_FLOATING_POINT = true

in Config.arm. It turns out that this setting translates into a

#define __UCLIBC_HAS_FLOATS__ 1

However, in arm/setjmp.S the opcode SFM is used to store the FP registers
and in arm/__longjmp.S its counterpart LFM to restore them if
__UCLIBC_HAS_FLOATS__ is defined. e.g. from setjmp.S:

__sigsetjmp:
	/* Save registers */
#ifdef __UCLIBC_HAS_FLOATS__NOTWITHARM9TDMI
	sfmea   f4, 4, [r0]!
#endif

This throws an "illegal instruction" on systems that don't have the FP
hardware support.

I fixed this temporariliy by removing the FP opcodes and the set jump test
runs happily ever after. My intuition to solve the problem would be to
introduce some config variable like HAVE_FPU which turns into a
__UCLIBC_HAS_FPU__ and use the latter in __sigsetjmp and __longjmp
instead.

What do you guys think?

-Stefan

--
Stefan Soucek, ssoucek at coactive.com
Coactive Networks, 28 Liberty Ship Way, Sausalito, CA 94965
Ph: (415) 289 7840, Fax: (415) 289 1320




More information about the uClibc mailing list