Line data Source code
1 : #include "fd_vm_base.h" 2 : #include "fd_vm_private.h" 3 : 4 : /* FIXME: MAKE DIFFERENT VERSIONS FOR EACH COMBO OF CHECK_ALIGN/TRACE? */ 5 : /* TODO: factor out common unpacking code */ 6 : 7 : int 8 7779 : fd_vm_exec_notrace( fd_vm_t * vm ) { 9 : 10 7779 : # undef FD_VM_INTERP_EXE_TRACING_ENABLED 11 7779 : # undef FD_VM_INTERP_MEM_TRACING_ENABLED 12 : 13 7779 : if( FD_UNLIKELY( !vm ) ) return FD_VM_ERR_INVAL; 14 : 15 : /* Pull out variables needed for the fd_vm_interp_core template */ 16 7779 : ulong frame_max = FD_VM_STACK_FRAME_MAX; /* FIXME: vm->frame_max to make this run-time configured */ 17 : 18 7779 : ulong const * FD_RESTRICT text = vm->text; 19 7779 : ulong text_cnt = vm->text_cnt; 20 7779 : ulong entry_pc = vm->entry_pc; 21 7779 : ulong const * FD_RESTRICT calldests = vm->calldests; 22 : 23 7779 : fd_sbpf_syscalls_t const * FD_RESTRICT syscalls = vm->syscalls; 24 : 25 7779 : ulong const * FD_RESTRICT region_haddr = vm->region_haddr; 26 7779 : uint const * FD_RESTRICT region_ld_sz = vm->region_ld_sz; 27 7779 : uint const * FD_RESTRICT region_st_sz = vm->region_st_sz; 28 : 29 7779 : ulong * FD_RESTRICT reg = vm->reg; 30 : 31 7779 : fd_vm_shadow_t * FD_RESTRICT shadow = vm->shadow; 32 : 33 7779 : int err = FD_VM_SUCCESS; 34 : 35 : /* Run the VM */ 36 7779 : # include "fd_vm_interp_core.c" 37 : 38 7779 : return err; 39 936372 : } 40 : 41 : int 42 0 : fd_vm_exec_trace( fd_vm_t * vm ) { 43 : 44 0 : # define FD_VM_INTERP_EXE_TRACING_ENABLED 1 45 0 : # define FD_VM_INTERP_MEM_TRACING_ENABLED 1 46 : 47 0 : if( FD_UNLIKELY( !vm ) ) return FD_VM_ERR_INVAL; 48 : 49 : /* Pull out variables needed for the fd_vm_interp_core template */ 50 0 : ulong frame_max = FD_VM_STACK_FRAME_MAX; /* FIXME: vm->frame_max to make this run-time configured */ 51 : 52 0 : ulong const * FD_RESTRICT text = vm->text; 53 0 : ulong text_cnt = vm->text_cnt; 54 0 : ulong entry_pc = vm->entry_pc; 55 0 : ulong const * FD_RESTRICT calldests = vm->calldests; 56 : 57 0 : fd_sbpf_syscalls_t const * FD_RESTRICT syscalls = vm->syscalls; 58 : 59 0 : ulong const * FD_RESTRICT region_haddr = vm->region_haddr; 60 0 : uint const * FD_RESTRICT region_ld_sz = vm->region_ld_sz; 61 0 : uint const * FD_RESTRICT region_st_sz = vm->region_st_sz; 62 : 63 0 : ulong * FD_RESTRICT reg = vm->reg; 64 : 65 0 : fd_vm_shadow_t * FD_RESTRICT shadow = vm->shadow; 66 : 67 0 : int err = FD_VM_SUCCESS; 68 : 69 : /* Run the VM */ 70 0 : # include "fd_vm_interp_core.c" 71 : 72 0 : # undef FD_VM_INTERP_EXE_TRACING_ENABLED 73 0 : # undef FD_VM_INTERP_MEM_TRACING_ENABLED 74 : 75 0 : return err; 76 0 : }