2018-01-30 03:56:01 +00:00
|
|
|
# `libucontext`
|
|
|
|
|
|
|
|
`libucontext` is a library which provides the `ucontext.h` C API. Unlike other implementations,
|
|
|
|
it faithfully follows the kernel process ABI when doing context swaps.
|
|
|
|
|
|
|
|
Notably, when combined with `gcompat`, it provides a fully compatible implementation of the ucontext
|
|
|
|
functions that are ABI compatible with glibc.
|
|
|
|
|
2020-12-06 10:54:19 +00:00
|
|
|
Since version 0.13, for some architectures, you can deploy to bare metal using newlib via the
|
|
|
|
`FREESTANDING=yes` make option. Systems which use a syscall cannot work this way. The table
|
|
|
|
below shows which architecture ports have been adapted to build with `FREESTANDING=yes`.
|
|
|
|
|
2018-01-30 03:56:01 +00:00
|
|
|
|
|
|
|
## supported architectures
|
|
|
|
|
|
|
|
Adding support for new architectures is easy, but you need to know assembly language to do it.
|
|
|
|
|
2020-12-06 10:54:19 +00:00
|
|
|
| Architecture | Works on musl | Syscall | Supports FREESTANDING |
|
|
|
|
|--------------|---------------|---------|-----------------------|
|
|
|
|
| aarch64 | ✓ | | |
|
|
|
|
| arm | ✓ | | |
|
|
|
|
| m68k | ✓ | | ✓ |
|
|
|
|
| mips | ✓ | | |
|
|
|
|
| mips64 | ✓ | | |
|
|
|
|
| ppc | ✓ | ✓ | |
|
|
|
|
| ppc64 | ✓ | ✓ | |
|
2020-12-06 13:08:31 +00:00
|
|
|
| riscv64 | ✓ | | ✓ |
|
2020-12-06 12:36:27 +00:00
|
|
|
| s390x | ✓ | | ✓ |
|
2020-12-06 11:37:19 +00:00
|
|
|
| x86 | ✓ | | ✓ |
|
2020-12-06 10:54:19 +00:00
|
|
|
| x86_64 | ✓ | | ✓ |
|
2018-02-14 03:06:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
## building
|
|
|
|
|
|
|
|
`libucontext` uses a simple makefile build system. You should define `ARCH=` at build time, otherwise
|
|
|
|
the build system will attempt to guess using `uname -m`.
|
|
|
|
|
|
|
|
```
|
|
|
|
$ make ARCH=x86_64
|
|
|
|
$ make ARCH=x86_64 check
|
|
|
|
$ make ARCH=x86_64 DESTDIR=out install
|
2020-05-18 03:28:21 +00:00
|
|
|
```
|