我有以下代码:
static DEFINE_PER_CPU_ALIGNED(cpu_clock_t, cpu_clock);
static void func(void *info)
{
uint64_t cpu_clock_pa = per_cpu_ptr_to_phys(get_cpu_ptr(&cpu_clock));
__asm__ __volatile__ ... //Giving the PA to VMware kernel which is supposed to write something to there
put_cpu_ptr(cpu_clock);
}
问题是,当此代码作为内核初始化的一部分运行时,我在VMware Workstation中收到一条消息,"访客操作系统上禁用了CPU",这意味着发生了一些内核恐慌,当我在之后使用相同的代码时内核靴子(称其为模块初始化的一部分(,它可以正常工作...
我的代码在 setup_per_cpu_areas
之前运行。