Skip to content

Commit d403a03

Browse files
committed
Update FAQ
1 parent 0ba69d6 commit d403a03

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

docs/FAQ.md

+6-9
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,15 @@ To provide end users with simple API, Unicorn does lots of dirty hacks within qe
113113

114114
Yes, it’s possible but that is not Unicorn’s goal and there is no simple switch in qemu to disable softmmu.
115115

116-
## How can I interact with MMU/TLB?
116+
Starting from 2.0.2, Unicorn will emulate the MMU depending on the emulated architecture without further hacks. That said, Unicorn offers the full ability of the target MMU implementation. While this enables more possibilities of Uncorn, it has a few drawbacks:
117117

118-
By default Unicorn will emulate the MMU depending on the emulated architecture.
119-
So you can use the features and interfaces of this MMU.
120-
You or the emulated code can write to the memory and corresponding register to use the MMU.
118+
- As previous question points out already, some memory regions are not writable/executable.
119+
- You have to always check architecture-specific registers to confirm MMU status.
120+
- `uc_mem_map` will always deal with physical addresses while `uc_emu_start` accepts virtual addresses.
121121

122-
There is also use the `UC_TLB_VIRTUAL` mode.
123-
This mode defaults to a simple paddr := vaddr mapping.
122+
Therefore, if you still prefer the previous `paddr = vaddr` simple mapping, we have a simple experimental MMU implementation that can be switched on by: `uc_ctl_tlb_mode(uc, UC_TLB_VIRTUAL)`. With this mode, you could also add a `UC_HOOK_TLB_FILL` hook to manage the TLB. When a virtual address is not cached, the hook will be called. Besides, users are allowed to flush the tlb with `uc_ctl_flush_tlb`.
124123

125-
You can also add an `UC_HOOK_TLB_FILL` hook to manage the TLB.
126-
The hook is called, when a virtuall address is not cached and Unicorn is in `UC_TLB_VIRTUAL` mode.
127-
You can manual flush the cache with `uc_ctl_flush_tlb`.
124+
In theory, `UC_TLB_VIRTUAL` will achieve better performance as it skips all MMU details, though not benchmarked.
128125

129126
## I'd like to make contributions, where do I start?
130127

0 commit comments

Comments
 (0)