254569 Commits

Author SHA1 Message Date
christos
d4d3ff8a98 deal with the stdbool.h mess defining bool in <net/if.h> and <net/route.h>
and then xf86Opt.h wanting to define a struct field called bool.
2017-11-05 17:44:28 +00:00
maxv
0157e6342e Remove unused. 2017-11-05 16:27:18 +00:00
maxv
aaeb67dfa8 Mprotect the segments in mm.c using bootspace, and remove the now unused
fields of elfinfo.
2017-11-05 16:26:15 +00:00
christos
cae3221e2b The XXX comment (do not pull in the uvm headers) might have been a nice idea
at the time, but now all other db_machdep files do this, so we follow suit.
2017-11-05 16:16:26 +00:00
christos
2b98159f0b fix error messages (use __func__, quotes)
also differentiate between canonical and non-relative.
2017-11-05 15:33:15 +00:00
jmcneill
53aff4d5c0 add missing break after -m case 2017-11-05 11:07:32 +00:00
skrll
5fcdcb153f Use IPL_VM and IST_MPSAFE instead of IPL_SCHED 2017-11-05 09:11:43 +00:00
skrll
30d130fd63 Disable USB_DEBUG by default 2017-11-05 09:05:20 +00:00
mlelstv
cc92bcd96f pool_grow can now fail even when sleeping is ok. Catch this case in pool_get
and retry.
2017-11-05 07:49:45 +00:00
ozaki-r
048933fa32 Fix usages of ipsec_used
If IPsec isn't used, we must go back to the normal path.

PR kern/52659
2017-11-05 07:03:37 +00:00
kamil
636d66d904 Backport patch from gcc.old for liblto_plugin
Correct resolution of xstrerror(). Switch from -liberty (which has PIC
problems as a local library) to directly linking xstrerror.c with
liblto_plugin.

Fix in gcc.old by <christos>

PR 52674 by myself
2017-11-05 02:36:00 +00:00
christos
5a591edce7 fix type of addr. 2017-11-05 01:18:15 +00:00
christos
8d1bd5c1e5 undo previous; we can't link with libiberty because it is a private library
and not build as pic. Instead just bring in the xstrerror.c source from it.
2017-11-05 01:16:16 +00:00
christos
ad97afb146 use Elf_Sym ** instead of casting. 2017-11-04 22:17:55 +00:00
jdolecek
3d3c2e6bb1 fix comment - scsipi_rw_big was renamed to scsipi_rw_10 a while ago 2017-11-04 21:02:37 +00:00
skrll
f2e8fe4c2b Ensure CNTVOFF is 0 before dropping out of Hyp mode
CVS ----------------------------------------------------------------------
2017-11-04 17:09:55 +00:00
kamil
97baba3441 Bump lib minor for liblto_plugin.so link with -liberty
PR 52674 by myself
2017-11-04 16:21:49 +00:00
kamil
25586f65d6 Link liblto_plugin with -liberty (gcc)
GCC passes liblto_plugin.so in the linker invocation (part of "gcc -v file.c"):

ld -plugin /usr/libexec/liblto_plugin.so -plugin-opt=/usr/libexec/lto-wrapper \
-plugin-opt=-fresolution=/var/tmp//ccxda9Ar.res \
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc \
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s \
-plugin-opt=-pass-through=-lgcc --eh-frame-hdr -dc -dp -e _start \
-dynamic-linker /usr/libexec/ld.elf_so /usr/lib/crt0.o /usr/lib/crti.o \
/usr/lib/crtbegin.o /var/tmp//cc7A7mOK.o --as-needed -lgcc_s --no-as-needed \
-lgcc -lc --as-needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtend.o \
/usr/lib/crtn.o

When attempting to use GNU GOLD, liblto_plugin.so cannot be used because it \
has missing symbol xstrerror:

ld: error: /usr/libexec/liblto_plugin.so: could not load plugin library: \
/usr/libexec/liblto_plugin.so: Undefined PLT symbol "xstrerror" (symnum = 38)

From Makefiles and sources inspection, liblto_plugin.so shall be linked with \
libiberty (-liberty), a utility GNU library for internal usage with helping \
functions.

PR 52674 by myself
2017-11-04 16:03:12 +00:00
kamil
e81e3afa16 Link liblto_plugin with -liberty (gcc.old)
GCC passes liblto_plugin.so in the linker invocation (part of "gcc -v file.c"):

