# Script engine in VMX non-root mode

The current version of HyperDbg's script engine is designed to work on vmx root-mode.

Some commands like [!epthook2](https://docs.hyperdbg.org/commands/extension-commands/epthook2) are not triggered on vmx root-mode, and these commands operate on vmx non-root mode. Even though it's possible, but from a design perspective, we prefer to keep these commands in vmx non-root mode and won't trigger them in vmx root-mode.

This way, these commands are faster as we won't have a transition (**vm-exit** and **vm-entry**).

On the other hand, the script engine is a crucial feature for the debugger, and all of the commands are supposed to support it.

These limitations are primarily originated from the fact that we access registers like **@rip**, **@rsp**, **@rflags**, **@cs**, **@ds**, and other segment registers from the vmx root-mode using **VMREAD** and **VMWRITE** instructions.

**VMREAD** and **VMWRITE** are not supposed to work on vmx non-root mode; thus, if you use a script like:

```
printf("RIP: %llx\n", @rip);
```

You'll end up with BSODs. Still, you can safely use general-purpose registers, conditional statements, etc.

For instance, the following script is okay.

```
printf("RAX: %llx\n", @rax);
```

Please consider these assumptions when you're using the script engine with vmx non-root commands.

In future versions, these limitations will be fixed, and you can use the script engine with vmx non-root commands as well as vmx-root mode commands.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hyperdbg.org/tips-and-tricks/considerations/script-engine-in-vmx-non-root-mode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
