Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition.workspace = true
license.workspace = true

[dependencies]
symbit = { path = "../crates/sym" }
sympcode = { path = "../crates/sympcode" }
pcode-ops = { path = "../crates/pcode-ops" }
symbolic-pcode = { path = "../crates/pcode" }

Expand Down
38 changes: 17 additions & 21 deletions benches/emulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ use std::borrow::Cow;
use std::time::Duration;

use criterion::{BatchSize, BenchmarkId, Criterion, criterion_group, criterion_main};
use pcode_ops::PcodeOps;
use symbit::{SymbolicBitVec, SymbolicByte};
use pcode_ops::convert::PcodeValue;
use symbolic_pcode::emulator::{PcodeEmulator, StandardPcodeEmulator};
use symbolic_pcode::libsla::{
Address, AddressSpace, AddressSpaceId, AddressSpaceType, BoolOp, IntOp, IntSign, OpCode,
PcodeInstruction, VarnodeData,
};
use symbolic_pcode::mem::{GenericMemory, VarnodeDataStore};
use sympcode::SymPcode;

type Memory = GenericMemory<SymbolicBitVec>;
type Memory = GenericMemory<SymPcode>;

const fn processor_space() -> AddressSpace {
AddressSpace {
Expand Down Expand Up @@ -47,7 +47,7 @@ const fn internal_space() -> AddressSpace {
}

fn setup_copy() -> (Memory, PcodeInstruction) {
let data = SymbolicBitVec::from_le(0x1122334455667788u64);
let data = 0x1122334455667788u64;
let mut memory = Memory::default();

let pcode_copy = PcodeInstruction {
Expand All @@ -73,7 +73,7 @@ fn setup_copy() -> (Memory, PcodeInstruction) {
};

memory
.write(&pcode_copy.inputs[0], data)
.write_value(&pcode_copy.inputs[0], data)
.expect("failed to initialize memory");

(memory, pcode_copy)
Expand Down Expand Up @@ -118,13 +118,12 @@ fn setup_load() -> (Memory, PcodeInstruction) {

// Write indirect offset to memory
let offset = 0x5678u64;
let indirect_offset = SymbolicBitVec::from_le(offset);
memory
.write(&pcode_load.inputs[1], indirect_offset)
.write_value(&pcode_load.inputs[1], offset)
.expect("failed to write indirect offset");

// Write data to memory
let data = SymbolicBitVec::from_le(0x1122334455667788u64);
let data = 0x1122334455667788u64;
let data_varnode = VarnodeData {
address: Address {
offset,
Expand All @@ -133,7 +132,7 @@ fn setup_load() -> (Memory, PcodeInstruction) {
size: 8,
};
memory
.write(&data_varnode, data)
.write_value(&data_varnode, data)
.expect("failed to write data");

(memory, pcode_load)
Expand Down Expand Up @@ -178,15 +177,14 @@ fn setup_store() -> (Memory, PcodeInstruction) {

// Write indirect offset to memory
let offset = 0x5678u64;
let indirect_offset = SymbolicBitVec::from_le(offset);
memory
.write(&instruction.inputs[1], indirect_offset)
.write_value(&instruction.inputs[1], offset)
.expect("failed to write indirect offset");

// Write data to memory
let data = SymbolicBitVec::from_le(0x1122334455667788u64);
let data = 0x1122334455667788u64;
memory
.write(&instruction.inputs[2], data)
.write_value(&instruction.inputs[2], data)
.expect("failed to write data");

(memory, instruction)
Expand Down Expand Up @@ -230,9 +228,9 @@ fn setup_subpiece() -> (Memory, PcodeInstruction) {
let mut memory = Memory::default();

// Write data to memory
let data = SymbolicBitVec::from_le(0x1122334455667788u64);
let data = 0x1122334455667788u64;
memory
.write(&instruction.inputs[0], data)
.write_value(&instruction.inputs[0], data)
.expect("failed to write data");

(memory, instruction)
Expand Down Expand Up @@ -303,27 +301,25 @@ fn create_arithmetic_setup_fn(op_code: OpCode) -> impl FnMut() -> (Memory, Pcode
};

memory
.write(
.write_value(
&instruction.inputs[0],
0xfedcba9876543210u64
.to_le_bytes()
.into_iter()
.map(SymbolicByte::from)
.take(instruction.inputs[0].size)
.collect(),
.collect::<PcodeValue<_>>(),
)
.expect("failed to write lhs");

if instruction.inputs.len() > 1 {
memory
.write(
.write_value(
&instruction.inputs[1],
0x0123456789abcdefu64
.to_le_bytes()
.into_iter()
.map(SymbolicByte::from)
.take(instruction.inputs[1].size)
.collect(),
.collect::<PcodeValue<_>>(),
)
.expect("failed to write rhs");
}
Expand Down
1 change: 0 additions & 1 deletion crates/sym/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ mod bit;
mod buf;
mod convert;
mod eval;
mod pcode;
mod vec;

pub use crate::bit::*;
Expand Down
164 changes: 0 additions & 164 deletions crates/sym/src/pcode.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/sym/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ mod bitbuf;
mod bitvec;
mod convert;
mod eval;
mod pcode;
7 changes: 0 additions & 7 deletions crates/sym/src/tests/pcode.rs

This file was deleted.

12 changes: 12 additions & 0 deletions crates/sympcode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "sympcode"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true

[dependencies]
symbit = { version = "0.1", path = "../sym" }
pcode-ops = { version = "0.1", path = "../pcode-ops/" }
4 changes: 4 additions & 0 deletions crates/sympcode/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mod pcode;

pub use pcode::{SymBit, SymByte, SymPcode};
pub use symbit;
Loading