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 text_word_off = vm->text_off / 8UL; 21 7779 : ulong entry_pc = vm->entry_pc; 22 7779 : ulong const * FD_RESTRICT calldests = vm->calldests; 23 : 24 7779 : fd_sbpf_syscalls_t const * FD_RESTRICT syscalls = vm->syscalls; 25 : 26 7779 : ulong const * FD_RESTRICT region_haddr = vm->region_haddr; 27 7779 : uint const * FD_RESTRICT region_ld_sz = vm->region_ld_sz; 28 7779 : uint const * FD_RESTRICT region_st_sz = vm->region_st_sz; 29 : 30 7779 : ulong * FD_RESTRICT reg = vm->reg; 31 : 32 7779 : fd_vm_shadow_t * FD_RESTRICT shadow = vm->shadow; 33 : 34 7779 : int err = FD_VM_SUCCESS; 35 : 36 : /* Run the VM */ 37 7779 : # include "fd_vm_interp_core.c" 38 : 39 7779 : return err; 40 936372 : } 41 : 42 : int 43 0 : fd_vm_exec_trace( fd_vm_t * vm ) { 44 : 45 0 : # define FD_VM_INTERP_EXE_TRACING_ENABLED 1 46 0 : # define FD_VM_INTERP_MEM_TRACING_ENABLED 1 47 : 48 0 : if( FD_UNLIKELY( !vm ) ) return FD_VM_ERR_INVAL; 49 : 50 : /* Pull out variables needed for the fd_vm_interp_core template */ 51 0 : ulong frame_max = FD_VM_STACK_FRAME_MAX; /* FIXME: vm->frame_max to make this run-time configured */ 52 : 53 0 : ulong const * FD_RESTRICT text = vm->text; 54 0 : ulong text_cnt = vm->text_cnt; 55 0 : ulong text_word_off = vm->text_off / 8UL; 56 0 : ulong entry_pc = vm->entry_pc; 57 0 : ulong const * FD_RESTRICT calldests = vm->calldests; 58 : 59 0 : fd_sbpf_syscalls_t const * FD_RESTRICT syscalls = vm->syscalls; 60 : 61 0 : ulong const * FD_RESTRICT region_haddr = vm->region_haddr; 62 0 : uint const * FD_RESTRICT region_ld_sz = vm->region_ld_sz; 63 0 : uint const * FD_RESTRICT region_st_sz = vm->region_st_sz; 64 : 65 0 : ulong * FD_RESTRICT reg = vm->reg; 66 : 67 0 : fd_vm_shadow_t * FD_RESTRICT shadow = vm->shadow; 68 : 69 0 : int err = FD_VM_SUCCESS; 70 : 71 : /* Run the VM */ 72 0 : # include "fd_vm_interp_core.c" 73 : 74 0 : # undef FD_VM_INTERP_EXE_TRACING_ENABLED 75 0 : # undef FD_VM_INTERP_MEM_TRACING_ENABLED 76 : 77 0 : return err; 78 0 : }