Martins3 / Martins3.github.io

:book: Scratchpad about Linux, Compiler and Virtualization
https://martins3.github.io
GNU General Public License v2.0
61 stars 14 forks source link

https://martins3.github.io/qemu-map.html #30

Closed utterances-bot closed 3 years ago

utterances-bot commented 3 years ago

QEMU 中的 map 和 set 的使用 | Martins3.github.io

:book: Scratchpad about Linux, Compiler, and Virtualization

https://martins3.github.io/qemu-map.html

Martins3 commented 3 years ago

有问题,欢迎评论指出。

ne1llee commented 1 year ago

请问一下qemu tcg中retaddr地址代表什么意思,能否和虚拟地址、物理地址互相转换呢

Martins3 commented 1 year ago

我回忆一下

Martins3 commented 1 year ago

guest 退出到 host 的时候地址

ne1llee commented 1 year ago

guest 退出到 host 的时候地址

我调了一下 很多时候是call的返回地址

Martins3 commented 1 year ago

什么函数的 call ?

ne1llee commented 1 year ago

有个问题想请教,tcg模式下,我有一个guest系统里面的虚拟地址,但是这个地址还没有被guest操作系统映射,我想在cpu_exec函数执行时检查这个虚拟地址执行的内存,有什么好的方式让guest系统映射呢? 目前想法是调用tlb_fill产生一个page fault,再捕获这个page fault转到正常流程里面。 但是tlb_fill需要这个虚拟地址对应的retaddr 我不知道怎么得到 😅

Martins3 commented 1 year ago

guest 当时给该虚拟地址分配了物理页面吗?

ne1llee commented 1 year ago

guest 当时给该虚拟地址分配了物理页面吗?

还没有物理地址 cpu_physical_memory_rw 读取不到

Martins3 commented 1 year ago

无论如何,你要让 guest 给这个地址分配物理页面呀。

ne1llee commented 1 year ago

无论如何,你要让 guest 给这个地址分配物理页面呀。

是的,就是需要一种好的方法让guest给这个地址分配物理页面,通过调用tlb_fill向guest注入一个缺页异常,guest就会分配这个物理页面了

Martins3 commented 1 year ago

为什么不用该地址直接构造一个 fault exception 注入到 guest 中。

Martins3 commented 1 year ago

而且就算 Guest 分配了页面也没意义啊,你要检查分配内存中的内容, kernel 里面存在 zero page 的概念的,如果 read page fault, 是指向一个固定的页面的。