@@ -45,7 +45,7 @@ use hyperlight_guest::entrypoint::{abort_with_code, abort_with_code_and_message}
4545use hyperlight_guest:: error:: { HyperlightGuestError , Result } ;
4646use hyperlight_guest:: guest_function_definition:: GuestFunctionDefinition ;
4747use hyperlight_guest:: guest_function_register:: register_function;
48- use hyperlight_guest:: host_function_call:: { call_host_function, get_host_return_value } ;
48+ use hyperlight_guest:: host_function_call:: call_host_function;
4949use hyperlight_guest:: memory:: malloc;
5050use hyperlight_guest:: { logging, MIN_STACK_ADDRESS } ;
5151use log:: { error, LevelFilter } ;
@@ -86,13 +86,13 @@ fn echo_float(function_call: &FunctionCall) -> Result<Vec<u8>> {
8686}
8787
8888fn print_output ( message : & str ) -> Result < Vec < u8 > > {
89- call_host_function (
89+ let res = call_host_function :: < i32 > (
9090 "HostPrint" ,
9191 Some ( Vec :: from ( & [ ParameterValue :: String ( message. to_string ( ) ) ] ) ) ,
9292 ReturnType :: Int ,
9393 ) ?;
94- let result = get_host_return_value :: < i32 > ( ) ? ;
95- Ok ( get_flatbuffer_result ( result ) )
94+
95+ Ok ( get_flatbuffer_result ( res ) )
9696}
9797
9898fn simple_print_output ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
@@ -679,9 +679,7 @@ fn add_to_static_and_fail(_: &FunctionCall) -> Result<Vec<u8>> {
679679
680680fn violate_seccomp_filters ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
681681 if function_call. parameters . is_none ( ) {
682- call_host_function ( "MakeGetpidSyscall" , None , ReturnType :: ULong ) ?;
683-
684- let res = get_host_return_value :: < u64 > ( ) ?;
682+ let res = call_host_function :: < u64 > ( "MakeGetpidSyscall" , None , ReturnType :: ULong ) ?;
685683
686684 Ok ( get_flatbuffer_result ( res) )
687685 } else {
@@ -697,14 +695,11 @@ fn add(function_call: &FunctionCall) -> Result<Vec<u8>> {
697695 function_call. parameters . clone ( ) . unwrap ( ) [ 0 ] . clone ( ) ,
698696 function_call. parameters . clone ( ) . unwrap ( ) [ 1 ] . clone ( ) ,
699697 ) {
700- call_host_function (
698+ let res = call_host_function :: < i32 > (
701699 "HostAdd" ,
702700 Some ( Vec :: from ( & [ ParameterValue :: Int ( a) , ParameterValue :: Int ( b) ] ) ) ,
703701 ReturnType :: Int ,
704702 ) ?;
705-
706- let res = get_host_return_value :: < i32 > ( ) ?;
707-
708703 Ok ( get_flatbuffer_result ( res) )
709704 } else {
710705 Err ( HyperlightGuestError :: new (
@@ -1156,12 +1151,11 @@ pub fn guest_dispatch_function(function_call: FunctionCall) -> Result<Vec<u8>> {
11561151 1 ,
11571152 ) ;
11581153
1159- call_host_function (
1154+ let result = call_host_function :: < i32 > (
11601155 "HostPrint" ,
11611156 Some ( Vec :: from ( & [ ParameterValue :: String ( message. to_string ( ) ) ] ) ) ,
11621157 ReturnType :: Int ,
11631158 ) ?;
1164- let result = get_host_return_value :: < i32 > ( ) ?;
11651159 let function_name = function_call. function_name . clone ( ) ;
11661160 let param_len = function_call. parameters . clone ( ) . unwrap_or_default ( ) . len ( ) ;
11671161 let call_type = function_call. function_call_type ( ) . clone ( ) ;
@@ -1195,7 +1189,8 @@ fn fuzz_host_function(func: FunctionCall) -> Result<Vec<u8>> {
11951189 ) )
11961190 }
11971191 } ;
1198- call_host_function ( & host_func_name, Some ( params) , func. expected_return_type )
1192+
1193+ let res = call_host_function :: < ( ) > ( & host_func_name, Some ( params) , func. expected_return_type )
11991194 . expect ( "failed to call host function" ) ;
1200- Ok ( get_flatbuffer_result ( ( ) ) )
1195+ Ok ( get_flatbuffer_result ( res ) )
12011196}
0 commit comments