init commit

This commit is contained in:
Faynot
2026-07-07 20:35:07 +03:00
commit 38cc34a6e9
33 changed files with 659 additions and 0 deletions

56
README.md Normal file
View File

@@ -0,0 +1,56 @@
# elibc — Standard C Library for Elyz
Minimal C library for the Elyz OS, based on musl's organisational principles
but adapted to Elyz's capability-based, syscall-less architecture.
## Structure
```
elibc/
├── arch/ # Architecture-specific code
│ ├── generic/ # Fallback implementation & abstract interfaces
│ │ ├── kcall.h # Kernel-call abstraction (no syscalls in Elyz)
│ │ ├── startup_info.h # Process-startup description
│ │ └── bits/ # Type-size definitions
│ └── x86_64/ # x86_64 port
│ ├── kcall.h # Kernel-call placeholder (ABI TBD)
│ ├── startup_info.h # x86_64 startup layout (ABI TBD)
│ ├── atomic_arch.h # Locked cmpxchg / atomic ops
│ └── bits/
├── include/ # Public headers (POSIX-like API)
├── src/ # Source implementations
│ ├── internal/ # Libc state, errno, bump allocator (temporary)
│ ├── string/ # Pure-C string ops (memcpy, strlen, etc.)
│ ├── stdio/ # (reserved)
│ └── stdlib/ # atoi, etc.
├── crt/ # C runtime entry point
├── Makefile
└── configure
```
## Key differences from a traditional libc (glibc/musl)
| Traditional (Linux) | Elyz / elibc |
|---|---|
| `syscall`/`int 0x80` | Capability invocation → PM Actor messaging |
| `brk`/`sbrk` | `ELYZ_OP_ALLOCATE` via `elyz_kcall` |
| `_exit` syscall | `ELYZ_OP_EXIT` via kcall |
| `errno` via TLS | `__errno_location` (plain global for now) |
## Porting to a new arch
1. Create `arch/<name>/` with:
- `kcall.h` — kernel-call mechanism
- `startup_info.h` — process-startup layout
- `arch.mak` — arch-specific compiler/linker flags
- `bits/alltypes.h.in` — type sizes
- `atomic_arch.h` — atomic ops (optional, fallback exists)
2. Add detection in `configure`
3. Build: `./configure && make`
## Building
```
./configure
make
```