112 Commits

Author SHA1 Message Date
93dfad6b0b kernel: print proc info on addbroken 2017-08-12 23:32:35 +02:00
ecc2125b28 Revert "kernel: import sdahci from 9front"
This reverts commit d9975caeb001e83ef89c9bce8865c70bf97d6404.
2017-08-12 15:18:02 +02:00
aef20dca20 kernel: fix.c: fix inverted CHS bit 2017-08-11 06:12:44 +02:00
d9975caeb0 kernel: import sdahci from 9front 2017-08-11 05:26:53 +02:00
93dde48355 kernel: deep refactoring and cleanup
This large commit address several issues
- removed 386 directory: Jehanne is 64bit only
- simplified kernel options management
- rewritten boot process
- ported memory related stuff from 9front's 9/pc64
- removed devacpi
- removed old code
- deep refactor of awake syscall
- removed MCACHE support for mount
- fix libc's setjmp/longjmp
2017-08-11 03:18:32 +02:00
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
83e3161789 kernel: fix ancient bug in GDT initialization 2017-06-08 04:03:32 +02:00
4f97f4a80b qa: disable broken tests 2017-06-05 22:11:36 +02:00
87de13f1e0 kernel: mmuptpcheck: use less global memory 2017-05-31 01:10:18 +02:00
7108477c32 kernel: simplify mmuput 2017-05-30 22:41:44 +02:00
c27b2aa93b kern: remove unused l64acidt.S 2017-05-22 00:45:03 +02:00
cc595c7c99 kernel: save and restore all registers on syscall 2017-05-21 00:15:51 +02:00
4b7957a28f kernel: simplify init code 2017-05-20 14:06:26 +02:00
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
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
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
031201a1ac kernel: reset process wakeups on exec 2017-05-15 00:35:22 +02:00
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
b08218529d devproc: can't wait for up to stop 2017-05-06 16:03:16 +02:00
ac33157c37 kern: usbehcipc.c fix CID 155940: Out-of-bounds write 2017-04-25 16:07:47 +02:00
80a8501c05 kern/ip/gre: fix CID 156224: Uninitialized scalar variable 2017-04-25 15:53:20 +02:00
ea6f34f4f7 kern: mark pexit() as noreturn
Since pexit() calls sched() it wont return to the caller.
Should fix

- CID 155655: Missing break in switch
- CID 155672: Missing break in switch
2017-04-24 09:55:45 +02:00
e70feee4a3 libc: introduce "jehanne_" namespace
With this commit all functions declared in libc.h have been renamed
with the "jehanne_" prefix. This is done for several reason:

- it removes conflicts during symbol resolution when linking
  standard C libraries like newlib or musl
- it allows programs depending on a standard C library to directly
  link to a library depending on our non standard libc (eg libsec).

To ease transiction two files are provided:

- sys/include/lib9.h that can be included instead of <libc.h> to use
  the old names (via a simple set of macros)
- sys/src/lib/c/lib9.c that can be compiled with a program where the
  macro provided by lib9.h are too dumb (see for example rc or grep).

