@@ -78,17 +78,6 @@ macro_rules! host_tests {
7878 }
7979 }
8080
81- #[ lucet_hostcall]
82- #[ allow( unreachable_code) ]
83- #[ no_mangle]
84- pub fn hostcall_test_func_hostcall_error_unwind( _vmctx: & mut Vmctx ) {
85- let _lock = HOSTCALL_MUTEX . lock( ) . unwrap( ) ;
86- unsafe {
87- lucet_hostcall_terminate!( ERROR_MESSAGE ) ;
88- }
89- drop( _lock) ;
90- }
91-
9281 #[ lucet_hostcall]
9382 #[ no_mangle]
9483 pub fn hostcall_bad_borrow( vmctx: & mut Vmctx ) -> bool {
@@ -175,7 +164,7 @@ macro_rules! host_tests {
175164 #[ allow( unreachable_code) ]
176165 #[ no_mangle]
177166 pub unsafe extern "C" fn hostcall_test_func_hostcall_error_unwind(
178- & mut vmctx ,
167+ vmctx : & mut Vmctx ,
179168 ) -> ( ) {
180169 let lock = HOSTCALL_MUTEX . lock( ) . unwrap( ) ;
181170 unsafe {
@@ -187,7 +176,7 @@ macro_rules! host_tests {
187176 #[ lucet_hostcall]
188177 #[ no_mangle]
189178 pub unsafe extern "C" fn nested_error_unwind_outer(
190- & mut vmctx ,
179+ vmctx : & mut Vmctx ,
191180 cb_idx: u32 ,
192181 ) -> u64 {
193182 unwind_outer( vmctx, & * NESTED_OUTER , cb_idx)
@@ -196,15 +185,15 @@ macro_rules! host_tests {
196185 #[ lucet_hostcall]
197186 #[ no_mangle]
198187 pub unsafe extern "C" fn nested_error_unwind_inner(
199- & mut vmctx ,
188+ vmctx : & mut Vmctx ,
200189 ) -> ( ) {
201190 unwind_inner( vmctx, & * NESTED_INNER )
202191 }
203192
204193 #[ lucet_hostcall]
205194 #[ no_mangle]
206195 pub unsafe extern "C" fn nested_error_unwind_regs_outer(
207- & mut vmctx ,
196+ vmctx : & mut Vmctx ,
208197 cb_idx: u32 ,
209198 ) -> u64 {
210199 unwind_outer( vmctx, & * NESTED_REGS_OUTER , cb_idx)
@@ -213,23 +202,23 @@ macro_rules! host_tests {
213202 #[ lucet_hostcall]
214203 #[ no_mangle]
215204 pub unsafe extern "C" fn nested_error_unwind_regs_inner(
216- & mut vmctx ,
205+ vmctx : & mut Vmctx ,
217206 ) -> ( ) {
218207 unwind_inner( vmctx, & * NESTED_REGS_INNER )
219208 }
220209
221210 #[ lucet_hostcall]
222211 #[ no_mangle]
223212 pub unsafe extern "C" fn hostcall_panic(
224- & mut _vmctx ,
213+ _vmctx : & mut Vmctx ,
225214 ) -> ( ) {
226215 panic!( "hostcall_panic" ) ;
227216 }
228217
229218 #[ lucet_hostcall]
230219 #[ no_mangle]
231220 pub unsafe extern "C" fn hostcall_restore_callee_saved(
232- & mut vmctx ,
221+ vmctx : & mut Vmctx ,
233222 cb_idx: u32 ,
234223 ) -> u64 {
235224 let mut a: u64 ;
@@ -289,7 +278,7 @@ macro_rules! host_tests {
289278 #[ lucet_hostcall]
290279 #[ no_mangle]
291280 pub unsafe extern "C" fn hostcall_stack_overflow_unwind(
292- & mut vmctx ,
281+ vmctx : & mut Vmctx ,
293282 cb_idx: u32 ,
294283 ) -> ( ) {
295284 let lock = STACK_OVERFLOW_UNWIND . lock( ) . unwrap( ) ;
@@ -309,7 +298,7 @@ macro_rules! host_tests {
309298 #[ lucet_hostcall]
310299 #[ no_mangle]
311300 pub unsafe extern "C" fn hostcall_bad_access_unwind(
312- & mut vmctx ,
301+ vmctx : & mut Vmctx ,
313302 cb_idx: u32 ,
314303 ) -> ( ) {
315304 let lock = BAD_ACCESS_UNWIND . lock( ) . unwrap( ) ;
@@ -326,86 +315,6 @@ macro_rules! host_tests {
326315 drop( lock) ;
327316 }
328317
329- #[ lucet_hostcall]
330- #[ no_mangle]
331- pub unsafe extern "C" fn hostcall_bad_borrow(
332- & mut vmctx,
333- ) -> bool {
334- let heap = vmctx. heap( ) ;
335- let mut other_heap = vmctx. heap_mut( ) ;
336- heap[ 0 ] == other_heap[ 0 ]
337- }
338-
339- #[ lucet_hostcall]
340- #[ no_mangle]
341- pub unsafe extern "C" fn hostcall_missing_embed_ctx(
342- & mut vmctx,
343- ) -> bool {
344- struct S {
345- x: bool
346- }
347- let ctx = vmctx. get_embed_ctx:: <S >( ) ;
348- ctx. x
349- }
350-
351- #[ lucet_hostcall]
352- #[ no_mangle]
353- pub unsafe extern "C" fn hostcall_multiple_vmctx(
354- & mut vmctx,
355- ) -> bool {
356- let mut vmctx1 = Vmctx :: from_raw( vmctx. as_raw( ) ) ;
357- vmctx1. heap_mut( ) [ 0 ] = 0xAF ;
358- drop( vmctx1) ;
359-
360- let mut vmctx2 = Vmctx :: from_raw( vmctx. as_raw( ) ) ;
361- let res = vmctx2. heap( ) [ 0 ] == 0xAF ;
362- drop( vmctx2) ;
363-
364- res
365- }
366-
367- #[ lucet_hostcall]
368- #[ no_mangle]
369- pub unsafe extern "C" fn hostcall_yields(
370- & mut vmctx,
371- ) -> ( ) {
372- vmctx. yield_( ) ;
373- }
374-
375- #[ lucet_hostcall]
376- #[ no_mangle]
377- pub unsafe extern "C" fn hostcall_yield_expects_5(
378- & mut vmctx,
379- ) -> u64 {
380- vmctx. yield_expecting_val( )
381- }
382-
383- #[ lucet_hostcall]
384- #[ no_mangle]
385- pub unsafe extern "C" fn hostcall_yields_5(
386- & mut vmctx,
387- ) -> ( ) {
388- vmctx. yield_val( 5u64 ) ;
389- }
390-
391- #[ lucet_hostcall]
392- #[ no_mangle]
393- pub unsafe extern "C" fn hostcall_yield_facts(
394- & mut vmctx,
395- n: u64 ,
396- ) -> u64 {
397- fn fact( vmctx: & mut Vmctx , n: u64 ) -> u64 {
398- let result = if n <= 1 {
399- 1
400- } else {
401- n * fact( vmctx, n - 1 )
402- } ;
403- vmctx. yield_val( result) ;
404- result
405- }
406- fact( vmctx, n)
407- }
408-
409318 #[ test]
410319 fn instantiate_trivial( ) {
411320 let module = test_module_c( "host" , "trivial.c" ) . expect( "build and load module" ) ;
0 commit comments