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