Commit Graph

9 Commits

Author SHA1 Message Date
Andrew Turner
28d945204e Handle functions that use a nop in the arm64 fbt
To trace leaf asm functions we can insert a single nop instruction as
the first instruction in a function and trigger off this.

Reviewed by:	gnn
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D28132
2021-03-03 14:18:03 +00:00
Andrew Turner
449ebf135b Move the literal pool to the end of asm functions
This keeps the data at the end of a function, near to where it's used.
Sponsored by:	Innovate UK
2020-12-23 13:57:25 +00:00
Andrew Turner
6f8866af34 Add LENTRY and LEND to arm64
These allow us to mark local asm functions as a function

Sponsored by:	Innovate UK
2020-12-23 13:57:25 +00:00
Conrad Meyer
78599c32ef Add CFI start/end proc directives to arm64, i386, and ppc
Follow-up to r353959 and r368070: do the same for other architectures.

arm32 already seems to use its own .fnstart/.fnend directives, which
appear to be ARM-specific variants of the same thing.  Likewise, MIPS
uses .frame directives.

Reviewed by:	arichardson
Differential Revision:	https://reviews.freebsd.org/D27387
2020-12-05 00:33:28 +00:00
Andrew Turner
494278bb26 Stop speculation past an eret instruction
On arm64 the eret instruction is used to return from an exception handler.
Some implementations may speculate past this instruction into the next
function. As the user may control many registers in these functions add
a synchronisation barrier sequence after the eret instruction to stop these
CPUs from speculating out of the exception handler.

PR:		242676
Submitted by:	Anthony Steinhauser <asteinhauser@google.com> (previous version)
MFC after:	1 week
2019-12-19 08:52:16 +00:00
Andrew Turner
d6a0af236d In ARMv8.1 ARM has added a process state bit to disable access to userspace
from the kernel. Make use of this to restrict accessing userspace to just
the functions that explicitly handle crossing the user kernel boundary.

Reported by:	kib
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10371
2017-04-13 13:46:01 +00:00
Alexander Kabaev
8b609ea571 Define 'lr' as x30 on aarch64
GNU toolchain does not recognize LR as standard register alias,
but clang does. Use of #define will work on both. Place the
definition into central machine/asm.h instead of patching every
affected file, as requested by plaftorm maintainers.

Reviews by: andrew, emaste, imp
Differential Revision:	https://reviews.freebsd.org/D10307
2017-04-07 22:58:28 +00:00
Andrew Turner
4dd6ed5ce6 Mark functions as such. This means we call them directly rather than have
the dynamic linker copy them, but not relocate them at the new location.
This allows us to run sqlite3 without it crashing.

Sponsored by:	ABT Systems Ltd
2015-10-27 22:24:57 +00:00
Andrew Turner
412042e2ae Add the start of the arm64 machine headers. This is the subset needed to
start getting userland libraries building.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2015-03-23 11:54:56 +00:00