Commit Graph

19543 Commits

Author SHA1 Message Date
maya 07975b2231 Make CLEANFILES actually work. .TARGET is not defined when not in a target
rule.

Thanks xtos for the heads up.
2019-05-07 18:45:37 +00:00
maya 53af5ae4cc Replace the link command for libpthread.a so that we create a single section
with all the libpthread symbols in it.
This makes -lpthread behave like to -Wl,--whole-archive -lpthread.

This avoids a situation where threaded static binaries use some libc thread
stubs, which are racy.

Fixes PR lib/54001: call_once2_32, call_once2_static test cases failing on
amd64 since gcc7 import.

Suggested by Jonathan Wakely, thanks!
2019-05-07 18:12:53 +00:00
wiz fd62bcefca Remove extra word. 2019-05-06 06:56:36 +00:00
christos 0e2d77f8ff document the EINVAL caused by a large nfds. 2019-05-06 00:50:26 +00:00
scole 5b44457805 add stop (;;) to elimate WAW dependency compiler warning 2019-05-04 22:55:32 +00:00
mgorny c1c809ed5e Explicitly indicate that nexttowardl() is identical to nextafterl().
Requested by kamil.
2019-05-02 15:08:35 +00:00
maxv 0d954de6fa Use the comm page to inject events, rather than ioctls, and commit them in
vcpu_run. This saves a few syscalls and copyins.

For example on Windows 10, moving the mouse from the left to right sides of
the screen generates ~500 events, which now don't result in syscalls.

The error handling is done in vcpu_run and it is less precise, but this
doesn't matter a lot, and will be solved with future NVMM error codes.
2019-05-01 09:20:21 +00:00
kamil 45dae6038c Avoid incompatible function pointer casts in thrd_create(3)
Use an intermediate function trampoline to workaround different function
pointer prototypes.

While there, correct scenario returning thrd_nomem from thrd_create(3).
In practice ENOMEM is rarely returned from pthread(3).

Older code worked on tested ports, but was depending on unneeded UB.
2019-04-29 20:11:43 +00:00
maxv 6c51ea96f5 sync with reality 2019-04-29 19:03:17 +00:00
maxv 250161fe1f Stop taking care of the INT/NMI windows in the kernel, the emulator is
supposed to do that itself.
2019-04-29 18:54:25 +00:00
maxv c49a183c64 Remove useless calls to nvmm_init(). 2019-04-29 17:27:57 +00:00
kre 63e182f423 snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0
The F spec is one of those, it should be terminated with \0 just like all
the others (irrelevant that it has no extra data to delimit).