ld -plugin /usr/libexec/liblto_plugin.so -plugin-opt=/usr/libexec/lto-wrapper \
-plugin-opt=-fresolution=/var/tmp//ccxda9Ar.res \
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc \
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s \
-plugin-opt=-pass-through=-lgcc --eh-frame-hdr -dc -dp -e _start \
-dynamic-linker /usr/libexec/ld.elf_so /usr/lib/crt0.o /usr/lib/crti.o \
/usr/lib/crtbegin.o /var/tmp//cc7A7mOK.o --as-needed -lgcc_s --no-as-needed \
-lgcc -lc --as-needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtend.o \
/usr/lib/crtn.o

When attempting to use GNU GOLD, liblto_plugin.so cannot be used because it \
has missing symbol xstrerror:

ld: error: /usr/libexec/liblto_plugin.so: could not load plugin library: \
/usr/libexec/liblto_plugin.so: Undefined PLT symbol "xstrerror" (symnum = 38)

From Makefiles and sources inspection, liblto_plugin.so shall be linked with \
libiberty (-liberty), a utility GNU library for internal usage with helping \
functions.

PR 52674 by myself
2017-11-04 15:59:16 +00:00
cherry
dbd9f7feec Remove bitrotted xen specific versions of pci, pciide machdep related code.
Use the common x86/ code instead.
2017-11-04 15:24:42 +00:00
cherry
b1da571467 Retire xen/x86/intr.c and use the new xen specific glue in x86/x86/intr.c
The purpose of this change is to expose the x86/include/intr.h API
to drivers. Specifically the following functions:

   void *intr_establish_xname(...);
   void *intr_establish(...);
   void intr_disestablish(...);

while maintaining the old API from xen/include/evtchn.h, specifically
the following functions:

    int event_set_handler(...);
    int event_remove_handler(...);

This is so that if things break, we can keep using the old API until
everything stabilises. This is a stepping stone towards getting the
actual XEN event callback path rework code in place - which can be
done opaquely behind the intr.h API - NetBSD/XEN specific drivers that
have been ported to the intr.h API should then work without
significant further modifications.
2017-11-04 14:56:48 +00:00
jmcneill
e538d5098a Firmware after May 8, 2017 places APs in WFE state at boot. Add a "sev"
after writing the start vector, otherwise secondary CPUs will not boot.
2017-11-04 14:47:06 +00:00
christos
4eb0a742c5 Don't use popenve() for portability; forking an extra shell here is not an
issue.
2017-11-04 14:20:12 +00:00
maxv
0398c46cc7 Fix stack overflow, found when testing a new feature. 2017-11-04 12:53:00 +00:00
martin
640f0abac6 Make kobj_sym_lookup's result type an Elf_Addr.
Fixes the arm builds.
2017-11-04 12:14:41 +00:00
cherry
cb748883b1 Add a PIC_XEN abstraction to evtchn.c
This allows us to get XEN interrupt code closer to unification to x86/intr.c
2017-11-04 10:26:14 +00:00
cherry
d44f604cad protect header against recursive include 2017-11-04 09:31:08 +00:00
cherry
e3cb69cbc7 On XEN dom0, the function xen/x86/intr.c:xen_intr_map() is used to map
hardware interrupts to XEN callbacks called 'events'. This function
combines both the allocation and the binding.

This change is the first part of breaking up that combination into
xen_pirq_alloc() and the binding will happen as part of the
pic_addroute() callback of a new pseudo PIC_XEN

This code will be added later on.
2017-11-04 09:22:16 +00:00
maxv
eadcddde9f Add support for xsaveopt. It is basically an instruction that optimizes
context switch performance by not saving to memory FPU registers that are
known to be in their initial state or known not to have changed since the
last time they were saved to memory.

Our code is now compatible with the internal state tracking engine:
 - We don't modify the in-memory FPU state after doing an XSAVE/XSAVEOPT.
   That is to say, we always call XRSTOR first.
 - During a fork, the whole in-memory FPU state area is memcopied in the
   new PCB, and CR0_TS is set. Next time the forked thread uses the FPU it
   will fault, we migrate the area, call XRSTOR and clear CR0_TS. During
   this XRSTOR XSTATE_BV still contains the initial values, and it forces
   a reload of XINUSE.
 - Whenever software wants to change the in-memory FPU state, it manually
   sets XSTATE_BV[i]=1, which forces XINUSE[i]=1.
 - The address of the state passed to xrstor is always the same for a
   given LWP.

