Skip to content

Commit

Permalink
Add /libs stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
duckinator committed Aug 26, 2020
1 parent f72ad91 commit 42461ed
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 45 deletions.
11 changes: 2 additions & 9 deletions libs/ali/index.markdown
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
---
title: Ali
layout: default
---

Ali is the libc implementation used by awooOS.

It requires an external memory management library. AwooOS uses
[dmm](/libs/dmm), but you should be able to use anything that can
provide the same interface.

[Ali's source is available on GitHub.](https://github.com/awooos/ali)
## ali
A libc.
14 changes: 8 additions & 6 deletions libs/dmm/index.markdown
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
title: DMM
layout: default
---

DMM is the memory management library used by awooOS. It was originally
extracted from an older project, but is being rewritten to better align with
awooOS' goals of reusability and simplicity.
## dmm

[DMM's source is available on GitHub.](https://github.com/awooos/dmm)
A memory management library made for
[awooOS](https://github.com/awooos/awooos).

## License

The code is available as open source under the [MIT
License](https://github.com/awoos/dmm/raw/master/LICENSE.txt).
13 changes: 0 additions & 13 deletions libs/eventually/index.markdown

This file was deleted.

38 changes: 31 additions & 7 deletions libs/flail/index.markdown
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
---
title: Flail
layout: default
---

Flail is the library awooOS uses to handle kernel panics. It requires
nothing but an `stdef.h` that exposes `size_t` and a function to print
text.
## flail

As such, it is possible to use it without even having a memory manager.
A library for implementing kernel panics.

[Flail's source is available on GitHub.](https://github.com/awooos/flail)
### Requirements

1. An `stddef.h` which defines `size_t`.
2. A `putchar()`-equivalent. It does not need to have any specific name.
* Accepts a single `int` and, presumably, prints it (after casting to an `unsigned char`).
* The return value isn't used, but I recommend following the POSIX/C standards.

### Usage

```c
##include <flail.h> /* Note: flail.h uses stddef.h. */

// Operating system information to include in the panic message.
const char *info_str = "Some Operating System v1.0";

int custom_putchar(int c) {
// Implement me!
return c; // It "worked."
}

void kernel_main() {
flail_init(info_str, &custom_putchar);
flail_panic("oh no");
}
```
### License
The code is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
25 changes: 25 additions & 0 deletions libs/greeter/index.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
---

## Greeter

AwooOS's Greeter library listens for the `"greeter display"` event,
expecting to get a `char**`, and prints each string.

### Usage

Simplified example, based on how awooOS' HAL uses it:

```c
char *os_name = "awooOS";

const char *greeting[] = {
os_name,
"\r\n",
"Compiled with: ",
&kernel_comment_start,
NULL
};

event_trigger("greeter display", &greeting);
```
8 changes: 8 additions & 0 deletions libs/hal/index.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
---

## HAL (Hardware Abstraction Layer)

The duct tape that holds awooOS together.

This needs to be split up a lot _and_ documented.
8 changes: 8 additions & 0 deletions libs/shell/index.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
---

## AwooOS Shell

An extremely shittastic shell that doesn't do much of anything.

Relies on at least a libc, Ali (events + strings), and the HAL.
6 changes: 6 additions & 0 deletions libs/tests/index.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
---

## awooOS Tests

Registers all the test functions, then runs Tinker.
72 changes: 62 additions & 10 deletions libs/tinker/index.markdown
Original file line number Diff line number Diff line change
@@ -1,17 +1,69 @@
---
title: Tinker
---

A large part of what drove the initial development of awooOS is a focus on
testability.
## Tinker

To facilitate a rapid development process we created Tinker, a kernel testing
framework.
A low-level test framework for C code, which only requires a C11
compiler and a pointer to a `putchar()`-compatible function.

Tinker allows you to test kernel components individually, and then
_reuse those same tests_ as runtime tests.
(It may work with a pre-C11 compiler, but this has not been tested.)

[awooOS itself is able to be built and ran in a Docker container](https://smallest.dog/blog/tdd-for-a-kernel/),
and build times are kept to a minimum, allowing for test-driven development.
Source: https://github.com/awooos/tinker
Issues: https://github.com/awooos/tinker/issues

[Tinker's source is available on GitHub.](https://github.com/awooos/tinker)

This makes it incredibly useful for testing memory managers, a libc
implementation, and other things.

### Usage

TODO: Actual good documentation.

For now, here's an example:

```
##include <stdio.h> // for putchar()
// unit test
void test_some_function() {
bool result = some_function();
if (result == 0) {
tinker_pass()
} else if (result == 1) {
tinker_fail("Failure reason #1.");
} else if (result == 2) {
tinker_fail("Failure reason #2.");
}
}
// collection of assertions.
void test_math() {
tinker_assert(1 + 1 == 2);
tinker_assert(1 - 1 == 0);
tinker_assert(2 * 2 == 4);
tinker_assert(4 / 2 == 2);
}
void test_unfinished() {
tinker_skip("Not implemented.");
return;
// <test unfinished functionality here>
}
void add_tests() {
tinker_add_test(some_function);
tinker_add_test(math);
tinker_add_test(unfinished);
}
int main() {
add_tests();
tinker_run_tests(&putchar);
}
```

### License

The code is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

0 comments on commit 42461ed

Please sign in to comment.