According to user page VIRT_TO_PHYS
The returned physical address is the physical (CPU) mapping for the specified memory address. Valid only for using this function on addresses directly mapped or distributed via kmalloc.
This function does not provide bus mappings for DMA transmission. In almost all possible cases, the device driver should not use this function.
Try allocating memory for mystring with kmalloc ;
char *mystring = kmalloc(19, GFP_KERNEL); strcpy(mystring, "this is my address");
Here is the strcpy implementation found here :
char *strcpy(char *dest, const char *src) { char *tmp = dest; while ((*dest++ = *src++) != '\0') ; return tmp; }
Anthony
source share