|
| 1 | +Hexagon Virtual Machine |
| 2 | +======================= |
| 3 | + |
| 4 | +The hexagon virtual machine is a hypervisor that can partition a single |
| 5 | +Hexagon DSP among multiple guest operating systems, and abstracts the |
| 6 | +specific details of a DSP architectural revision for the sake of consistency |
| 7 | +among generations. |
| 8 | + |
| 9 | +The ``virt`` machine has Hexagon VM emulation enabled by default. |
| 10 | + |
| 11 | +Events |
| 12 | +------ |
| 13 | + |
| 14 | +The guest operating system should register the Guest Event Vector Base |
| 15 | +via the ``vmsetvec`` virtual instruction at system startup. The vector table |
| 16 | +and handlers are determined by the guest OS. |
| 17 | + |
| 18 | +Guests return from event handlers with ``vmrte``. This instruction will restore |
| 19 | +the mode (user versus guest), interrupt enable state, PC, SP. |
| 20 | + |
| 21 | +.. list-table:: Event types |
| 22 | + :header-rows: 1 |
| 23 | + |
| 24 | + * - Number |
| 25 | + - Name |
| 26 | + - Description |
| 27 | + - Maskable |
| 28 | + - Detail |
| 29 | + * - 0 |
| 30 | + - Reserved |
| 31 | + - |
| 32 | + - |
| 33 | + - |
| 34 | + * - 1 |
| 35 | + - Machine check event |
| 36 | + - unrecoverable VM state |
| 37 | + - No |
| 38 | + - execution terminates if unhandled |
| 39 | + * - 2 |
| 40 | + - General exception |
| 41 | + - internal hardware or software exception |
| 42 | + - No |
| 43 | + - |
| 44 | + * - 3-4 |
| 45 | + - Reserved |
| 46 | + - |
| 47 | + - |
| 48 | + - |
| 49 | + * - 5 |
| 50 | + - ``trap0`` |
| 51 | + - ``trap0`` instruction |
| 52 | + - No |
| 53 | + - |
| 54 | + * - 6 |
| 55 | + - Reserved |
| 56 | + - |
| 57 | + - |
| 58 | + - |
| 59 | + * - 7 |
| 60 | + - Interrupt |
| 61 | + - external interrupts |
| 62 | + - Yes |
| 63 | + - increasing interrupt numbers have descending priority |
| 64 | + |
| 65 | +Startup |
| 66 | +------- |
| 67 | +In order to transition to user-mode, the guest OS must set the ``UM`` bit in |
| 68 | +the guest status register and specify the address to start executing in |
| 69 | +user mode in the guest event link register. |
| 70 | + |
| 71 | +Virtual Instructions |
| 72 | +-------------------- |
| 73 | + |
| 74 | +.. list-table:: Virtual Instructions |
| 75 | + :header-rows: 1 |
| 76 | + |
| 77 | + * - Instruction |
| 78 | + - Behavior |
| 79 | + - Operand |
| 80 | + - Input |
| 81 | + - Output |
| 82 | + * - vmversion |
| 83 | + - returns the VM version |
| 84 | + - 0x0 |
| 85 | + - requested VM version |
| 86 | + - provided VM version |
| 87 | + * - vmrte |
| 88 | + - return from event |
| 89 | + - 0x1 |
| 90 | + - Event info in g3:0 |
| 91 | + - N/A |
| 92 | + * - vmsetvec |
| 93 | + - set event vector |
| 94 | + - 0x2 |
| 95 | + - r0 is set to vector table addr |
| 96 | + - r0 is 0 on success, 1 otherwise |
| 97 | + * - vmsetie |
| 98 | + - set interrupt enabled |
| 99 | + - 0x3 |
| 100 | + - r0 is set to 1 to enable, 0 to disable |
| 101 | + - previous IE bit is stored as LSB of r0 |
| 102 | + * - vmgetie |
| 103 | + - get interrupt enabled |
| 104 | + - 0x4 |
| 105 | + - N/A |
| 106 | + - current IE bit is stored as LSB of r0 |
| 107 | + * - vmintop |
| 108 | + - interrupt operation |
| 109 | + - 0x5 |
| 110 | + - r0 = Interrupt Op, r1-r4: Depends on Op |
| 111 | + - r0 - value depends on operation |
| 112 | + * - vmclrmap |
| 113 | + - clear virtual memory map |
| 114 | + - 0xa |
| 115 | + - r0 = Interrupt Op, r1-r4: Depends on Op |
| 116 | + - r0 - value depends on operation |
| 117 | + * - vmnewmap |
| 118 | + - set new virtual memory map |
| 119 | + - 0xb |
| 120 | + - r0 contains logical address of new segment table, r1 =Type of translations |
| 121 | + - r0 contains 0 on success, otherwise negative error code |
| 122 | + * - vmcache |
| 123 | + - VM cache control: not modeled |
| 124 | + - 0xd |
| 125 | + - r0 contains the operation to be performed, r1 = Starting virtual address, r2 contains the length in bytes |
| 126 | + - r0 contains 0 on success, otherwise -1. Cache behavior is not modeled so this operation always succeeds. |
| 127 | + * - vmgettime |
| 128 | + - Get virtual machine time |
| 129 | + - 0xe |
| 130 | + - N/A |
| 131 | + - r0 contains the least significant 32 bits of timestamp, r1 contains the most significant 32 bits of timestamp |
| 132 | + * - vmsettime |
| 133 | + - Set virtual machine time |
| 134 | + - 0xf |
| 135 | + - r0 contains the least significant 32 bits of timestamp, r1 contains the most significant 32 bits of timestamp |
| 136 | + - N/A |
| 137 | + * - vmwait |
| 138 | + - wait for interrupt |
| 139 | + - 0x10 |
| 140 | + - N/A |
| 141 | + - r0 contains the interrupt number of the interrupt waking the guest |
| 142 | + * - vmyield |
| 143 | + - voluntarily yield VM task |
| 144 | + - 0x11 |
| 145 | + - N/A |
| 146 | + - N/A |
| 147 | + * - vmstart |
| 148 | + - Create new virtual processor instance |
| 149 | + - 0x12 |
| 150 | + - r0 contains the starting execution address, r1 contains the starting stack pointer |
| 151 | + - r0 contains the Virtual processor number of new virtual processor on success, otherwise -1 |
| 152 | + * - vmstop |
| 153 | + - terminate current virtual processor instance |
| 154 | + - 0x13 |
| 155 | + - N/A |
| 156 | + - N/A |
| 157 | + * - vmvpid |
| 158 | + - get the virtual processor ID |
| 159 | + - 0x14 |
| 160 | + - N/A |
| 161 | + - r0 contains the virtual processor number of virtual processor executing the instruction |
| 162 | + * - vmsetregs |
| 163 | + - Set guest registers |
| 164 | + - 0x15 |
| 165 | + - r0-3 hold g0-3 values |
| 166 | + - N/A |
| 167 | + * - vmgetregs |
| 168 | + - Get guest registers |
| 169 | + - 0x16 |
| 170 | + - N/A |
| 171 | + - r0-3 hold g0-3 values |
| 172 | + * - vmtimerop |
| 173 | + - perform an operation on a system timer |
| 174 | + - 0x18 |
| 175 | + - getfreq = 0 |
| 176 | + getres = 1 |
| 177 | + gettime = 2 |
| 178 | + gettimeout = 3 |
| 179 | + settimeout = 4 |
| 180 | + deltatimeout = 5 |
| 181 | + - TBD |
| 182 | + * - vmgetinfo |
| 183 | + - Get system info |
| 184 | + - 0x1a |
| 185 | + - Index of the system info parameter: FIXME another table |
| 186 | + - value of the indicated system info parameter |
0 commit comments