发现异常向量表从内核模块的物理地址内核、量表、模块、异常

2023-09-12 06:42:46 作者:穷水尽更词穷

我有一个Android设备 - 三星Galaxy S2与内核版本2.6.35.14(的ARM Cortex A9)

I have an android device - Samsung galaxy s2 with kernel version 2.6.35.14 (arm cortex a9)

我试图找到异常向量表的物理地址。我知道,这是在为0xffff0000虚拟地址。 (我可以打印通过内核模块的价值)

I tried to find the physical address of the exception vector table. I Know that it is at 0xffff0000 virtual address. (i can print its value via kernel module)

我也知道,大部分的内核虚拟地址(物理)翻译是由价值0x8000000变电站完成的。

I also know that the translation of most of the kernel virtual address (to physical) is done by substation of the value 0x8000000.

我有一个可以直接从设备的内存中读取数据的设备,我想获得异常向量表。

I have a device that can read data directly from devices memory and i want to get the exception vector table.

当我建立了一个内核模块,并试图用我已经得到了一些地址,但该表是不存在的宏virt_to_phys(为0xffff0000)。我成功找到这样的系统调用表,但这里的宏给了我错误的地址。

when i built a kernel module and tried to use the macro virt_to_phys(0xffff0000) i have got some address but the table is not there. i succeed to find in this way the system call table but here the macro gave me wrong address.

有谁知道为什么会这样?确实异常向量表的地址居住在一个特殊的物理地址?请问内核转换其地址在一些特殊的方式?

Does anyone know why this happens? does the address of the exception vector table resides in a special physical address? Does the kernel translates its address in some special way?

谢谢!

推荐答案

另外,也可以直接使用MMU(寄存器ATS1Cxx和PAR)执行V =>点的翻译。请参阅 ARM公司第B4.2.4在血淋淋的细节。

It is also possible to use the MMU directly (registers ATS1Cxx and PAR) to perform V=>P translation. See section B4.2.4 of the ARM ARM for the gory details.

如果您使用MMU寄存器这种方式,您可能需要防止种族与寄存器其他用途。

If you use the MMU registers this way, you might need to protect against races with other uses of the registers.

这也许从具有以下code任何内核驱动程序访问,

This maybe accessed from any kernel driver with the following code,

 unsigned int pa;
 asm("\t mcr p15, 0, %0, c7, c8, 2\n"
     "\t isb\n"
     "\t mrc p15, 0, %0, c7, c4, 0\n" : "=r" (pa) : "0" (0xffff0000));
 printk("Vector is %x\n", pa & 0xfffff000);

的常量是正确的。

The constants are correct.

为0xffff0000是的高载体的虚拟地址。 0xfffff000是4K页面的面具。 0xffff0000 is the high vector virtual address. 0xfffff000 is the mask for 4k pages.

这仅适用于后来系列ARM处理器,如皮质系列。

This works only on later series ARM processors such as the Cortex series.