static int compat_put_fastrpc_ioctl_invoke( struct compat_fastrpc_ioctl_invoke_fd __user *inv32, struct fastrpc_ioctl_invoke_fd __user *inv) { compat_uptr_t p; compat_uint_t u, h; union compat_remote_arg *pra32; union remote_arg *pra; int err, i, num; err = get_user(u, &inv32->inv.sc); err |= get_user(p, &inv32->inv.pra); if (err) return err; pra32 = compat_ptr(p); pra = (union remote_arg *)(inv + 1); num = REMOTE_SCALARS_INBUFS(u) + REMOTE_SCALARS_OUTBUFS(u) + REMOTE_SCALARS_INHANDLES(u); for (i = 0; i < REMOTE_SCALARS_OUTHANDLES(u); i++) { err |= get_user(h, &pra[num + i].h); err |= put_user(h, &pra32[num + i].h); } return err; }
static __inline int _skel_method(int (*_pfn)(), uint32 _sc, remote_arg* _pra) { remote_arg* _praEnd; int _nErr = 0; _praEnd = ((_pra + REMOTE_SCALARS_INBUFS(_sc)) + REMOTE_SCALARS_OUTBUFS(_sc)); _ASSERT(_nErr, (_pra + 0) <= _praEnd); _TRY(_nErr, _pfn()); _CATCH(_nErr) {} return _nErr; }
static int compat_get_fastrpc_ioctl_invoke( struct compat_fastrpc_ioctl_invoke_fd __user *inv32, struct fastrpc_ioctl_invoke_fd __user **inva, unsigned int cmd) { compat_uint_t u, sc; compat_ssize_t s; compat_uptr_t p; struct fastrpc_ioctl_invoke_fd *inv; union compat_remote_arg *pra32; union remote_arg *pra; int err, len, num, j; err = get_user(sc, &inv32->inv.sc); if (err) return err; len = REMOTE_SCALARS_LENGTH(sc); VERIFY(err, NULL != (inv = compat_alloc_user_space( sizeof(*inv) + len * sizeof(*pra)))); if (err) return -EFAULT; inv->inv.pra = (union remote_arg *)(inv + 1); err = put_user(sc, &inv->inv.sc); err |= get_user(u, &inv32->inv.handle); err |= put_user(u, &inv->inv.handle); err |= get_user(p, &inv32->inv.pra); if (err) return err; pra32 = compat_ptr(p); pra = inv->inv.pra; num = REMOTE_SCALARS_INBUFS(sc) + REMOTE_SCALARS_OUTBUFS(sc); for (j = 0; j < num; j++) { err |= get_user(p, &pra32[j].buf.pv); pra[j].buf.pv = NULL; err |= put_user(p, (compat_uptr_t *)&pra[j].buf.pv); err |= get_user(s, &pra32[j].buf.len); err |= put_user(s, &pra[j].buf.len); } for (j = 0; j < REMOTE_SCALARS_INHANDLES(sc); j++) { err |= get_user(u, &pra32[num + j].h); err |= put_user(u, &pra[num + j].h); } inv->fds = NULL; if (cmd == COMPAT_FASTRPC_IOCTL_INVOKE_FD) { err |= get_user(p, &inv32->fds); err |= put_user(p, (compat_uptr_t *)&inv->fds); } *inva = inv; return err; }
static __inline int _skel_method_1(int (*_pfn)(uint32*, char*, uint32, char*, uint32, char*, uint32, char*, uint32, uint32*, char*, uint32, uint32), uint32 _sc, remote_arg* _pra) { remote_arg* _praEnd; uint32 _in0[418]; char* _in1[1]; uint32 _in1Len[1]; char* _in2[1]; uint32 _in2Len[1]; char* _in3[1]; uint32 _in3Len[1]; char* _in4[1]; uint32 _in4Len[1]; uint32 _rout5[1]; char* _rout6[1]; uint32 _rout6Len[1]; uint32 _in7[1]; uint32* _primIn; int _numIn[1]; uint32* _primROut; remote_arg* _praIn; remote_arg* _praROut; int _nErr = 0; _praEnd = ((_pra + REMOTE_SCALARS_INBUFS(_sc)) + REMOTE_SCALARS_OUTBUFS(_sc)); _ASSERT(_nErr, (_pra + 7) <= _praEnd); _numIn[0] = (REMOTE_SCALARS_INBUFS(_sc) - 1); _ASSERT(_nErr, _pra[0].buf.nLen >= 1696); _primIn = _pra[0].buf.pv; _ASSERT(_nErr, _pra[(_numIn[0] + 1)].buf.nLen >= 4); _primROut = _pra[(_numIn[0] + 1)].buf.pv; _COPY(_in0, 0, _primIn, 0, 1672); _COPY(_in1Len, 0, _primIn, 1672, 4); _praIn = (_pra + 1); _ASSERT(_nErr, (_praIn[0].buf.nLen / 1) >= (int)_in1Len[0]); _in1[0] = _praIn[0].buf.pv; _COPY(_in2Len, 0, _primIn, 1676, 4); _ASSERT(_nErr, (_praIn[1].buf.nLen / 1) >= (int)_in2Len[0]); _in2[0] = _praIn[1].buf.pv; _COPY(_in3Len, 0, _primIn, 1680, 4); _ASSERT(_nErr, (_praIn[2].buf.nLen / 1) >= (int)_in3Len[0]); _in3[0] = _praIn[2].buf.pv; _COPY(_in4Len, 0, _primIn, 1684, 4); _ASSERT(_nErr, (_praIn[3].buf.nLen / 1) >= (int)_in4Len[0]); _in4[0] = _praIn[3].buf.pv; _COPY(_rout6Len, 0, _primIn, 1688, 4); _praROut = (_praIn + _numIn[0] + 1); _ASSERT(_nErr, (_praROut[0].buf.nLen / 1) >= (int)_rout6Len[0]); _rout6[0] = _praROut[0].buf.pv; _COPY(_in7, 0, _primIn, 1692, 4); _TRY(_nErr, _pfn(_in0, *_in1, *_in1Len, *_in2, *_in2Len, *_in3, *_in3Len, *_in4, *_in4Len, _rout5, *_rout6, *_rout6Len, *_in7)); _COPY(_primROut, 0, _rout5, 0, 4); _CATCH(_nErr) {} return _nErr; }