vm: add strcmp_ext for use by testcases

Also add a testcase that copies strings to the stack and calls strcmp_ext.
2 files changed
tree: dd035e19b0cd95d326862e75e6d27a63caeb5320
  1. bin/
  2. test_framework/
  3. tests/
  4. ubpf/
  5. vm/
  6. .travis.yml
  7. LICENSE-APACHE
  8. README.md
  9. requirements.txt
README.md

uBPF

Userspace eBPF VM

Build Status Coverage Status

About

This project aims to create an Apache-licensed library for executing eBPF programs. The primary implementation of eBPF lives in the Linux kernel, but due to its GPL license it can't be used in many projects.

[Linux documentation for the eBPF instruction set] (https://www.kernel.org/doc/Documentation/networking/filter.txt)

[Instruction set reference] (https://github.com/iovisor/bpf-docs/blob/master/eBPF.md)

This project includes an eBPF assembler, disassembler, interpreter, and JIT compiler for x86-64.

Building

Run make -c vm to build the VM. This produces a static library libubpf.a and a simple executable used by the testsuite.

Compiling C to eBPF

You'll need [Clang 3.7] (http://llvm.org/releases/download.html#3.7.0).

clang-3.7 -O2 -target bpf -c prog.c -o prog.o

You can then pass the contents of prog.o to ubpf_load_elf, or to the stdin of the vm/test binary.

Contributing

Please fork the project on GitHub and open a pull request. You can run all the tests with nosetests.

License

Copyright 2015, Big Switch Networks, Inc. Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0>.