Commit Graph

236 Commits

Author SHA1 Message Date
Giacomo Tesio 1bc08b7631 kernel: rendezvous(~0, ...) unconditionally blocks
This commit introduce a special rendezvous point at (void*)~0 that
cannot be reached by any process, since it's not added to the
rendezvous group.

This turns the rendezvous syscall to a cheap way to block until
either a note or a wakeup from awake(2) occurs.

This new feature is used in libc's sleep: the test qa/kern/fork_chain
has shown that using a stack address as rendezvous point is not safe enougth
for sleep, since two different process forked from the same function can
call sleep with the same base pointer. This lead the wakeup variable in
jehanne_sleep to have the same address on both process.

TODO add a test that show this behaviour in the old code.
2017-07-21 01:49:00 +02:00
Giacomo Tesio c13d386ab5 libaml: import 9front's improvements 2017-07-21 01:34:34 +02:00
Giacomo Tesio 83e3161789 kernel: fix ancient bug in GDT initialization 2017-06-08 04:03:32 +02:00
Giacomo Tesio 2a38ee6ab6 qa: fix typo in test 2017-06-06 19:53:45 +02:00
Giacomo Tesio 4f97f4a80b qa: disable broken tests 2017-06-05 22:11:36 +02:00
Giacomo Tesio 9f4472c3bb kernel: simplified fork_chain test 2017-06-05 19:25:08 +02:00
Giacomo Tesio 2269a4bbd0 kernel: minimal test that panic the mmu code 2017-06-03 23:23:42 +02:00
Giacomo Tesio 87de13f1e0 kernel: mmuptpcheck: use less global memory 2017-05-31 01:10:18 +02:00
Giacomo Tesio 7108477c32 kernel: simplify mmuput 2017-05-30 22:41:44 +02:00
Giacomo Tesio 28c426055d libposix: fix disposition for signals that are ignored by default 2017-05-30 01:15:25 +02:00
Giacomo Tesio a64a7b0d0e qa: check that notes cannot eat wait messages 2017-05-30 01:00:03 +02:00
Giacomo Tesio 6bd285bdaa libposix: fix SIGCLD disposition; use PosixSIGCHLD to identify the signal when SIGCHLD == SIGCLD 2017-05-30 00:49:28 +02:00
Giacomo Tesio c45cffeaf5 cmd: fix ancient bug on consolefs flush 2017-05-30 00:11:34 +02:00
Giacomo Tesio a8d42cecc9 newlib: use SIGINT to avoid abort 2017-05-29 23:45:00 +02:00
Giacomo Tesio e525113266 libposix: cleanups 2017-05-29 23:27:30 +02:00
Giacomo Tesio d1e285f721 libposix: honor SIG_IGN by doing nothing (DRAFT) 2017-05-29 02:04:48 +02:00
Giacomo Tesio 9dc9001469 newlib: test ignored signals (broken) 2017-05-29 01:53:37 +02:00
Giacomo Tesio 559e5429ed newlib: tests for sigchld 2017-05-29 01:42:08 +02:00
Giacomo Tesio f6d44667f2 libposix: fix bind #p and POSIX_kill sigrtmin/sigrtmax usage 2017-05-29 01:11:07 +02:00
Giacomo Tesio fe168aa55d newlib: introduce tests for SIGCHLD 2017-05-26 02:12:42 +02:00
Giacomo Tesio 40ccb89835 libc: simplify Waitmsg 2017-05-26 01:55:09 +02:00
Giacomo Tesio 5ca0ef085c newlib: fix test for SIGSTOP/SIGCONT 2017-05-26 00:39:47 +02:00
Giacomo Tesio ac9969dadd libposix: fix signals when no realtime signal is supported 2017-05-26 00:27:48 +02:00
Giacomo Tesio 439326fa1f newlib: enabled more tests for signals (still broken) 2017-05-25 22:43:38 +02:00
Giacomo Tesio abfc6958d6 libposix: build again 2017-05-25 22:42:20 +02:00
Giacomo Tesio a59b992ed4 libposix: more code for signals 2017-05-25 01:04:53 +02:00
Giacomo Tesio 68bc46fe85 libposix: initial changes to POSIX_kill 2017-05-24 00:40:28 +02:00
Giacomo Tesio 3381f75d03 libposix: fix typo 2017-05-24 00:08:00 +02:00
Giacomo Tesio 3307c1e7e2 libposix: drafted Child structure 2017-05-24 00:04:30 +02:00
Giacomo Tesio 6b70ea29e2 Merge branch 'gcc-O2' of https://bitbucket.org/tesio/jehanne into gcc-O2 2017-05-23 22:57:41 +02:00
Giacomo Tesio e0610f6b71 libposix: drafted SIGCHLD management 2017-05-23 00:27:50 +02:00
Giacomo Tesio f9c63742bb qa: simplify test that crash with -O2 2017-05-22 23:18:47 +02:00
Giacomo Tesio c27b2aa93b kern: remove unused l64acidt.S 2017-05-22 00:45:03 +02:00
Giacomo Tesio 1eb450510a qa: add test that crash with -O2 2017-05-21 23:16:41 +02:00
Giacomo Tesio cc595c7c99 kernel: save and restore all registers on syscall 2017-05-21 00:15:51 +02:00
Giacomo Tesio 4b7957a28f kernel: simplify init code 2017-05-20 14:06:26 +02:00
Giacomo Tesio aedc31e925 libstdio: fix uninitialized variables 2017-05-19 01:33:09 +02:00
Giacomo Tesio 3b4af1e4d8 gcc: enable -O2 compilation
To enable -O2 compilation we have to disable some optimizations:

