freebsd-dev/sys/libkern
Bruce Evans dbe3061729 Fix recent breakages of kernel profiling, mostly on i386 (high resolution
kernel profiling remains broken).

memmove() was broken using ALTENTRY().  ALTENTRY() is only different from
ENTRY() in the profiling case, and its use in that case was sort of
backwards.  The backwardness magically turned memmove() into memcpy()
instead of completely breaking it.  Only the high resolution parts of
profiling itself were broken.  Use ordinary ENTRY() for memmove().
Turn bcopy() into a tail call to memmove() to reduce complications.
This gives slightly different pessimizations and profiling lossage.
The pessimizations are minimized by not using a frame pointer() for
bcopy().

Calls to profiling functions from exception trampolines were not
relocated.  This caused crashes on the first exception.  Fix this using
function pointers.

Addresses of exception handlers in trampolines were not relocated.  This
caused unknown offsets in the profiling data.  Relocate by abusing
setidt_disp as for pmc although this is slower than necessary and
requires namespace pollution.  pmc seems to be missing some relocations.
Stack traces and lots of other things in debuggers need similar relocations.

Most user addresses were misclassified as unknown kernel addresses and
then ignored.  Treat all unknown addresses as user. Now only user
addresses in the kernel text range are significantly misclassified (as
known kernel addresses).

The ibrs functions didn't preserve enough registers.  This is the only
recent breakage on amd64.  Although these functions are written in
asm, in the profiling case they call profiling functions which are
mostly for the C ABI, so they only have to save call-used registers.
They also have to save arg and return registers in some cases and
actually save them in all cases to reduce complications.  They end up
saving all registers except %ecx on i386 and %r10 and %r11 on amd64.
Saving these is only needed for 1 caller on each of amd64 and i386.
Save them there.  This is slightly simpler.

Remove saving %ecx in handle_ibrs_exit on i386.  Both handle_ibrs_entry
and handle_ibrs_exit use %ecx, but only the latter needed to or did
save it.  But saving it there doesn't work for the profiling case.

amd64 has more automatic saving of the most common scratch registers
%rax, %rcx and %rdx (its complications for %r10 are from unusual use
of %r10 by SYSCALL).  Thus profiling of handle_ibrs_exit_rs() was not
broken, and I didn't simplify the saving by moving the saving of these
registers from it to the caller.
2018-06-02 04:25:09 +00:00
..
arm sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
arm64
x86
arc4random.c
ashldi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ashrdi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
asprintf.c
bcd.c
bcmp.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
bcopy.c Simplify things a little 2018-05-10 02:31:48 +00:00
bsearch.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
cmpdi2.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
crc32.c
divdi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
explicit_bzero.c
ffs.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ffsl.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ffsll.c
fls.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
flsl.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
flsll.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
fnmatch.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
iconv_converter_if.m
iconv_ucs.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
iconv_xlat16.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
iconv_xlat.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
iconv.c iconv uses strlen directly on user supplied memory 2018-02-26 18:23:36 +00:00
inet_aton.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
inet_ntoa.c
inet_ntop.c
inet_pton.c
jenkins_hash.c
lshrdi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
mcount.c Fix recent breakages of kernel profiling, mostly on i386 (high resolution 2018-06-02 04:25:09 +00:00
memcchr.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
memchr.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
memcmp.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
memmem.c
memset.c Protect bzero call against macro expansion 2018-05-24 23:20:10 +00:00
moddi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
murmur3_32.c
qdivrem.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
qsort_r.c
qsort.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
quad.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
random.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
scanc.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strcasecmp.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
strcat.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strchr.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strcmp.c libkern: use nul for terminating char rather than 0 2018-02-13 19:17:48 +00:00
strcpy.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strcspn.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
strdup.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
strlcat.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
strlcpy.c
strlen.c Remove "All rights reserved" from my files. 2018-05-10 06:41:08 +00:00
strncat.c libkern: use nul for terminating char rather than 0 2018-02-13 19:17:48 +00:00
strncmp.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strncpy.c libkern: use nul for terminating char rather than 0 2018-02-13 19:17:48 +00:00
strndup.c
strnlen.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
strrchr.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strsep.c libkern: use nul for terminating char rather than 0 2018-02-13 19:17:48 +00:00
strspn.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
strstr.c libkern: use nul for terminating char rather than 0 2018-02-13 19:17:48 +00:00
strtol.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strtoq.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strtoul.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strtouq.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strvalid.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
timingsafe_bcmp.c
ucmpdi2.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
udivdi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
umoddi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
zlib.c