Thank you very much for your reply. :) DRM_IOCTL_VERSION has to be a special one, but my patch really need be improved. The string pointers should be translated, but the new string buffers need not be allocated.
I will try to send patch v2 within this week end. DRM_IOCTL_* really have many commands, at present, I have implemented about 20+ commands for i965 gpu using, although some of them are not generic enough. I will try to send all of them when I have free time. Thanks. On 2020/3/11 下午3:35, Laurent Vivier wrote: > Le 10/03/2020 à 21:16, Laurent Vivier a écrit : >> Le 26/02/2020 à 12:38, cheng...@emindsoft.com.cn a écrit : >>> From: Chen Gang <cheng...@emindsoft.com.cn> >>> >>> The other DRM_IOCTL_* commands will be done later. >>> >>> Signed-off-by: Chen Gang <cheng...@emindsoft.com.cn> >>> --- >>> linux-user/ioctls.h | 3 + >>> linux-user/syscall.c | 134 +++++++++++++++++++++++++++++++++++++ >>> linux-user/syscall_defs.h | 16 +++++ >>> linux-user/syscall_types.h | 12 ++++ >>> 4 files changed, 165 insertions(+) >>> >>> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h >>> index 0defa1d8c1..c2294b48a0 100644 >>> --- a/linux-user/ioctls.h >>> +++ b/linux-user/ioctls.h >>> @@ -574,6 +574,9 @@ >>> IOCTL_SPECIAL(SIOCDELRT, IOC_W, do_ioctl_rt, >>> MK_PTR(MK_STRUCT(STRUCT_rtentry))) >>> >>> + IOCTL_SPECIAL(DRM_IOCTL_VERSION, IOC_RW, do_ioctl_drm, >>> + MK_PTR(MK_STRUCT(STRUCT_drm_version))) >>> + >> >> Rather than adding a specific function to process the structure, perhaps >> we can add this in a generic way? >> >> The problem with drm_version structure is the pointers to the strings. >> >> Did you try to add a TYPE_STRING in >> thunk_type_size()/thunk_type_align()/think_convert()/do_ioctl() to do that? > > In fact we can't do that because we need to know the size of the buffer > to allocate and it is provided by another field. It cannot be generic, > so I think what you do is the best we can do. > > Thanks, > LAurent > > > > >