fs/ioctl:add FIOC_XIPBASE to get file xip address

in tmpfs/romfs, we can get file real xip address to execute program

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao
2024-04-24 12:07:48 +08:00
committed by Xiang Xiao
parent 1ec3623b6b
commit ee07a269af
3 changed files with 25 additions and 0 deletions
+15
View File
@@ -605,6 +605,21 @@ static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
strlcat(ptr, rf->rf_path, PATH_MAX);
return OK;
}
else if (cmd == FIOC_XIPBASE)
{
FAR struct romfs_mountpt_s *rm = filep->f_inode->i_private;
FAR uintptr_t *ptr = (FAR uintptr_t *)arg;
if (rm->rm_xipbase != 0)
{
*ptr = (uintptr_t)rm->rm_xipbase + rf->rf_startoffset;
return OK;
}
else
{
return -ENXIO;
}
}
return -ENOTTY;
}