Fix <sys/mman.h> to define the snprintb() format string correctly (include
the missing \0's).   Fix the copy of that definition included into
snprintb(3) to match the updated mman.h version (ride the date bump
from the day before yesterday .. this is the same change, just corrected).

Undo the previous snprintb.c change ("off by one" fix) which was an
attempt to make the broken mman.h usage work (and did, but not the way
it should be done).   Also, after using the new * format (instead of only
when something has already matched) skip the associated data so we don't
attempt to interpret it as more field specifiers.  This func needs lots of TLC!

Fix the ATF tests for snprintb() to not assume that F format is really
exactly like f format, and has data after the field specifier.  It doesn't.
Add several more tests (including testing the '*' field operator
recently added).
2019-04-29 07:55:38 +00:00
maxv f973734497 Modify the communication layer between the kernel NVMM driver and libnvmm:
introduce a bidirectionnal "comm page", a page of memory shared between
the kernel and userland, and used to transfer data in and out in a more
performant manner than ioctls.

The comm page contains the VCPU state, plus three flags:

 - "wanted": the states the kernel must get/set when requested via ioctls
 - "cached": the states that are in the comm page
 - "commit": the states the kernel must set in vcpu_run

The idea is to avoid performing expensive syscalls, by using the VCPU
state cached, either explicitly or speculatively, in the comm page. For
example, if the state is cached we do a direct 1->5 with no syscall:

          +---------------------------------------------+
          |                    Qemu                     |
          +---------------------------------------------+
               |                                   ^
               | (0) nvmm_vcpu_getstate            | (6) Done
               |                                   |
               V                                   |
             +---------------------------------------+
             |                libnvmm                |
             +---------------------------------------+
                  |   ^          |               ^
        (1) State |   | (2) No   | (3) Ioctl:    | (5) Ok, state
        cached?   |   |          | "please cache | fetched
                  |   |          |  the state"   |
                  V   |          |               |
              +-----------+      |               |
              | Comm Page |------+---------------+
              +-----------+      |
                       ^         |
          (4) "Alright |         V
               babe"   |     +--------+
                       +-----| Kernel |
                             +--------+

The main changes in behavior are:

 - nvmm_vcpu_getstate(): won't emit a syscall if the state is already
   cached in the comm page, will just fetch from the comm page directly
 - nvmm_vcpu_setstate(): won't emit a syscall at all, will just cache
   the wanted state in the comm page
 - nvmm_vcpu_run(): will commit the to-be-set state in the comm page,
   as previously requested by nvmm_vcpu_setstate()

In addition to this, the kernel NVMM driver is changed to speculatively
cache certain states known to be of interest, so that the future
nvmm_vcpu_getstate() calls libnvmm or the emulator will perform will use
the comm page rather than expensive syscalls. For example, if an I/O
VMEXIT occurs, the I/O Assist in libnvmm will want GPRS+SEGS+CRS+MSRS,
and now the kernel caches all of that in the comm page before returning
to userland.

Overall, in a normal run of Windows 10, this saves several millions of
syscalls. Eg on a 4CPU Intel with 4VCPUs, booting the Win10 install ISO
goes from taking 1min35 to taking 1min16.

The libnvmm API is not changed, but the ABI is. If we changed the API it
would be possible to save expensive memcpys on libnvmm's side. This will
be avoided in a future version. The comm page can also be extended to
implement future services.
2019-04-28 14:22:13 +00:00
wiz 6d61444732 Remove undefined \*H 2019-04-28 07:33:02 +00:00
kamil 0c003f5999 Add a C99 symbol to libm: nexttowardl
It's an alias for an already existing symbol nextafterl.

Patch obtained from <mgorny>

Detected by the LLVM buildbot breakage in tests.
2019-04-27 23:04:31 +00:00
pgoyette 7b4757a125 s/three/multiple/
Adjust text for consistency.  There are already more than three interval
timers available, and who knows if even more might be added in the future.
2019-04-27 22:00:29 +00:00
wiz fa9ca235d8 Remove trailing whitespace. 2019-04-27 17:58:51 +00:00
christos 1d8a803c77 remove dup line 2019-04-27 17:48:13 +00:00
christos ca3496f0f1 Document the '*' field and give a more complex example with F and *. 2019-04-27 17:46:08 +00:00
maxv 6296b43f91 Reorder the NVMM headers, to make a clear(er) distinction between MI and
MD. Also use #defines for the exit reasons rather than an union. No ABI
change, and no API change except 'cap->u.{}' renamed to 'cap->arch'.
2019-04-27 15:45:21 +00:00
wiz 1dcc590110 Fix some typos, improve wording. 2019-04-27 10:57:11 +00:00
christos ef72f68d26 Follow the man page for EL_GETTC and not require a NULL terminated argument
list: https://reviews.llvm.org/D61191
2019-04-26 16:56:57 +00:00
maya 6717e848e2 Remove unused 387 implementations.
These were removed from the build for being wrong, but the implementation
stayed around. This is confusing, we have the attic for old code,
let's delete the unused implementations.
2019-04-26 10:11:14 +00:00
maya 30a5aeb5c6 Unify signbitl implementations.
(Unclear why they were different, it was only the comments that
differed)

Add a comment describing why the generic version works for both 80-bit
and 128-bit double.
2019-04-26 09:03:46 +00:00
maya 3cdbcb3e1b document cosl with MLINKS and in the man page 2019-04-25 23:17:24 +00:00
kamil c3c6e74f96 Drop error path from C11 call_once
The original implementation of C11 threads(3) contained check for error
paths, but it was stripped in the calls that are documented to return
no status from an operation. Do the same in call_once(3).
2019-04-24 21:41:15 +00:00
kamil d39119472e Introduce minor changes to the C11 threading library
Switch tss_t type from int to pthread_key_t (no functional change as
pthread_key_t was already typedefed as int).

Noted by <enh from Google>.

Use C11 _Noreturn in thrd_exit(3) instead of NetBSD specific __dead.
The former is documented in the standard as an attribute of thrd_exit(3),
the latter is more portable to pre-C11 compilers, however C11 thread
support library needs C11 compiler for TLS anyway. __dead made a little bit
more point 3 years ago than today as 3 years ago pre-C11 compilers were
more common.
2019-04-24 18:47:54 +00:00
kamil 945ffcea06 Bump the libpthread(3) minor number to 4
Added C11 Threading library support.
2019-04-24 13:01:52 +00:00
kamil a9ca1710c0 Add a complete C11 threads(3) implementation
C11 Thread support library is a portable threading C API between OSs,
similar to std::threads in the C++ world.

The library is implemented as a thin shim over POSIX interfaces.

NetBSD implements the API as a part of the POSIX threading library
(libpthread(3)).

C11 threads(3) are in the process of making them an integral part
of the POSIX standard. The interface has been implemented in major
OSs and used with stopgap libraries for older versions of them.

C11 threading library is already used (with a stopgap implementation)
in the NetBSD distribution in MESA.

Original implementation by myself from 2016.

ATF tests are new and cover almost all interfaces.

Proposed on tech-userlevel@.
2019-04-24 11:43:19 +00:00
roy a7dfaa63f1 Fix building librpcsvc for MKYP=no 2019-04-24 10:26:43 +00:00
blymn 7d6b8c3110 Add/improve debug output for some routines. 2019-04-24 07:09:44 +00:00
abhinav 63147cb59c PR lib/54131 - declare the loop variable outside the for loop 2019-04-20 08:44:10 +00:00
wiz 21e57c7819 Remove 'No' macros with no effect.
Add width to table.
Fix en-dashes.
2019-04-20 07:27:39 +00:00
pgoyette 099c595280 Note restrictions on return values from tzgetname() and tzgmtoff() 2019-04-18 11:20:17 +00:00
christos d5e956832a Pick up the latest matching (most recent) entry instead of the first one.
This fixes:
	env TZ=Australia/Melbourne date
printing
	Thu Apr 18 03:32:32 LMT 2019
instead of:
	Thu Apr 18 03:32:32 AEST 2019

XXX: To be strictly correct, the tzgetname() call should probably take a time
reference point in order to return the appropriate zone name for the time
given.
2019-04-17 17:37:29 +00:00
maya bac778e85c fix typo 2019-04-17 12:30:51 +00:00
mrg 261a15423e also want s_nexttoward.c on riscv. now tests/lib/libm links. 2019-04-17 07:45:23 +00:00
mrg 134005bc02 revert previously. we want riscv32 to have 128 bit long double...
shall fix the compiler instead.
2019-04-16 08:04:23 +00:00
mrg 9840b30120 risc32 doesn't want long double specific versions 2019-04-16 07:32:30 +00:00
maya 085f60235e we need rintl (long double) to link binaries 2019-04-15 18:44:26 +00:00
maya 0f71666ae3 Cargo cult follow the other 128bit long double architecture (sparc64). 2019-04-15 18:41:06 +00:00
maya 5377f92471 Provide a definition of quiet NaN for RISC-V, and a reference to where
it comes from.
2019-04-14 19:25:27 +00:00
maya 4dfcde7b82 build the generic 128bit long double code. 2019-04-13 17:54:13 +00:00
maya a0aab386b6 Don't alias the long double version to the double version.
We now have 128bit long double (by the upstream GCC changing things)
2019-04-13 17:18:26 +00:00
maya 3d7906cf61 Looks like libc is too big to be able to use j. use a longer distance jump 2019-04-13 16:08:54 +00:00
christos 2f37aad7a2 PR/52359: Benjamin Lorenz: When resizing because of a signal save and restore
the cursor position, since it does not change.
2019-04-12 17:30:49 +00:00
christos 7512edc245 PR/54117: Paavo Helde: Fix memory overrun: Account for the closing quote
in memory allocation if quoted.
2019-04-12 15:12:29 +00:00
abhinav 2373d24da1 Markup improvements: use Dv for kqueue filters, events and note names
ok wiz@
2019-04-12 10:57:27 +00:00
jakllsch 634d295103 fix typo in error message; database is spelled with one 'b' and three 'a's 2019-04-11 23:52:08 +00:00
wiz 6bd7c569be Avoid marking up semicolons. 2019-04-11 06:18:43 +00:00