151 Commits

Author SHA1 Message Date
Sebastian Huber
b42dea9e51 CONFIG_INTRHOOK(9): Port to RTEMS
Some device drivers (e.g. MMC) need a complex intialization with working
callouts.  Remove the dummy CONFIG_INTRHOOK() implementation and replace
it with the real one from FreeBSD.  Make sure TIMEOUT(9) services work
at this point.

Update #3525.
2018-09-25 10:01:15 +02:00
Sebastian Huber
3489e3b639 Update to FreeBSD head 2018-09-17
Git mirror commit 6c2192b1ef8c50788c751f878552526800b1e319.

Update #3472.
2018-09-21 10:29:41 +02:00
Sebastian Huber
bcdce02d9b Update to FreeBSD head 2018-06-01
Git mirror commit fb63610a69b0eb7f69a201ba05c4c1a7a2739cf9.

Update #3472.
2018-09-21 10:29:41 +02:00
Sebastian Huber
2df56dbd60 Update to FreeBSD head 2018-04-01
Git mirror commit 8dfb1ccc26d1cea7e2529303003ff61f9f1784c4.

Update #3472.
2018-09-21 10:29:40 +02:00
Sebastian Huber
18fa92c2dc Update to FreeBSD head 2018-02-01
Git mirror commit d079ae0442af8fa3cfd6d7ede190d04e64a2c0d4.

Update #3472.
2018-09-21 10:29:39 +02:00
Sebastian Huber
bb80d9df8b Update to FreeBSD head 2017-12-01
Git mirror commit e724f51f811a4b2bd29447f8b85ab5c2f9b88266.

Update #3472.
2018-09-21 10:29:38 +02:00
Sebastian Huber
e4a8065910 Update to FreeBSD head 2017-10-01
Git mirror commit b2f0376b45428f13151d229c5ae9d4d8f74acbd1.

Update #3472.
2018-09-21 10:29:37 +02:00
Sebastian Huber
c37f9fba70 Update to FreeBSD head 2017-08-01
Git mirror commit f5002f5e5f78cae9f0269d812dc0aedb0339312c.

Update #3472.
2018-09-21 10:29:37 +02:00
Sebastian Huber
de261e0404 Update to FreeBSD head 2017-06-01
Git mirror commit dfb26efac4ce9101dda240e94d9ab53f80a9e131.

Update #3472.
2018-09-21 10:29:36 +02:00
Sebastian Huber
a85d90007e Optimize callout handline via static timer wheel
The number of callouts is a compile-time constant in libbsd.  Use this
in struct callout_cpu and avoid dynamic allocation of tables.  This
signficantly reduces the count of load instructions in the callout
handling.
2018-09-17 09:12:06 +02:00
Sebastian Huber
cf447b951a Remove struct callout::c_cpu
This is an optimization of the callout handling.  In libbsd all callouts
are handled by the one and only timer server.
2018-09-17 09:10:52 +02:00
Sebastian Huber
0963419598 Fix alignment of getsockaddr_sockaddr 2018-08-24 09:06:31 +02:00
Sebastian Huber
12a885cd18 Update due to <sys/time.h> API changes
Changes correspond to FreeBSD commit:

"Make timespecadd(3) and friends public

The timespecadd(3) family of macros were imported from NetBSD back in
r35029. However, they were initially guarded by #ifdef _KERNEL. In the
meantime, we have grown at least 28 syscalls that use timespecs in some
way, leading many programs both inside and outside of the base system to
redefine those macros. It's better just to make the definitions public.

Our kernel currently defines two-argument versions of timespecadd and
timespecsub.  NetBSD, OpenBSD, and FreeDesktop.org's libbsd, however, define
three-argument versions.  Solaris also defines a three-argument version, but
only in its kernel.  This revision changes our definition to match the
common three-argument version.

Bump _FreeBSD_version due to the breaking KPI change.

Discussed with: cem, jilles, ian, bde
Differential Revision:  https://reviews.freebsd.org/D14725"

Update #3472.
2018-08-24 08:57:10 +02:00
Sebastian Huber
137250239e Make sure CALLOUT_DFRMIGRATION is not used
This flag supports the callout migration in FreeBSD.  This feature is
not supported by libbsd.
2018-07-26 14:49:35 +02:00
Sebastian Huber
e37f03e47a Make sure CALLOUT_PROCESSED is not used
This flag is only used in combination with the callout expire list,
which we do not use in libbsd.
2018-07-26 14:35:56 +02:00
Sebastian Huber
6d9d7b1956 Critical bug fix for callouts
FreeBSD has two callout executors, one in software and one in hardware
interrupt context.  In libbsd, all callouts are executed by the timer
server.  Entirely remove the different execution contexts for libbsd.
Previously, this was not properly done which could result an invalid
callout_drain() sequence leading to system memory corruption.
2018-07-26 14:12:46 +02:00
Sebastian Huber
94b5368388 Avoid malloc() in getsockaddr()
The getsockaddr() function is used to allocate a struct sockaddr of the
right length and initialize it with userspace provided data.  It is used
for the connect(), bind() and sendit() family functions.  In particular,
the sendit() function is used by the UDP send functions.  This means
each UDP send needs a malloc() and free() invocation.  This is a
performance problem in RTEMS (first-fit heap) and may lead to heap
fragmentation.  Replace the malloc() allocation with a stack allocation.
This requires SOCK_MAXADDRLEN (= 255) of additional stack space for
libbsd.

