Skip to content

Commit 32cf6f7

Browse files
committed
docs: readme
docs: readme
1 parent de668a2 commit 32cf6f7

3 files changed

Lines changed: 126 additions & 46 deletions

File tree

README.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,126 @@
11
# ePass
2+
3+
ePass is an in-kernel LLVM-like compiler framework that introduces an SSA-based intermediate representation (IR) for eBPF programs. It provides a lifter that lifts eBPF bytecode to ePass IR, a pass runner that runs user-defined passes, and a code generator that compiles IR to eBPF bytecode. Users could write flexible passes using our LLVM-like APIs to analyze and manipulate the IR.
4+
ePass could work with the verifier to improve its flexibility (i.e. reduce false rejections) and safety (i.e. reduce false acceptance at runtime). It could also be used in userspace for testing.
5+
6+
## Features
7+
8+
- **IR-based compilation**: Converts BPF programs to an SSA-based intermediate representation for code rewriting
9+
- **Flexible passes**: ePass core provides various APIs to analyze and manipulate the IR, allowing users to write flexible passes including runtime checks and optimization.
10+
- **Command-line interface**: Easy-to-use CLI tool for testing in userspace
11+
12+
## Prerequisites
13+
14+
- **clang >= 17**
15+
- **Ninja** (optional, for faster compilation)
16+
- **libbpf**
17+
18+
## Quick Start
19+
20+
### Build
21+
22+
```bash
23+
cmake -S . -B build -GNinja
24+
make
25+
```
26+
27+
### Install
28+
29+
```bash
30+
sudo cmake --install build
31+
```
32+
33+
### Basic Usage
34+
35+
```bash
36+
# Run ePass on the program
37+
epass read prog.o
38+
39+
# Run ePass on the program with gopt and popt
40+
epass read --popt popts --gopt gopts prog.o
41+
42+
# Print the BPF program
43+
epass print prog.o
44+
```
45+
46+
## Development
47+
48+
### Build Commands
49+
50+
```bash
51+
# Format code
52+
make format
53+
54+
# Configure build system (run for the first time)
55+
make configure
56+
57+
# Build with generated constructors (run after you create a new instruction)
58+
make buildall
59+
60+
# Default Build
61+
make build
62+
```
63+
64+
### Testing
65+
66+
```bash
67+
# Run integration tests
68+
cd test && ./run_tests.sh
69+
70+
# Run Python test suite
71+
cd test && python test.py
72+
```
73+
74+
### Generate Additional Assets
75+
76+
```bash
77+
# Generate kernel objects
78+
make kernel
79+
80+
# Build ePass object files for libbpf
81+
make buildobj
82+
```
83+
84+
## Project Structure
85+
86+
```
87+
ePass/
88+
├── core/ # Main compiler implementation
89+
│ ├── include/ # Header files
90+
│ ├── docs/ # Technical documentation
91+
│ ├── passes/ # Optimization passes
92+
│ ├── aux/ # Auxiliary utilities
93+
│ ├── epasstool/ # CLI tool
94+
│ └── tests/ # Simple BPF tests
95+
├── test/ # Integration tests and evaluation
96+
├── rejected/ # Collected rejected programs
97+
└── tools/ # Helper scripts and utilities
98+
```
99+
100+
## Contributing
101+
102+
1. Follow the existing code style and patterns
103+
2. Run `make format` before submitting changes
104+
3. Ensure all tests pass
105+
4. Update documentation as needed
106+
107+
## Common Development Patterns
108+
109+
### Iterating Through Instructions
110+
111+
```c
112+
struct ir_basic_block **pos;
113+
array_for(pos, fun->reachable_bbs)
114+
{
115+
struct ir_basic_block *bb = *pos;
116+
struct ir_insn *insn;
117+
list_for_each_entry(insn, &bb->ir_insn_head, list_ptr) {
118+
// Process instruction
119+
}
120+
}
121+
```
122+
123+
## TODO
124+
125+
- [ ] bpf-to-bpf calls
126+
- [ ] Full test suite

core/Readme.md

Lines changed: 0 additions & 46 deletions
This file was deleted.

core/docs/CREATE_INSTRUCTION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Create New Instruction

0 commit comments

Comments
 (0)