Find the physical address of the table of exception vector vectors from the kernel module

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 this is the virtual address 0xffff0000. (I can print its value through the kernel module)

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

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

when I built the kernel module and tried to use the virt_to_phys macro (0xffff0000), I have some kind of address, but the table is not there. I managed to find the system call table this way, but here the macro gave me the wrong address.

Does anyone know why this is happening? Does the address of the table of exception vectors contain a special physical address? Is the kernel translating its address in some special way?

Thank you!

+4
source share
2 answers

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

If you use MMU registers in this way, you may need to protect against racing by other use of registers.

This can be 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 a high vector virtual address.
  • 0xfffff000 - 4k .

ARM, Cortex.

+2

Linux, 2.6.35 . memblock. entry-armv.S, traps.c, vmlinux.lds.S ( script) init.c mmu.c ( ARM- ). , . ; .

vmlinux.lds.S,

, , ,

__vectors_start entry-armv.S. traps.c. 0xffff000 ( ). 2.6.35 memblock init.c. mmu.c's devicemaps_init() , early_alloc(). , virt_to_phys , .

memblock_alloc(). vector devicemaps_init(); virt_to_phys phys_to_virt.

__vectors_start .. entry-armv.S ; , , .

, memblock_dump_all(void) dmesg , vector. 4k. devicemaps_init(), vector. ARM mmu; .

+5

All Articles