diff options
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/compositor.txt | 32 | ||||
-rw-r--r-- | documentation/kernel-interfaces/app-entry.txt | 3 | ||||
-rw-r--r-- | documentation/kernel-interfaces/keys.txt (renamed from documentation/kernel-interface/keys.txt) | 0 | ||||
-rw-r--r-- | documentation/kernel-interfaces/sockets.txt (renamed from documentation/kernel-interface/sockets.txt) | 0 | ||||
-rw-r--r-- | documentation/kernel-interfaces/syscalls.txt (renamed from documentation/kernel-interface/syscalls.txt) | 25 | ||||
-rw-r--r-- | documentation/kernel/applications.txt | 41 | ||||
-rw-r--r-- | documentation/kernel/memory.txt (renamed from documentation/memory.txt) | 7 | ||||
-rw-r--r-- | documentation/kernel/panics.txt (renamed from documentation/panics.txt) | 0 | ||||
-rw-r--r-- | documentation/kernel/storage.txt (renamed from documentation/storage.txt) | 0 |
9 files changed, 84 insertions, 24 deletions
diff --git a/documentation/compositor.txt b/documentation/compositor.txt index 8946eff..7442d51 100644 --- a/documentation/compositor.txt +++ b/documentation/compositor.txt @@ -1,14 +1,25 @@ compositors listen on the socket id "hilbert.compositor". +when a window is opened by an application, that window can only be referred to +on that stream. the opaque value given in the "window opened" message refers to +that window in future messages on that stream. it is guaranteed to be distinct +for different windows on the same stream, and in no way guaranteed to be +distinct for different windows on different streams. the window is bound +just to the stream, not to the application. if the stream where a window +was created is gifted to a new process, the new process has complete control +over the window, and the compositor does not need to be informed. + data types: - color24: - byte: red - byte: green - byte: blue + color: + opaque dword (result of encode color system call). + from c++, use __euler_encode_color in euler/syscall.hpp. + + color rectangle: + multiple hilbert colors, top to bottom by row, left to right within row - color24 rectangle: - multiple color24's, top to bottom by row, left to right within row + window: + opaque word (given in "window opened" message after "open window" message) messages from applications to compositor: @@ -19,8 +30,15 @@ messages from applications to compositor: update window region: byte: 0x01 + window: the window dword: start x dword: start y dword: width dword: height - color24 rectangle: the data + color rectangle: the data + +messages from compositor to application: + + window opened: + byte: 0x00 + window: the window diff --git a/documentation/kernel-interfaces/app-entry.txt b/documentation/kernel-interfaces/app-entry.txt new file mode 100644 index 0000000..1a09d22 --- /dev/null +++ b/documentation/kernel-interfaces/app-entry.txt @@ -0,0 +1,3 @@ +on entry, the stack is set up, and all registers other than rsp are set to 0. +the ARGC environment variable holds the number of arguments to main. +the ARGV0, ARGV1, ARGV2, etc environment variables hold those arguments. diff --git a/documentation/kernel-interface/keys.txt b/documentation/kernel-interfaces/keys.txt index 1b92afa..1b92afa 100644 --- a/documentation/kernel-interface/keys.txt +++ b/documentation/kernel-interfaces/keys.txt diff --git a/documentation/kernel-interface/sockets.txt b/documentation/kernel-interfaces/sockets.txt index 73dade6..73dade6 100644 --- a/documentation/kernel-interface/sockets.txt +++ b/documentation/kernel-interfaces/sockets.txt diff --git a/documentation/kernel-interface/syscalls.txt b/documentation/kernel-interfaces/syscalls.txt index 792c300..ca93b56 100644 --- a/documentation/kernel-interface/syscalls.txt +++ b/documentation/kernel-interfaces/syscalls.txt @@ -1,15 +1,6 @@ -on application entry: - there is a 1MiB - 8KiB area mapped writable and not - executable with guard pages on either side, and rsp is - set to the top of that. all other registers are set to 0. - -the ARGC environment variable holds the number of arguments to main. -the ARGV0, ARGV1, ARGV2, etc environment variables hold those arguments. - -for all system calls: - rax, rdi, rsi, rdx are in/out paramters. - rbx, rbp, rsp, r12-r15 are preserved. - rcx, rflags, r8-r11 are clobbered. +rax, rdi, rsi, rdx are in/out paramters. +rbx, rbp, rsp, r12-r15 are preserved. +rcx, rflags, r8-r11 are clobbered. interrupts (including the timer!) are disabled during system calls. @@ -105,8 +96,6 @@ connect to socket: rsi in: id string length rax out: stream result rdi out: stream handle (if rax = 0) - if the listener is closed while this syscall is blocked, rax is - set to "socket id not in use" and not "socket listener closed" close stream: rax in: 11 @@ -165,6 +154,7 @@ start process: qword: stream handle here qword: new stream handle in child new handle must be < 65536 + any gifted streams must not have threads waiting to read from our end end this process: rax in: 17 @@ -176,3 +166,10 @@ set stream length: rdi in: stream handle rsi in: new length rax out: stream result + +get other end process handle: + returns "other end closed" for files + rax in: 19 + rdi in: stream handle + rax out: stream result + rdi out: process handle (if rax = success) diff --git a/documentation/kernel/applications.txt b/documentation/kernel/applications.txt new file mode 100644 index 0000000..6890c96 --- /dev/null +++ b/documentation/kernel/applications.txt @@ -0,0 +1,41 @@ +globally there are: + an id-list of processes + an id-list of threads + a queue of paused threads + a single running thread + +a paused thread is a thread that can run, but isn't. +a thread that is not running and is not paused is in a blocking syscall. + +each process has: + a process id + a list of threads + a list of open file streams + a list of open socket stream ends + a list of running socket listeners + a list of environment variables (pairs of strings) + +a thread has: + an owning process + optionally: + a stream end it is waiting to read from + a socket listener it is waiting to accept a connection from + a socket listener it is waiting to connect to + if not running: + saved cpu state + +a socket has: + two queues + +an open socket stream end has: + a list of threads waiting to read from it + the socket + its input queue + its output queue + if the other side is open: + the other process + the other stream end + +a running socket listener has: + a list of threads waiting to accept a connection from it + a list of threads waiting to connect to it diff --git a/documentation/memory.txt b/documentation/kernel/memory.txt index c000fa7..3c0e4f4 100644 --- a/documentation/memory.txt +++ b/documentation/kernel/memory.txt @@ -2,9 +2,10 @@ only the first 32GiB of physical memory are considered. this can be changed with pram_pages in paging.cpp. vram layout is as follows: 0x0000.0000.0000 - 0x0000.0000.0fff: always unmapped -0x0000.0000.1000 - 0x0000.001f.efff: user stack -0x0000.001f.f000 - 0x0000.001f.ffff: always unmapped -0x0000.0020.0000 - 0x007f.ffff.ffff: available to user process +0x0000.0000.1000 - 0x003f.ffff.ffff: available to user process +0x0040.0000.0000 - 0x007f.ffff.ffff: each 16MB: + 0x00.0000 - 0x00.0fff: always unmapped + 0x00.1000 - 0xff.ffff: available for user thread stack 0x0080.0000.0000 - 0xffff.bfff.ffff: always unmapped 0xffff.c000.0000 - 0xffff.ffdf.ffff: available to kernel 0xffff.ffe0.0000 - 0xffff.ffe0.0fff: always unmapped diff --git a/documentation/panics.txt b/documentation/kernel/panics.txt index e1b6ec1..e1b6ec1 100644 --- a/documentation/panics.txt +++ b/documentation/kernel/panics.txt diff --git a/documentation/storage.txt b/documentation/kernel/storage.txt index 4fe8ea3..4fe8ea3 100644 --- a/documentation/storage.txt +++ b/documentation/kernel/storage.txt |