-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lib module with conditional imports depending on std/no_std.
Signed-off-by: SzymonKubica <szymo.kubica@gmail.com> Add correct imports for cranelift feature. Signed-off-by: SzymonKubica <szymo.kubica@gmail.com> Add optional loading of dependencies available only when under std. Signed-off-by: SzymonKubica <szymo.kubica@gmail.com> Reenabled the default features on dev dependencies and reverted formatting changes in Cargo.toml Signed-off-by: SzymonKubica <szymo.kubica@gmail.com>
- Loading branch information
1 parent
a8447c9
commit ce48245
Showing
21 changed files
with
437 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,40 @@ | ||
// SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
// Copyright 2017 6WIND S.A. <quentin.monnet@6wind.com> | ||
|
||
|
||
extern crate rbpf; | ||
use rbpf::disassembler; | ||
|
||
// Simply disassemble a program into human-readable instructions. | ||
fn main() { | ||
let prog = &[ | ||
0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x79, 0x12, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x79, 0x11, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0xbf, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x07, 0x03, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, | ||
0x2d, 0x23, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x69, 0x12, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x55, 0x02, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, | ||
0x71, 0x12, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x55, 0x02, 0x0e, 0x00, 0x06, 0x00, 0x00, 0x00, | ||
0x18, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x79, 0x11, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0xbf, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x57, 0x02, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, | ||
0x15, 0x02, 0x08, 0x00, 0x99, 0x99, 0x00, 0x00, | ||
0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x5f, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0xb7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, | ||
0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x99, 0x99, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x1d, 0x21, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
]; | ||
disassembler::disassemble(prog); | ||
#[cfg(feature = "std")] { | ||
let prog = &[ | ||
0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x79, 0x12, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x79, 0x11, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0xbf, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x07, 0x03, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, | ||
0x2d, 0x23, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x69, 0x12, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x55, 0x02, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, | ||
0x71, 0x12, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x55, 0x02, 0x0e, 0x00, 0x06, 0x00, 0x00, 0x00, | ||
0x18, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x79, 0x11, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0xbf, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x57, 0x02, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, | ||
0x15, 0x02, 0x08, 0x00, 0x99, 0x99, 0x00, 0x00, | ||
0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x5f, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0xb7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, | ||
0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x99, 0x99, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x1d, 0x21, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
]; | ||
disassembler::disassemble(prog); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.