- strict-aliasing (TODO: introduce required unions to enable this)
- aggressive-loop-optimizations
- array-bounds

Affected builds are

- sys/src/cmd/dossrv/build.json
- sys/src/cmd/ip/build.json
- sys/src/lib/authsrv/build.json
- sys/src/lib/memdraw/build.json
2017-05-19 01:15:34 +02:00
Giacomo Tesio fa15f817c4 qa: avoid cast that preclude strict aliasing 2017-05-19 01:09:51 +02:00
Giacomo Tesio 913b1361dc u.h: (try) to avoid optimizations of syscall arguments 2017-05-19 01:02:42 +02:00
Giacomo Tesio 901962f6c9 cmds: avoid duplicated compilation of ip tools 2017-05-19 00:54:23 +02:00
Giacomo Tesio 802bd8368a travis-ci: fix dotter, again 2017-05-18 22:47:37 +02:00
Giacomo Tesio 4de6a61310 travis-ci: fix dotters 2017-05-18 21:13:56 +02:00
Giacomo Tesio d3fe64ac87 newlib: fix usleep; signal improvements 2017-05-18 02:13:13 +02:00
Giacomo Tesio 22d90985a5 kernel: awake() wake up only truly blocking syscalls
If a syscall did not entered sleep(), the pendingWakeup is not consumed.
2017-05-17 02:04:08 +02:00
Giacomo Tesio 1dc8991331 kernel: reset and restore up->cursyscall in trap
This way sleep() knows that it should not interrupt the process
to serve awake().

Also rename Proc.insyscall to Proc.inkernel since that's the meaning
of the flag, which is only read to serve awake()'s mechanics and
to accounttime(). Indeed faultAmd64 was setting insyscall to 1.
2017-05-17 01:16:49 +02:00
Giacomo Tesio 960e8a0d4e qa/kern: more tests for awake 2017-05-17 00:52:16 +02:00
Giacomo Tesio 2b1baf8de1 kernel: devpipe: fix error management on writes
The "write on closed pipe" note should be posted only
if the write occurred on a closed pipe.

Before this fix, on any interrupt caused the note to be sent,
despite the pipe being open and fully working.
2017-05-17 00:27:57 +02:00
Giacomo Tesio 031201a1ac kernel: reset process wakeups on exec 2017-05-15 00:35:22 +02:00
Giacomo Tesio f9b2e9aba4 kernel: generalize awake
Awake can now interrupt several blocking syscalls (even
during note handling).

Among others, it can interrupt await, pread and pwrite.

It cannot interrupt several others for different reasons:

- awake cannot be interrupted by awake;
- syscalls like remove and create can be used for kernel comunication
  and it would be hard to know if the effect occurred in the
  receiving fs if they were interrupted;
- other syscalls do not need awake since they just provide access
  to kernel infos (eg seek or fd2path)

NOTE: awakes registered before a note cannot occur during the note
handling and will be deferred till the next call to noted.
2017-05-15 00:05:59 +02:00