A further optimization would be to get rid of the stack copy of the
socket address.  However, this would require to check each consumer of
the address to ensure that it is not modified.
2018-07-04 07:20:37 +02:00
Sebastian Huber
a0633c51db SLEEPQUEUE(9): Update due to API changes
Update #3264.
2018-02-05 10:56:39 +01:00
Sebastian Huber
b03a1c0b59 Fix file descriptor reference counting in accept()
Update #3132.
2017-11-15 13:25:28 +01:00
Sebastian Huber
057656b706 Disable HHOOK(9) support for sockets
Support was only partly disabled leading to NULL pointer accesses.
Disable it completely.
2017-11-10 11:16:14 +01:00
Sebastian Huber
72d5fa11a8 Fix reference counting for file descriptors
Update #3132.
2017-11-10 11:01:54 +01:00
Sebastian Huber
f7f3c4b0de blist: Import from FreeBSD 2017-10-20 14:59:55 +02:00
Sebastian Huber
62c8ca0ead Fix INVARIANTS support 2017-10-20 14:59:55 +02:00
Sebastian Huber
a8e84c62ae DEVICE(9): Avoid NULL pointer access 2017-10-20 14:59:54 +02:00
Sebastian Huber
9a583a94d3 SLEEPQUEUE(9): Update due to API changes
Update #3117.
Update #3182.
2017-10-17 13:56:38 +02:00
Sebastian Huber
894c965d95 Support reference counting for file descriptors
Close #3132.
2017-09-15 12:46:57 +02:00
Sebastian Huber
6e328c38b1 KQUEUE(2): Add missing file handler 2017-07-28 08:46:21 +02:00
Sebastian Huber
17ab62cbdd PIPE(2): Add missing file handler 2017-07-28 08:46:20 +02:00
Sebastian Huber
091321081a SOCKET(2): Add missing file handler 2017-07-28 08:46:18 +02:00
Sebastian Huber
3c967ca238 Use <sys/lock.h> provided by Newlib 2017-06-08 13:20:09 +02:00
Sebastian Huber
02373194fe Update due to Newlib 2017-06-07 changes
The following files are now provided by Newlib:

  * arpa/inet.h
  * net/if.h
  * netinet/in.h
  * netinet/tcp.h
  * sys/socket.h
  * sys/uio.h
  * sys/un.h

The <sys/param.h> and <sys/cpuset.h> are now compatible enough to be
used directly.

Update #2833.
2017-06-08 13:19:54 +02:00
Kevin Kirspel
817cbf7201 devfs: Fix some issues
Fix issue with cdev private data usage with RTEMS iop structure. Add
support for cdev alias device names. Add support for cdev fstat.
2017-05-12 14:20:33 +02:00
Kevin Kirspel
4a8f953f62 Updating FREEBSD for tty support 2017-05-11 11:15:41 +02:00
Kevin Kirspel
f6c52e086d Adding tty support files from FREEBSD tree 2017-05-11 11:15:41 +02:00
Sebastian Huber
de8a76da2f Update to FreeBSD head 2017-04-04
Git mirror commit 642b174daddbd0efd9bb5f242c43f4ab4db6869f.
2017-04-04 14:46:23 +02:00
Sebastian Huber
0732183638 Fix SOCK_CLOEXEC with socket() and socketpair()
Remove SOCK_CLOEXEC flag to get a valid socket type, e.g. to avoid a
EPROTOTYPE in case of socket(..., SOCK_DGRAM | SOCK_CLOEXEC, ...).
2017-03-14 07:15:34 +01:00
Sebastian Huber
5268338be3 Provide sbuf_hexdump() 2017-03-06 12:06:19 +01:00
Sebastian Huber
57ba8ad63c Avoid kern_unsetenv() 2017-03-06 12:05:54 +01:00
Sebastian Huber
5e093a5bcb SLEEPQUEUE(9): Fix absolute timeouts
The FreeBSD kernel timeouts are always based on the uptime.  Thus, we
have to use the relative watchdog.  C_ABSOLUTE just means that the
timeout value is already an uptime value.

https://lists.freebsd.org/pipermail/freebsd-hackers/2017-February/050572.html
2017-02-28 10:07:30 +01:00
Sebastian Huber
1fd5083234 SLEEPQUEUE(9): Add wmesg to thread wait info 2017-01-31 09:50:45 +01:00
Sebastian Huber
ee94f8a8ea rtems-bsd-mutex: Use thread queue name 2017-01-31 09:49:49 +01:00
Christian Mauderer
66eb1437f2 firmware: Port to RTEMS. 2017-01-17 12:50:57 +01:00
Christian Mauderer
2e8dd24b7c firmware: Import from FreeBSD. 2017-01-17 12:50:57 +01:00
Sebastian Huber
172f2acb2b Use thread name support
Update #2858.
2017-01-13 09:20:43 +01:00
Sebastian Huber
0577772720 Update to FreeBSD head 2017-01-09
Git mirror commit 1f8e4a995a6ede4bdb24e6d335ccda2bdb0175ab.
2017-01-10 11:03:27 +01:00
Sebastian Huber
75b706fde4 Update to FreeBSD head 2016-12-10
Git mirror commit 80c55f08a05ab3b26a73b226ccb56adc3122a55c.
2017-01-10 09:53:34 +01:00
Sebastian Huber
c40e45b75e Update to FreeBSD head 2016-08-23
Git mirror commit 9fe7c416e6abb28b1398fd3e5687099846800cfd.
2017-01-10 09:53:31 +01:00
Sebastian Huber
750b2d4294 Workaround for <sys/event.h> update 2017-01-09 14:54:21 +01:00
Kevin Kirspel
b1580fb039 PIPE(2): Port to RTEMS 2016-12-23 08:26:14 +01:00
Kevin Kirspel
6959face72 PIPE(2): Import from FreeBSD 2016-12-23 08:24:12 +01:00