Commit 01a211db authored by bzt's avatar bzt

tty stuff

parent f72be345
......@@ -14,7 +14,7 @@ The boot options are kept on the first bootable partition on the first bootable
creating a disk image, the contents of that file are taken from [etc/sys/config](https://gitlab.com/bztsrc/osz/blob/master/etc/sys/config).
This file is a plain ASCII file with `key=value` pairs, parsed by [core/env.c](https://gitlab.com/bztsrc/osz/blob/master/src/core/env.c)
and [libc/env.c](https://gitlab.com/bztsrc/osz/blob/master/src/lib/libc/env.c). No whitespaces allowed, and each pair is separated by a newline (0x0A) character.
and [libc/env.c](https://gitlab.com/bztsrc/osz/blob/master/src/libc/env.c). No whitespaces allowed, and each pair is separated by a newline (0x0A) character.
The file can't be longer than a page (4096 bytes on x86_64 and AArch64). You can put comments in it with '#", '//' and '/*'.
Keys are ASCII names without spaces, values can be decimal and hexadecimal [numbers, booleans or strings](https://gitlab.com/bztsrc/osz/blob/master/docs/howto3-develop.md#configure).
......@@ -69,7 +69,7 @@ This can be a numeric value, or a comma separated list of flags, see [debug.h](h
| 512 | lo | DBG_LOG | dump [early syslog](https://gitlab.com/bztsrc/osz/blob/master/src/core/syslog.c) |
| 1024 | pm | DBG_PMM | debug [physical memory manager](https://gitlab.com/bztsrc/osz/blob/master/src/core/pmm.c) |
| 2048 | vm | DBG_VMM | debug [virtual memory manager](https://gitlab.com/bztsrc/osz/blob/master/src/core/x86_64/vmm.c) |
| 4096 | ma | DBG_MALLOC | debug [libc memory allocation](https://gitlab.com/bztsrc/osz/blob/master/src/lib/libc/bztalloc.c) |
| 4096 | ma | DBG_MALLOC | debug [libc memory allocation](https://gitlab.com/bztsrc/osz/blob/master/src/libc/bztalloc.c) |
| 8192 | bl | DBG_BLKIO | debug [block level I/O](https://gitlab.com/bztsrc/osz/blob/master/src/fs/vfs.c) |
| 16384 | fi | DBG_FILEIO | debug [file level I/O](https://gitlab.com/bztsrc/osz/blob/master/src/fs/taskctx.c) |
| 32768 | fs | DBG_FS | debug [file systems](https://gitlab.com/bztsrc/osz/blob/master/src/fs/main.c) |
......
......@@ -23,7 +23,7 @@ of the system service task's address space (like file system drivers or tty and
have their own tasks.
Drivers are shared libraries which are loaded into separate address spaces after a
common, platform independent event dispatcher, [service.c](https://gitlab.com/bztsrc/osz/blob/master/src/lib/libc/service.c).
common, platform independent event dispatcher, [service.c](https://gitlab.com/bztsrc/osz/blob/master/src/libc/service.c).
They are allowed to access IO address space with in/out instructions and to map MMIO at their bss. Otherwise driver tasks
are normal userspace applications. You can compile the `core` for a platform with ARCH and PLATFORM variables in [Config](https://gitlab.com/bztsrc/osz/blob/master/Config).
For supported platforms, see [compilation](https://gitlab.com/bztsrc/osz/blob/master/docs/compile.md).
......
......@@ -73,7 +73,7 @@ Directory
Every directory has 128 bytes long entries which gives 2^121-1 as the maximum number of entries in one directory. The first
entry is reserved for the directory header, the others are normal fid and name assignments. Entries are alphabetically ordered
thus allowing fast 0(log n) look ups with `libc`'s [bsearch](https://gitlab.com/bztsrc/osz/blob/master/src/lib/libc/stdlib.c#L99).
thus allowing fast 0(log n) look ups with `libc`'s [bsearch](https://gitlab.com/bztsrc/osz/blob/master/src/libc/stdlib.c).
16 bytes go for the fid, 1 byte reserved for the number of multibyte characters (not bytes) in the filename. That gives 111 bytes for
filename (maybe less in characters as UTF-8 is a variable length encoding). That's the hardest limitation in FS/Z, but let's
......
......@@ -72,7 +72,7 @@ in `libui`.
Device drivers
--------------
Drivers are shared libraries, and hardware device drivers use a common [event dispatcher](https://gitlab.com/bztsrc/osz/blob/master/src/lib/libc/dispatch.c) mechanism.
Drivers are shared libraries, and hardware device drivers use a common [event dispatcher](https://gitlab.com/bztsrc/osz/blob/master/src/libc/dispatch.c) mechanism.
Drivers are [categorized](https://gitlab.com/bztsrc/osz/blob/master/src/drivers/README.md), each in it's own sub-directory.
Also they can use some privileged `libc` functions, and a provide messaging interface. Therefore a minimal driver looks like
......@@ -133,7 +133,7 @@ Entry points
### Applications
They start at label `_start` defined in [lib/libc/(platform)/crt0.S](https://gitlab.com/bztsrc/osz/blob/master/src/lib/libc/x86_64/crt0.S).
They start at label `_start` defined in [libc/(platform)/crt0.S](https://gitlab.com/bztsrc/osz/blob/master/src/libc/x86_64/crt0.S).
### Shared libraries
......@@ -145,7 +145,7 @@ postponed.
### Services and drivers
Service's entry point is also called `_init`, which function must call either `mq_recv()` or `mq_dispatch()`. If not defined
otherwise, fallbacks to the default in [lib/libc/service.c](https://gitlab.com/bztsrc/osz/blob/master/src/lib/libc/service.c)
otherwise, fallbacks to the default in [libc/service.c](https://gitlab.com/bztsrc/osz/blob/master/src/libc/service.c)
(also used by device drivers). In that case the service must implement `task_init()` to initialize it's structures. Services
can use shared libraries, in which case the libraries' `_init` will be called one by one before the service's `_init` function.
......
......@@ -7,7 +7,7 @@ OS/Z How a keypress is processed
3. task switch to [keyboard driver](https://gitlab.com/bztsrc/osz/blob/master/src/drivers/input/ps2) task, if it was blocked, it's awaken
4. ISR leaves, new IRQs can fire (save keyboard IRQ)
5. ps2 driver handles the message, and dispatches it to `irq1()` in [keyboard.S](https://gitlab.com/bztsrc/osz/blob/master/src/drivers/input/ps2/keyboard.S) which in return reads scancode from keyboard
6. sends a SYS_ack message to core via [syscall](https://gitlab.com/bztsrc/osz/blob/master/src/lib/libc/x86_64/syscall.S), and core re-enables keyboard IRQ
6. sends a SYS_ack message to core via [syscall](https://gitlab.com/bztsrc/osz/blob/master/src/libc/x86_64/syscall.S), and core re-enables keyboard IRQ
7. sends a scancode message to UI task
8. task switch to UI task (it's also awaken if necessary)
9. [UI task](https://gitlab.com/bztsrc/osz/blob/master/src/ui) receives scancode message
......
......@@ -4,8 +4,8 @@ OS/Z Memory Management
Memory is allocated at several levels:
- [pmm_alloc()](https://gitlab.com/bztsrc/osz/tree/master/src/core/pmm.c) allocate physical RAM pages
- [kalloc()](https://gitlab.com/bztsrc/osz/tree/master/src/core/pmm.c) allocate core (kernel) bss memory
- [malloc()](https://gitlab.com/bztsrc/osz/tree/master/src/lib/libc/bztalloc.c), realloc(), calloc(), free() allocate user space bss memory
- [smalloc()](https://gitlab.com/bztsrc/osz/tree/master/src/lib/libc/bztalloc.c), srealloc(), scalloc(), sfree() allocate shared memory
- [malloc()](https://gitlab.com/bztsrc/osz/tree/master/src/libc/bztalloc.c), realloc(), calloc(), free() allocate user space bss memory
- [smalloc()](https://gitlab.com/bztsrc/osz/tree/master/src/libc/bztalloc.c), srealloc(), scalloc(), sfree() allocate shared memory
Memory Mapping
--------------
......@@ -18,14 +18,14 @@ User Tasks
| Virtual Address | Scope | Description |
| ---------------- | ------- | ----------- |
| -512G .. -1G-1 | global | global [shared memory](https://gitlab.com/bztsrc/osz/tree/master/src/lib/libc/bztalloc.c) space (user accessible, read/write) |
| -512G .. -1G-1 | global | global [shared memory](https://gitlab.com/bztsrc/osz/tree/master/src/libc/bztalloc.c) space (user accessible, read/write) |
| -1G .. 0 | global | core memory (supervisor only, see below) |
| 0 .. 4096 | local | Task Control Block (read-only) |
| 4096 .. x | local | Message Queue (read-only, growing upwards) |
| x .. 2M-1 | local | local stack (read/write, growing downwards) |
| 2M .. x | [process](https://gitlab.com/bztsrc/osz/tree/master/docs/process.md) | user program text segment (read only) |
| x .. 4G-1 | process | shared libraries (text read only / data read/write) |
| 4G .. 2^48-4G | local | dynamically [allocated tls memory](https://gitlab.com/bztsrc/osz/tree/master/src/lib/libc/bztalloc.c) (growing upwards, read/write) |
| 4G .. 2^48-4G | local | dynamically [allocated tls memory](https://gitlab.com/bztsrc/osz/tree/master/src/libc/bztalloc.c) (growing upwards, read/write) |
| 2^48-4G .. 2^48 | local | pre-allocated mapped system buffers (screen, initrd, MMIO) |
If two mappings are identical save the TCB, message queue and stack, then they belong to the same process.
......
......@@ -34,7 +34,7 @@ msg_t *mq_recv();
/* sync, dispatch events (blocking, noreturn) */
void mq_dispatch();
```
While [mq_call()](https://gitlab.com/bztsrc/osz/blob/master/src/lib/libc/x86_64/syscall.S) is a sequence of mq_send() and my_recv() calls, [mq_dispatch()](https://gitlab.com/bztsrc/osz/blob/master/src/lib/libc/dispatch.c) is quite the opposite: it first
While [mq_call()](https://gitlab.com/bztsrc/osz/blob/master/src/libc/x86_64/syscall.S) is a sequence of mq_send() and my_recv() calls, [mq_dispatch()](https://gitlab.com/bztsrc/osz/blob/master/src/lib/libc/dispatch.c) is quite the opposite: it first
receives a message with mq_recv(), calls the handler for it, and then uses mq_send() to send the result back. For msg_t struct, see below.
You can also pass a system service number as `dst`, they can be found in [etc/include/syscall.h](https://gitlab.com/bztsrc/osz/blob/master/etc/include/syscall.h). The available function codes
......
......@@ -6,7 +6,7 @@ The hardware abstraction layer is divided into one plus three layers:
* [loader](https://gitlab.com/bztsrc/osz/blob/master/loader) (not part of the OS)
* [core](https://gitlab.com/bztsrc/osz/blob/master/src/core)
* [device drivers](https://gitlab.com/bztsrc/osz/blob/master/docs/drivers.md)
* [libc](https://gitlab.com/bztsrc/osz/blob/master/src/lib/libc)
* [libc](https://gitlab.com/bztsrc/osz/blob/master/src/libc)
Porting loader
--------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment