Skip to content

Commit

Permalink
first usable version of kernel and commands
Browse files Browse the repository at this point in the history
After an year of hard work, this is a first "usable" version of Jehanne.
  • Loading branch information
Shamar committed Nov 26, 2016
1 parent 391252a commit 38aca7a
Show file tree
Hide file tree
Showing 3,989 changed files with 406,673 additions and 1,885 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
arch/amd64/bin
arch/amd64/cmd
arch/amd64/aux
arch/amd64/kern
arch/amd64/lib

sys/log
arch/amd64/qa
arch/amd64/include/syscalls.h

sys/src/9/port/error.h
sys/src/9/root/nvram
Expand Down
40 changes: 24 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,36 @@

# Jehanne

Jehanne is a [simple][simplicity] operating system.
Jehanne is a [simple][simplicity] operating system.

It is a fork of [Harvey][harvey] (which in turn is a fork of
[Plan 9 from Bell Labs][plan9] merged with [Nix][nix] sources) but
diverges from the design and conventions of its ancestors whenever
they are at odds with its goals.
Jehanne has noble ancestors:

For this reason project is named after the famous French heretic [Joan of Arc][arc].
- most of userland tools, a lot of wisdom and some kernel modules,
come from [9front][9front]
- the kernel is a fork of Charles Forsyth's [Plan9-9k][plan9-9k]
- most of the build system and some valuable piece of code come from [Harvey OS][harvey]

Still the project is named after a humble peasant,
the famous French heretic [Joan of Arc][arc], because it diverges deeply
from the design and conventions of its predecessors.

## Overview

This is the main repository, used to build the system as a whole:

- [arch](./arch/) contains one folder for each
supported architecture, with specific C headers and binaries
supported architecture, with specific C headers, libraries and executables
(note that by architecture we intend any kind of physical or virtual
machine that is able to run code, thus rc is actually an architecture)
- [sys](./sys) is the system folder
* [include](./sys/include) contains portable C headers
* [lib](./sys/lib) contains data and scripts used by the
* [lib](./sys/lib) contains data and scripts used by the
running system
* [man](./sys/man) contains manual pages
* [src](./sys/src) contains the sources of the system
- [doc](./doc/) contains useful documentation for Jehanne
development
* [license](./doc/license/) contains detailed info
* [license](./doc/license/) contains detailed info
about Jehanne [licenses][lic]
* [hacking](./doc/hacking/) contains details about how
to build and modify Jehanne
Expand All @@ -38,12 +44,12 @@ This is the main repository, used to build the system as a whole:
- [pkgs](./pkgs) will contains the installed packages

The running system also includes supplemental folders like `/lib`,
`/bin` and `/dev` that are bound during the boot as required.
`/cmd` and `/dev` that are bound during the boot as required.

## Build

To build Jehanne and play with it, you need to have git, golang, qemu,
gcc, binutils and bison installed.
To build Jehanne and play with it, you need to have git, golang, qemu,
gcc, binutils and bison installed.
For example on Debian GNU/Linux you should be able to get going with

sudo aptitude install git golang build-essential bison qemu-system
Expand All @@ -53,16 +59,16 @@ After the repository clone, you can give a look with
git submodule init # we have a lot of submodules
git submodule update --init --recursive --remote
./hacking/devshell.sh # start a shell with appropriate environment
./hacking/continuous-build.sh # to build everything
./hacking/continuous-build.sh # to build everything (will take a while)
./hacking/runOver9P.sh # to start the system in QEMU
./hacking/drawterm.sh # to connect Jehanne with drawterm

## Hacking

Jehanne is a work in progress.
Jehanne is a work in progress.
Forks and pull requests are welcome.

In [doc/hacking](./doc/hacking/) you will find all you
In [doc/hacking](./doc/hacking/) you will find all you
need to know about its principles, design and weirdness.

There's a lot of work to do, in every area of the system.
Expand All @@ -74,8 +80,10 @@ yourself and your attitudes.