fpu_save_area_clear is changed not to force a reload of CW if fx_cw is
the standard FPU value. This way we have XINUSE[i]=0 for x87, and xsaveopt
will optimize this state.

Small benchmark:
	switch lwp to cpu2
	do float operation
	switch lwp to cpu3
	do float operation
Doing this 10^6 times in a loop, my cpu goes on average from 28,2 seconds
to 20,8 seconds.
2017-11-04 08:58:30 +00:00
cherry
3fa9af9488 On XEN PV, the ISA 8259A PIC is only used on dom0 2017-11-04 08:55:50 +00:00
kre
6c755bb23a Be more consistent with how we refer to fopen() - pointed out by wiz@ 2017-11-04 08:53:23 +00:00
cherry
03758b1fdc In XEN PV, the idt vector table is not required to be altered at
runtime, since only entries for exceptions/traps are registered with
the hypervisor and interrupts are managed via a completely different
mechanism.

This change uses the idt_vec_reserve() mechanism nevertheless,
modifying it slightly to only do namespace management in XEN, while on
native it will continue to do idt entry init as before.

Rationale: Consistent API usage and potential future merging of
XEN/non-XEN code.

There are no functional changes in this commit.
2017-11-04 08:50:47 +00:00
maya
849601163b Don't test for failure of malloc(...,M_WAITOK), it cannot fail 2017-11-04 08:33:28 +00:00
kre
1a3a8b3401 Some (mostly minor) wording improvements (IMO) 2017-11-04 08:04:40 +00:00
wiz
0858eb46a4 Fix xref. Remove Tn. 2017-11-04 07:59:17 +00:00
maxv
971c69d4e5 Always set XCR0_X87, to force a reload of CW. That's needed for compat
options where fx_cw is not the standard fpu value.
2017-11-04 07:38:42 +00:00
maxv
7b780dbf29 Fix xen. Not tested, but seems fine enough. 2017-11-04 07:35:00 +00:00
kre
1593016b98 Avoid losing a fd (ie: close it) in the (ever so likely) case that the
fd exceeds the limits of what can be stored in a FILE (65535).
2017-11-04 07:26:35 +00:00
kre
5b9cd7b760 Put back the tests for "no files matched" (in a different way than they
were written previously - but that's just style.)   This is not csh...

Use the correct test operator to test for an empty file (rather than
testing for an empty file name...)

Write test ('[') commands in a way that is defined to work, rather than
just happens to - we can afford the (negligible) performance hit here.
2017-11-04 07:04:01 +00:00
cherry
9c3ba17d30 opt_intrdebug.h - this unbreaks the i386 DOMU build under some conditions 2017-11-04 07:01:45 +00:00
christos
5523dfe33c oops, accidendally committed an earlier non-working version; fixed. 2017-11-04 06:15:56 +00:00
christos
403198c7bc Deal safely with recovery mail files. 2017-11-04 06:12:26 +00:00
christos
5cbc4ff306 - don't use command substitution to glob a pattern into a list of filenames;
it is less efficient than doing it directly and does not handle whitespace
  in filenames properly.
- change test to [
- quote variables
2017-11-04 05:43:18 +00:00
christos
1c0d8e6241 be more careful about opening recovery files... in particular deal with
people trying to get 'vi -r' stuck using named pipes, symlink attacks,
and coercing others opening recovery files they did not create.
2017-11-04 03:26:41 +00:00
christos
b4e5b9fac2 Implement nofollow (l) for fopen(3). 2017-11-04 02:49:55 +00:00
christos
e5e66fc581 use sizeof(*var) instead of sizeof(type) 2017-11-04 01:52:09 +00:00
nat
f9c961740c AU_RING_SIZE -> s.bufsize in audio_initbufs. 2017-11-04 01:50:48 +00:00
nat
5f873527bc Add AUDIO_ENCODING_SLINEAR to supported encodings. This allows sb, sbpro
& sb16 to configure with 8-bit precision.

Tested in games/mame with a 486DX emulation.
2017-11-04 01:46:56 +00:00
pgoyette
64ae8753d8 Remove the ABI version-and-length check that was recently introduced;
sysctl(9) ABIs should be stable across versions.

XXX Pull-up to -8
2017-11-03 22:45:14 +00:00
nat
96fab80f5b Blocksizes sould be rounded to a power of 2 as OSS applications need this.
Tested by martin@.
2017-11-03 21:15:18 +00:00