Find the physical address of exception vector table from kernel module

后端 未结 2 760
甜味超标
甜味超标 2020-11-30 14:41

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

I tried to find the physical address of the exception vector table. I Know

2条回答
  •  鱼传尺愫
    2020-11-30 15:05

    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.

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

    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 is the high vector virtual address.
    • 0xfffff000 is the mask for 4k pages.

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

提交回复
热议问题