In the kernel port/lib.h has been modified accordingly and some of
the functions it directly provides has been renamed too (eg malloc
in qmalloc.c and print in devcons.c).
2017-04-19 23:48:21 +02:00
1f59502bf5 kernel/boot: #ec/console (from kernel args) defines the console to start 2017-02-04 01:04:51 +01:00
19bf511603 kernel: devdup: fix dup(n, 0)
Completes e1a14b49bedbaf836bad0775686ef3da9e07c1ae
2017-01-24 22:24:55 +01:00
edd84db070 kernel: import 9front's PCI improvements 2017-01-24 22:24:43 +01:00
c2b06ebf80 kernel: fix out of bound read in trap()
Reported by coverity, CID 155927: if vno == 32 it would access index
32 of excname at trap.c:339.
2017-01-24 22:24:20 +01:00
6dd0f2e130 kernel: use pprint instead of print in elf64ldseg.
Should also fix CID 156242, CID 156240 and CID 156236 avoiding
access to uninitialized pointers (get64, get32 and get16).
2017-01-24 22:23:17 +01:00
db8aab1a04 kernel: boot: fix more dup() leaks reported by coverity 2017-01-24 22:22:58 +01:00
49040ffdaa kernel: boot: fix dup() leaks reported by coverity 2017-01-17 22:01:15 +01:00
e1a14b49be kernel: devdup: fix dup(n, 0)
A successful dup(n, 0) must not return -1L
2017-01-17 21:48:33 +01:00
6daa49324a kernel: umem: fix frees in segments_fill
CID 155453 (#1 of 1): Free of address-of expression (BAD_FREE)
address_free: free frees address of (segments + 0).pages.
2017-01-17 00:26:23 +01:00
20f15cbe5a kernel: fix not null terminated string in options()
CID 155471 (#1 of 1): Buffer not null terminated (BUFFER_SIZE_WARNING)67.
buffer_size_warning: Calling strncpy with a maximum size argument of 256 bytes on destination array envcopy of size 256 bytes might leave the destination string unterminated.
2017-01-17 00:18:18 +01:00
042e206d13 kernel: devrtc: fix use of uninitialized array in rtcextract
CID 156229: Uninitialized scalar variable (UNINIT)9.
uninit_use: Using uninitialized value bcdclock[0].
2017-01-16 02:00:10 +01:00
237b7709ae kernel: umem: fix use of uninitialized fptr in freelist_pop
CID 156230 (#1 of 1): Uninitialized pointer read (UNINIT)9.
uninit_use: Using uninitialized value fptr.
2017-01-15 01:59:41 +01:00
1cb4610ed2 kernel: udp: fix read of uninitialized array
CID 156231 (#1 of 1): Uninitialized scalar variable (UNINIT)6.
uninit_use_in_call: Using uninitialized element of array laddr when calling memcmp.
2017-01-15 01:35:28 +01:00
f2f95a935f kernel: fix use of uninitialized value in freelist_pop
CID 156233 (#1 of 1): Uninitialized pointer read (UNINIT)5. uninit_use: Using uninitialized value fimg.
2017-01-15 01:03:35 +01:00
c4fb99ec38 qa: fix a few issues detected by coverity 2017-01-14 17:58:33 +01:00
0de2dfc95b kernel: fix /dev/swap and stats -m 2017-01-12 00:41:14 +01:00
d1cc947cd9 kernel: fix fd mode print in devproc 2017-01-12 00:39:50 +01:00
e93aafc028 qa: build everything with -Werror 2017-01-12 00:38:56 +01:00
51d12f1f34 kernel: fix #0/brk/ qid (it's a special directory, not a special file) 2017-01-09 00:44:01 +01:00
a8e2247e20 kernel: drop SysNsec references from syscall() 2017-01-06 01:40:04 +01:00
4676c65a3d kernel: move nsec to libc 2017-01-06 00:56:22 +01:00
2508de40ea kernel: move sysdup to libc 2017-01-06 00:56:22 +01:00
c342234d74 kernel: print faults to process standard error 2017-01-06 00:54:04 +01:00
890f126abc kernel: fix usb after changing OREAD/OWRITE values
OREAD and OWRITE are used as array indexes assuming that OREAD was zero
and OWRITE was one. Thus each related allocation reserved just 2 slot and
even Ep struct in usb.h reserved just 2 int for toggles.

Since OREAD is now 1 and OWRITE is 2 we have to allocate/reserve 3 slot
as long as we use them as array indexes (which we could change in the future).

Unfortunately this means we waste the index zero in those arrays that will
always be unused. This also means that, to loop in such arrays we must begin
with OREAD as index zero is always empty.

PRO-MEMORIA: if/when we introduce the walk() syscall, OSTAT might turn useless.
In that case we might remove it and thus consider to move back OREAD/OWRITE
to 0/1 respectively (which might or might not be a good idea, to be analyzed).
2017-01-03 01:27:08 +01:00
c1eb65b35e kernel: move null and zero from #c to #0 2017-01-03 01:27:08 +01:00
8e7f47c743 kernel/boot: bind #0 wherever #c is bound 2017-01-03 01:27:08 +01:00
ac15346de7 kernel: make #0/pid, #0/ppid and #0/pgrpid readable 2017-01-03 01:27:07 +01:00