Updating setjmp/longjmp

Andrew Turner andrew at fubar.geek.nz
Sun Jun 2 09:24:54 UTC 2013


On Sat, 1 Jun 2013 23:50:00 -0600
Warner Losh <imp at bsdimp.com> wrote:

> 
> On Jun 1, 2013, at 1:12 PM, Andrew Turner wrote:
> 
> > Hello,
> > 
> > I'm updating the setjmp/longjmp functions on ARM to reduce the diff
> > to NetBSD and to store the VFP registers when they are available.
> > 
> > As part of this I will be removeing support for storing the FPA
> > (floating point accelerator) registers. Does anyone have any
> > objections to this?
> > 
> > The first patch is at [1]. It updates
> > out code to remove the FPA support but doesn't yet add the VFP as
> > that will require other libc changes.
> > 
> > (If you don't know what the FPA is this patch probably doesn't
> > affect you, it was an old floating-point device in only a few
> > chips. Modern CPUs use a different piece of hardware for floating
> > point operations.)
> 
> Did we ever support this? Or were they used only for the floating
> point emulator that NetBSD had in their tree for a while, but that I
> don't think ever made it into ours since softfloat is faster....

Juniper may have, see [1]. The patch in that post went into head in
r186461. Marcel can you comment on if this is the case?

> This looks OK to the limit of my arm assembler knowledge, but why the
> switch from r3 to ip in longjmp?
Mostly to be consistent with NetBSD. They use r3 in part of the patch I
left out as it needs other changes. The idea is to have a different
setjmp magic number when VFP is used. The start of longjmp in NetBSD is:

	ldr	r2, [r0]
	ldr	ip, .Lsetjmp_magic
	bic	r3, r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP)
	teq	r3, ip
	bne	.Lbotch

As there is a single bit difference between _JB_MAGIC_SETJMP and
_JB_MAGIC_SETJMP_VFP the bit line clears it before the check. I feel it
is better to reduce the difference between us and NetBSD as I will be
pulling in other NetBSD changes soon.


> Also, what's the difference between setjmp and_setgjmp? It's just
> saving the signal mask... Is there any benefit to merging? The meat
> of the functions are tiny, but there's all that boilerplate...

Yes, they are almost identical. The only functional difference between
the two should be that _setjmp doesn't store the signal state. It is
something I can look into when I have finished merging in the changes.

Andrew

[1]
http://lists.freebsd.org/pipermail/freebsd-arm/2008-December/001429.html


More information about the freebsd-arm mailing list