我在 qemu -enable-kvm 之上运行一个 linux 来宾。我正在尝试使用已知的物理内存位置在 linux 和 qemu 之间创建反向通道。为了使用内核永远不会分配给任何人的内存地址,我使用 1024M 物理内存启动了来宾。在来宾中,我正在尝试访问第 2GB 字节(2*1024*1024*1024)。在重新编译内核时,我无法再次启动新内核。
我的代码如下..
/** in context_switch() function of kernel/sched.c */
#define PID_ADDR ((int *)((unsigned long)2 * (unsigned long)1024 * (unsigned long)1024 * (unsigned long)1024))
int* pid_addr = phys_to_virt(PID_ADDR);
*pid_addr = next->pid //next is the task-struct ptr of the next process that is going to run.
可以解释一下kvm如何使用分配给来宾的物理内存吗?