Showing the changes to src/include (2 of 8 files). Show all
Unified · Split
| @@ -709,7 +709,7 @@ namespace disvm · 708 unmodified lines | ||
| 709 | 709 | const vm_string_t &exception_id); |
| 710 | 710 | |
| 711 | 711 | // VM thread states |
| 712 | − enum class vm_thread_state_t : uint16_t | |
| 712 | + enum class vm_thread_state_t : uint8_t | |
| 713 | 713 | { |
| 714 | 714 | unknown = 0, |
| 715 | 715 | |
| @@ -729,6 +729,13 @@ namespace disvm · 13 unmodified lines | ||
| 729 | 729 | broken, // thread crashed - the scheduler is free to terminate the entire VM if any thread enters this state. |
| 730 | 730 | }; |
| 731 | 731 | |
| 732 | + // VM trap flags | |
| 733 | + enum class vm_trap_flags_t : uint8_t | |
| 734 | + { | |
| 735 | + none = 0, | |
| 736 | + instruction = 1 << 0, | |
| 737 | + }; | |
| 738 | + | |
| 732 | 739 | // Forward declaration |
| 733 | 740 | class vm_thread_t; |
| 734 | 741 | class vm_tool_dispatch_t; |
| @@ -738,11 +745,11 @@ namespace disvm · 3 unmodified lines | ||
| 738 | 745 | { |
| 739 | 746 | public: |
| 740 | 747 | vm_registers_t( |
| 741 | − const vm_thread_t &thread, | |
| 748 | + vm_thread_t &thread, | |
| 742 | 749 | vm_module_ref_t &entry); |
| 743 | 750 | ~vm_registers_t(); |
| 744 | 751 | |
| 745 | − const vm_thread_t &thread; | |
| 752 | + vm_thread_t &thread; | |
| 746 | 753 | std::atomic<vm_tool_dispatch_t *> tool_dispatch; |
| 747 | 754 | vm_stack_t stack; // Frame pointer access (FP) |
| 748 | 755 | vm_pc_t pc; // Current Program counter (Index into module code section) |
| @@ -751,8 +758,9 @@ namespace disvm · 2 unmodified lines | ||
| 751 | 758 | vm_module_ref_t *module_ref; // Module reference |
| 752 | 759 | vm_request_mutex_t request_mutex; |
| 753 | 760 | |
| 754 | − vm_thread_state_t current_thread_state; | |
| 755 | 761 | uint16_t current_thread_quanta; |
| 762 | + vm_thread_state_t current_thread_state; | |
| 763 | + vm_trap_flags_t trap_flags; | |
| 756 | 764 | |
| 757 | 765 | pointer_t src; |
| 758 | 766 | pointer_t mid; |
| @@ -795,8 +803,6 @@ namespace disvm · 36 unmodified lines | ||
| 795 | 803 | // this vm thread. |
| 796 | 804 | void set_tool_dispatch(vm_tool_dispatch_t *dispatch); |
| 797 | 805 | |
| 798 | − vm_thread_state_t get_state() const; | |
| 799 | − | |
| 800 | 806 | // This function will only return a non-null |
| 801 | 807 | // value if this thread is in the broken state. |
| 802 | 808 | const char *get_error_message() const; |
| @@ -23,6 +23,7 @@ namespace disvm · 22 unmodified lines | ||
| 23 | 23 | union vm_context_value_t |
| 24 | 24 | { |
| 25 | 25 | cookie_t cookie; |
| 26 | + vm_trap_flags_t trap; | |
| 26 | 27 | std::shared_ptr<vm_module_t> *module; // Note this is a pointer to std::shared_ptr<> |
| 27 | 28 | vm_registers_t *registers; |
| 28 | 29 | const vm_thread_t *thread; |
| @@ -61,6 +62,9 @@ namespace disvm · 32 unmodified lines | ||
| 61 | 62 | |
| 62 | 63 | breakpoint, // value1: vm_registers_t |
| 63 | 64 | // value2: cookie_t - cookie of breakpoint. '0' indicates the breakpoint was inserted by the VM or compiler. |
| 65 | + | |
| 66 | + trap, // value1: vm_registers_t - The trap flag is unset prior to the event be fired. | |
| 67 | + // value2: vm_trap_flags_t | |
| 64 | 68 | }; |
| 65 | 69 | |
| 66 | 70 | using vm_event_callback_t = std::function<void(vm_event_t, vm_event_context_t &)>; |
| @@ -91,6 +95,7 @@ namespace disvm · 24 unmodified lines | ||
| 91 | 95 | // Manipulate thread execution |
| 92 | 96 | virtual void suspend_all_threads() = 0; |
| 93 | 97 | virtual void resume_all_threads() = 0; |
| 98 | + virtual void set_thread_trap_flag(const vm_registers_t &, vm_trap_flags_t flag) = 0; | |
| 94 | 99 | }; |
| 95 | 100 | } |
| 96 | 101 | } |