Commit Graph

11 Commits

Author SHA1 Message Date
Brandon Bergren
328b5f2570 [PowerPC] Implement VDSO timebase access on powerpc*
Implement the remaining pieces needed to allow userland timestamp reading.

Rewritten based on an intial essay into the problem by Justin Hibbits.
(Copyright changed to my own on his request.)

Tested on ppc64 (POWER9 Talos II), powerpcspe (e500v2 RB800), and
powerpc (g4 PowerBook).

Reviewed by:	jhibbits (in irc)
Sponsored by:	Tag1 Consulting, Inc.
Differential Revision:	https://reviews.freebsd.org/D26347
2020-09-08 03:00:31 +00:00
Brandon Bergren
4f9ed3156c [PowerPC] Fix SPE floating point environment manipulation
Fix multiple problems in the powerpcspe floating point code.

* Endianness handling of the SPEFSCR in fenv.h was completely broken.
* Ensure SPEFSCR synchronization requirements are being met.

The __r.__d -> __r transformations were written by jhibbits.

Reviewed by:	jhibbits
Differential Revision:	https://reviews.freebsd.org/D22526
2019-12-12 17:12:18 +00:00
Justin Hibbits
28c20ad06c Fix fabs(3) for powerpcspe, this time for real
SPE ABI uses the soft-float ABI, which splits doubles into two words.  As such,
fabs(3) cannot work on a double directly.  It's too costly to convert the
argument pair into a single double to use efdabs, so clear the top bit of the
high word, which is the sign bit.
2018-07-26 14:42:20 +00:00
Justin Hibbits
544db45f84 Fix register usage in fabs(3) for powerpcspe
This still used the FPU register definition, which gcc converted to using %r1
(stack register).  Fix to use %r3.
2018-07-24 22:05:55 +00:00
Justin Hibbits
adc9dcf3e3 Fix floating point exception definitions for powerpcspe
These were incorrectly implemented in the original port.
2018-07-24 22:04:56 +00:00
Brooks Davis
13f2393362 Correct an misunderstanding of MDSRCS.
MDSRCS it intended to allow assembly versions of funtions with C
implementations listed in MISRCS. The selection of the correct
machdep_ldis?.c for a given architecture does not follow this pattern
and the file should be added to SRCS directly.

Reviewed by:	emaste, imp, jhb
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9841
2017-03-02 17:07:28 +00:00
Justin Hibbits
aab03089ee Fix a copy&paste-o causing a segfault with sigsetjmp.
I'm not sure how this passed my code inspection and initial testing, it's
obviously wrong.  Found when debugging csh.
2016-10-29 01:22:55 +00:00
Justin Hibbits
3bf61aa48d Remove the powerpcspe Symbol.map, it's identical to powerpc's.
Reported by:	kib
2016-10-23 18:08:34 +00:00
Justin Hibbits
54360de77b Reduce code duplication between powerpc and powerpcspe
They're nearly identical except for a few files.
Reported by:	kib
2016-10-22 21:51:58 +00:00
Justin Hibbits
8f34671a5e ptrace.S is not needed, libc/sys/ptrace.c exists already.
This was leftovers from the initial branch work.

Reported by:	kib
2016-10-22 13:11:09 +00:00
Justin Hibbits
dc9b124d66 Create a new MACHINE_ARCH for Freescale PowerPC e500v2
Summary:
The Freescale e500v2 PowerPC core does not use a standard FPU.
Instead, it uses a Signal Processing Engine (SPE)--a DSP-style vector processor
unit, which doubles as a FPU.  The PowerPC SPE ABI is incompatible with the
stock powerpc ABI, so a new MACHINE_ARCH was created to deal with this.
Additionaly, the SPE opcodes overlap with Altivec, so these are mutually
exclusive.  Taking advantage of this fact, a new file, powerpc/booke/spe.c, was
created with the same function set as in powerpc/powerpc/altivec.c, so it
becomes effectively a drop-in replacement.  setjmp/longjmp were modified to save
the upper 32-bits of the now-64-bit GPRs (upper 32-bits are only accessible by
the SPE).

Note: This does _not_ support the SPE in the e500v1, as the e500v1 SPE does not
support double-precision floating point.

Also, without a new MACHINE_ARCH it would be impossible to provide binary
packages which utilize the SPE.

Additionally, no work has been done to support ports, work is needed for this.
This also means no newer gcc can yet be used.  However, gcc's powerpc support
has been refactored which would make adding a powerpcspe-freebsd target very
easy.

Test Plan:
This was lightly tested on a RouterBoard RB800 and an AmigaOne A1222
(P1022-based) board, compiled against the new ABI.  Base system utilities
(/bin/sh, /bin/ls, etc) still function appropriately, the system is able to boot
multiuser.

Reviewed By:	bdrewery, imp
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D5683
2016-10-22 01:57:15 +00:00