Research on Android Thread Local Storage Research on Android Thread Local Storage Wang Sen MSN: kernel_senix@163.com Kernel support for thread local storage setting asmlinkage int arm_syscall(int no, struct pt_regs *regs) { … case NR(set_tls): thread->tp_value = regs->ARM_r0; // regs->ARM_r0 is the virtual address of the thread local storage passed down from user space, and thread->tp_value is the place where the kernel saves this virtual address for each thread. #if defined(CONFIG_HAS_TLS_REG) //If the processor has a dedicated register for thread-local storage, then use this dedicated register asm (\"mcr p15, 0, %0, c13, c0, 3\" : : \"r\" (regs->ARM_r0) ); #elif !defined(CONFIG_TLS_REG_EMUL) //If the processor does not have a dedicated register for thread-local storage, then the kernel will find an address close to 4G to store it. /* * User space must never try to access this directly. * Expect your app to break eventually if you do so. * The user helper at 0xffff0fe0 must be used instead. * (see entry-armv.S for details) */ *((unsigned int *)0xffff0ff0) = regs->ARM_r0; //This address is 0xffff0ff0, the kernel will pre-map it and reserve it#endif return 0; … }PDF files use \"pdfFactory P…
You Might Like
Recommended ContentMore
Open source project More
Popular Components
Searched by Users
Just Take a LookMore
Trending Downloads
Trending ArticlesMore