Commit Graph

48 Commits

Author SHA1 Message Date
Giacomo Tesio 01451943ec last minutes cleanup 2022-01-05 16:59:31 +00:00
Giacomo Tesio 1e34cf5efb copyright: update 9front's url (they moved from hg to git) 2021-12-30 00:55:39 +01:00
Giacomo Tesio 0adf1b0431 new build: get rid of Go with few rc scripts. 2021-12-30 00:55:06 +01:00
Giacomo Tesio 922e993c41 libs, kernel and commands: re-enable -Werror 2020-11-15 13:30:09 +01:00
Giacomo Tesio 0a325039bf gcc & system build: add `-9` and remove `--posix` from build files 2020-09-17 23:53:12 +02:00
Giacomo Tesio bb2a39cc74 kern: fix compilation warning; raise qa timeouts 2020-09-17 23:49:33 +02:00
Giacomo Tesio 7385e37b13 kern: usb uhci: fix test of ports in init() 2020-09-17 23:49:27 +02:00
Giacomo Tesio 75b451ea1c kern: move `load` from Mach to Sys 2020-09-17 23:49:26 +02:00
Giacomo Tesio 2f850291d5 rename libc to libjehanne; improve libposix
This is to avoid conflicts between standards' assumptions and Jehanne's choices
2020-09-17 23:48:27 +02:00
Giacomo Tesio f104c46858 purge syscall macros 2020-09-17 23:45:23 +02:00
Giacomo Tesio 5f095a9605 temporarily disable -Werror 2020-09-17 23:43:57 +02:00
Giacomo Tesio c7d0f621c9 Clarify Forsyth's and 9front's copyrights
I'm very grateful to Charles Forsyth for creating most of Jehanne's kernel
and to 9front's guys for all the code and ideas they freely share.

Here I make their copyrights explicit as they had been erroneusly omitted
or messed up before. Sorry.
2018-01-05 02:30:45 +01:00
Giacomo Tesio e0b8a369d0 kern: align stack pointer to 16 byte in notify 2017-12-15 02:58:09 +01:00
Giacomo Tesio df9c0d8fe4 kern: awake: fix syscall() check for awake_awakened(up) 2017-12-15 02:58:09 +01:00
Giacomo Tesio 8ea71b1c66 kern: fix very old bug in syscall tracing 2017-12-15 02:58:09 +01:00
Giacomo Tesio 7c017f5059 kern: fix %r13 management in syscallentry 2017-10-25 01:18:57 +02:00
Giacomo Tesio 9202b04504 rc: use some uppercase variables (PATH, USER...) 2017-10-22 13:22:37 +02:00
Giacomo Tesio fab9c1d80f libc: introduce <envvars.h>
The new header envvars.h contains the names of commonly used
environment variables, such as $user, $ifs, $path and so on.

These defines are useful for Jehanne core applications that
use them to comunicate some values.

They are not strictly required, but having such defines we
can easily change the naming convention (from lowercase to uppercase).
2017-10-20 01:22:48 +02:00
Giacomo Tesio da588d69ec kernel: fpprocfork: fix CID 174315 (Missing break in switch) 2017-08-14 15:22:51 +02:00
Giacomo Tesio c5466152f1 Revert "Revert "kernel: import sdahci from 9front""
This reverts commit ecc2125b28.
2017-08-13 12:47:56 +02:00
Giacomo Tesio ecc2125b28 Revert "kernel: import sdahci from 9front"
This reverts commit d9975caeb0.
2017-08-12 15:18:02 +02:00
Giacomo Tesio aef20dca20 kernel: fix.c: fix inverted CHS bit 2017-08-11 06:12:44 +02:00
Giacomo Tesio d9975caeb0 kernel: import sdahci from 9front 2017-08-11 05:26:53 +02:00
Giacomo Tesio 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
Giacomo Tesio 83e3161789 kernel: fix ancient bug in GDT initialization 2017-06-08 04:03:32 +02:00
Giacomo Tesio 4f97f4a80b qa: disable broken tests 2017-06-05 22:11:36 +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 c27b2aa93b kern: remove unused l64acidt.S 2017-05-22 00:45:03 +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 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 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
Giacomo Tesio ac33157c37 kern: usbehcipc.c fix CID 155940: Out-of-bounds write 2017-04-25 16:07:47 +02:00
Giacomo Tesio 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
Giacomo Tesio edd84db070 kernel: import 9front's PCI improvements 2017-01-24 22:24:43 +01:00
Giacomo Tesio 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
Giacomo Tesio 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
Giacomo Tesio e93aafc028 qa: build everything with -Werror 2017-01-12 00:38:56 +01:00
Giacomo Tesio a8e2247e20 kernel: drop SysNsec references from syscall() 2017-01-06 01:40:04 +01:00
Giacomo Tesio 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
Giacomo Tesio 0bbd79e0a5 kernel: waitdebugger on lapictimerset if apic->div == 0 2016-12-26 02:18:19 +01:00
Giacomo Tesio b862596737 kernel&all: create() syscall only sends Tcreate
In Plan9 the create syscall fallback on a open(OTRUNC) if the
path provided already exists. This is actually a common requirement
as most programs (editors, cat...) simply requires that a file is
there and is empty, and doesn't care overwriting existing contents
(note that this is particularily sensible with something like fossil).

In Jehanne the application is responsible of actually handle this
"file exists" error but libc provides ocreate() to mimic the Plan9
behaviour. Note that ocreate introduce a subtle race too: the path
is walked several times if the file exists, thus it could misbehave
on concurrent namespace changes. However I guess this is not going to
happen often enough to care now.

NOTE we will probably address this rare race too, with a more drammatic change
to syscalls: a new walk() syscall that will provide an unopen fd.
2016-12-24 21:25:20 +01:00
Giacomo Tesio c6de6b66e9 kernel: introduce devself
Devself provides to each process access to its own structures.

So far it contains four files:

- pid
- ppid
- pipes	used to implement pipe(2)
- segments used to implement segattach, segdetach and segfree
2016-12-11 01:26:08 +01:00
Giacomo Tesio f52a185030 decouple Jehanne from 9P2000 (as much as needed)
Jehanne is going to use a new file protocol, but Plan 9 is really
coupled with 9P2000.

Renamed fcall.h as 9P2000.h and introduced specific constants such
as NP_OREAD, NP_OWRITE and so on, so that we can use different values
in the kernel and new protocol.

Renamed devmnt to devninep, since it's actually a device serving 9P2000
file systems.

Also, fixed 9P2000 support in Jehanne, that was broken with the introduction
of OSTAT.
2016-12-06 23:01:45 +01:00
Giacomo Tesio a9745e02c5 kernel: in Proc defined syscallerr to hold the return value of failing syscalls 2016-11-30 01:07:45 +01:00
Giacomo Tesio 38aca7a581 first usable version of kernel and commands
After an year of hard work, this is a first "usable" version of Jehanne.
2016-11-26 03:49:29 +01:00