File tree Expand file tree Collapse file tree 4 files changed +10
-3
lines changed
Expand file tree Collapse file tree 4 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 33pushd storage_program
44./build.sh
55popd
6- storage_binary=./storage_program/target/x86_64-unknown-linux-musl/ release/demo
6+ storage_binary=./storage_program/target/release/demo
77objcopy -w --extract-symbol --strip-symbol=! remote* --strip-symbol=* $storage_binary storage.syms
88gcc-12 -static -O2 symbol_offset.c -o symbol_offset
99./symbol_offset storage.syms 0x44000000
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -e
3- RUSTFLAGS=" -Zexport-executable-symbols" cargo build --target x86_64-unknown-linux-musl --release
3+ RUSTFLAGS=" -Ctarget-feature=+crt-static -Zexport-executable-symbols" cargo build --release
4+ # RUSTFLAGS="-Zexport-executable-symbols" cargo build --target x86_64-unknown-linux-musl --release
Original file line number Diff line number Diff line change 11use std:: process:: ExitCode ;
2+ use std:: sync:: { LazyLock , Mutex } ;
3+ static ARRAY : LazyLock < Mutex < Vec < i32 > > > = LazyLock :: new ( || Mutex :: new ( vec ! [ ] ) ) ;
24
35#[ no_mangle]
46extern "C" fn remote_function ( arg : fn ( i32 ) -> i32 , value : i32 ) -> i32 {
7+ // Locked reference to avoid data race issues
8+ ARRAY . lock ( ) . unwrap ( ) . push ( value) ;
9+ //println!("In remote_function with vec: {:?}", *ARRAY.lock().unwrap());
510 return arg ( value) ;
611}
712
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ int main(int argc, char** argv)
170170 tinykvm::Machine vm{master_vm, options};
171171 assert (vm.is_remote_connected ());
172172
173- /* Call 'do_calculation' with 21 as argument */
173+ /* Measure call overhead */
174174 auto do_it = callback_address.find (" do_nothing" );
175175 if (do_it == callback_address.end ()) {
176176 fprintf (stderr, " Error: no do_nothing() in guest\n " );
@@ -187,6 +187,7 @@ int main(int argc, char** argv)
187187 }) / 100.0 ;
188188 printf (" Call overhead: %.2fus\n " , call_overhead * 1e6 );
189189
190+ /* Call 'do_calculation' with 21 as argument */
190191 printf (" Calling do_calculation() @ 0x%lX\n " , calc_it->second );
191192 for (int i = 0 ; i < 10 ; i++)
192193 vm.timed_vmcall (calc_it->second , 5 .0f , 21 );
You can’t perform that action at this time.
0 commit comments