[simplicity]: http://plato.stanford.edu/entries/simplicity/ "What is simplicity?"
[harvey]: http://harvey-os.org "Harvey OS"
[plan9]: https://github.com/brho/plan9 "UC Berkeley release of Plan 9 under the GPLv2"
[9front]: http://9front.org/ "THE PLAN FELL OFF"
[plan9-9k]: https://bitbucket.org/forsyth/plan9-9k "Experimental 64-bit Plan 9 kernel"
[nix]: https://github.com/rminnich/nix-os
[arc]: https://en.wikipedia.org/wiki/Joan_of_Arc "Jeanne d'Arc"
[lic]: ./LICENSE.md "A summary of Jehanne licensing"
[mailinglist]: https://groups.google.com/forum/#!forum/jehanneos

5 changes: 0 additions & 5 deletions arch/amd64/bin/auth/disable

This file was deleted.

5 changes: 0 additions & 5 deletions arch/amd64/bin/auth/enable

This file was deleted.

36 changes: 0 additions & 36 deletions arch/amd64/bin/auth/status

This file was deleted.

8 changes: 1 addition & 7 deletions arch/amd64/include/cflags.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{
"buildflags": {
"Cflags": [
"-std=c11",
"-c",
"-I/$JEHANNE/arch/$ARCH/include",
"-I/$JEHANNE/sys/include",
"-I.",
"-ffreestanding",
"-fno-builtin",
"-fno-omit-frame-pointer",
"-fplan9-extensions",
Expand All @@ -16,10 +10,10 @@
"-gdwarf-2",
"-ggdb",
"-mcmodel=small",
"-mno-red-zone",
"-O0",
"-static",
"-Wall",
"-Wno-main",
"-Wno-missing-braces",
"-Wno-parentheses",
"-Wno-unknown-pragmas"
Expand Down
137 changes: 66 additions & 71 deletions arch/amd64/include/u.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,91 +7,86 @@
* in the LICENSE file.
*/

#define nil ((void*)0)
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned int uint32_t;
typedef unsigned int uint;
typedef signed int int32_t;
typedef unsigned long long uint64_t;
typedef long long int64_t;
typedef uint64_t uintptr;
typedef uint64_t uintptr_t;
typedef uint32_t usize;
typedef int64_t size_t;
typedef uint32_t Rune;
typedef union FPdbleword FPdbleword;
typedef uintptr jmp_buf[10]; // for registers.
#define nil ((void*)0)
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned int uint32_t;
typedef unsigned int uint;
typedef signed int int32_t;
typedef unsigned long long uint64_t;
typedef long long int64_t;
typedef uint64_t uintptr;
typedef uint64_t uintptr_t;
typedef uint32_t usize;
typedef __SIZE_TYPE__ size_t;
typedef int32_t pid_t;
typedef uint32_t Rune;
typedef union FPdbleword FPdbleword;
typedef uintptr jmp_buf[10]; // for registers.

#define JMPBUFSP 6
#define JMPBUFPC 7
#define JMPBUFARG1 8
#define JMPBUFARG2 9
#define JMPBUFSP 6
#define JMPBUFPC 7
#define JMPBUFARG1 8
#define JMPBUFARG2 9

#define JMPBUFDPC 0
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
#define JMPBUFDPC 0
typedef unsigned int mpdigit; /* for /sys/include/mp.h */

/* MXCSR */
/* fcr */
#define FPFTZ (1<<15) /* amd64 */
#define FPINEX (1<<12)
#define FPUNFL (1<<11)
#define FPOVFL (1<<10)
#define FPZDIV (1<<9)
#define FPDNRM (1<<8) /* amd64 */
#define FPINVAL (1<<7)
#define FPDAZ (1<<6) /* amd64 */
#define FPRNR (0<<13)
#define FPRZ (3<<13)
#define FPRPINF (2<<13)
#define FPRNINF (1<<13)
#define FPRMASK (3<<13)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
#define FPFTZ (1<<15) /* amd64 */
#define FPINEX (1<<12)
#define FPUNFL (1<<11)
#define FPOVFL (1<<10)
#define FPZDIV (1<<9)
#define FPDNRM (1<<8) /* amd64 */
#define FPINVAL (1<<7)
#define FPDAZ (1<<6) /* amd64 */
#define FPRNR (0<<13)
#define FPRZ (3<<13)
#define FPRPINF (2<<13)
#define FPRNINF (1<<13)
#define FPRMASK (3<<13)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
/* fsr */
#define FPAINEX (1<<5)
#define FPAUNFL (1<<4)
#define FPAOVFL (1<<3)
#define FPAZDIV (1<<2)
#define FPADNRM (1<<1) /* not in plan 9 */
#define FPAINVAL (1<<0)
#define FPAINEX (1<<5)
#define FPAUNFL (1<<4)
#define FPAOVFL (1<<3)
#define FPAZDIV (1<<2)
#define FPADNRM (1<<1) /* not in plan 9 */
#define FPAINVAL (1<<0)
union FPdbleword
{
double x;
struct { /* little endian */
uint lo;
uint hi;
};
double x;
struct { /* little endian */
uint lo;
uint hi;
};
};

/*
#if 0
typedef char* va_list;
#define va_start(list, start) list =\
(sizeof(start) < 8?\
(char*)((int64_t*)&(start)+1):\
(char*)(&(start)+1))
#define va_end(list)\
USED(list)
#define va_arg(list, mode)\
((sizeof(mode) == 1)?\
((list += 8), (mode*)list)[-8]:\
(sizeof(mode) == 2)?\
((list += 8), (mode*)list)[-4]:\
(sizeof(mode) == 4)?\
((list += 8), (mode*)list)[-2]:\
((list += sizeof(mode)), (mode*)list)[-1])
#endif
*/

typedef __builtin_va_list va_list;

#define va_start(v,l) __builtin_va_start(v,l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v,l) __builtin_va_arg(v,l)
#define va_copy(v,l) __builtin_va_copy(v,l)

typedef union NativeTypes
{
char c;
unsigned char uc;
short s;
unsigned short us;
int i;
unsigned int ui;
long l;
unsigned long ul;
void* p;
} NativeTypes;
extern volatile NativeTypes* _sysargs;
# include "syscalls.h"
3 changes: 3 additions & 0 deletions arch/rc/aux/acme/agrep
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/cmd/rc

exec grep -n $* /dev/null
3 changes: 3 additions & 0 deletions arch/rc/aux/acme/ind
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/cmd/rc

sed 's/^/ /' $*
10 changes: 10 additions & 0 deletions arch/rc/aux/acme/new
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/cmd/rc

id=`{cat /mnt/acme/new/ctl}
id=$id(1)
cmd = $*
if(~ $#cmd 0) cmd = cat
echo 'name '^`{pwd}^/-^`{basename $cmd(1)} > /mnt/acme/$id/ctl
$cmd > /mnt/acme/$id/body
echo clean > /mnt/acme/$id/ctl
3 changes: 3 additions & 0 deletions arch/rc/aux/acme/quote
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/cmd/rc

sed 's/^/> /' $*
3 changes: 3 additions & 0 deletions arch/rc/aux/acme/unind
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/cmd/rc

sed 's/^ //' $*
5 changes: 5 additions & 0 deletions arch/rc/aux/acme/wnew
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/cmd/rc -e

id=`{mkwnew $*}
cat >/mnt/acme/$id/body
echo clean >/mnt/acme/$id/ctl
9 changes: 9 additions & 0 deletions arch/rc/aux/inst/dircp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/cmd/rc
# dircp src dest - copy a tree with tar, not respecting permissions
switch($#*){
case 2
@ {builtin cd $1 && tar cif /fd/1 .} | @ {builtin cd $2 && tar xf /fd/0}
case *
echo usage: dircp from to >[1=2]
exit usage
}
6 changes: 6 additions & 0 deletions arch/rc/aux/rio/label
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/cmd/rc
# label word ... - write words into our label, if any
if (test -w /dev/label)
echo -n $* > /dev/label
if not if (test -w /mnt/term/dev/label)
echo -n $* > /mnt/term/dev/label
Loading

0 comments on commit 38aca7a

Please sign in to comment.