Skip to content
Snippets Groups Projects
Commit a201c66f authored by Per's avatar Per
Browse files

ktest

parent d2d86753
Branches
No related tags found
No related merge requests found
...@@ -8,43 +8,51 @@ extern crate panic_halt; ...@@ -8,43 +8,51 @@ extern crate panic_halt;
use stm32f4::stm32f401 as stm32; use stm32f4::stm32f401 as stm32;
use cortex_m::{asm, bkpt, iprintln}; use cortex_m::{asm, bkpt};
use cortex_m_rt::entry; use cortex_m_rt::entry;
// // use klee_sys::klee_make_symbolic2;
// // Mimic RTFM resources
// static mut X: u32 = 54;
#[entry] #[entry]
#[inline(never)]
fn main() -> ! { fn main() -> ! {
let mut x: u32 = 54; let mut x = 54;
// klee_make_symbolic(&mut x);
// while x == 0 {} klee_make_symbolic(&mut x);
// // asm::bkpt();
// if x == 0 {
// bkpt!();
bkpt!(1); }
asm::nop();
asm::nop();
bkpt!(2);
asm::nop();
bkpt!();
loop { loop {
asm::nop(); asm::nop();
} }
} }
#[inline(always)] #[inline(never)]
fn klee_make_symbolic<T>(data: &mut T) { pub fn klee_make_symbolic<T>(data: &mut T) {
asm::bkpt(); // force llvm to consider data to be mutaded
// unsafe { klee_bkpt(data as *mut T as *mut core::ffi::c_void) }; unsafe {
asm!("bkpt #0" : /* output */: /* input */ "r"(data): /* clobber */ : "volatile")
}
} }
#[no_mangle] // pub fn taint() {
pub extern "C" fn klee_bkpt(data: *mut core::ffi::c_void) { // unsafe {
//*data = 0; // X = 73;
asm::bkpt(); // }
} // }
// #[no_mangle]
// pub extern "C" fn klee_bkpt(data: *mut core::ffi::c_void) {
// bkpt!();
// }
// extern "C" { // extern "C" {
// pub fn klee_bkpt(ptr: *mut core::ffi::c_void, // pointer to the data // pub fn klee_bkpt(ptr: *mut core::ffi::c_void, // pointer to the data
// ); // );
// } // }
// cargo objdump --bin app --release -- -disassemble -no-show-raw-insn
// unsafe { asm!("mov $0,R15" : "=r"(r) ::: "volatile") }
// cargo objdump --example f401_ktest --release --features f4,inline-asm --target thumbv7em-none-eabihf -- -d
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment