예제 #1
0
int
procfs_machdep_doxmmregs(struct lwp *curl, struct lwp *l,
    struct pfsnode *pfs, struct uio *uio)
{

	return process_machdep_doxmmregs(curl, l, uio);
}
int
ptrace_machdep_dorequest(
    struct lwp *l,
    struct lwp *lt,
    int req,
    void *addr,
    int data
)
{
	struct uio uio;
	struct iovec iov;
	int write = 0;

	switch (req) {
	case PT_SETXMMREGS:
		write = 1;

	case PT_GETXMMREGS:
		/* write = 0 done above. */
		if (!process_machdep_validxmmregs(lt->l_proc))
			return (EINVAL);
		else {
			struct vmspace *vm;
			int error;

			error = proc_vmspace_getref(l->l_proc, &vm);
			if (error) {
				return error;
			}
			iov.iov_base = addr;
			iov.iov_len = sizeof(struct xmmregs);
			uio.uio_iov = &iov;
			uio.uio_iovcnt = 1;
			uio.uio_offset = 0;
			uio.uio_resid = sizeof(struct xmmregs);
			uio.uio_rw = write ? UIO_WRITE : UIO_READ;
			uio.uio_vmspace = vm;
			error = process_machdep_doxmmregs(l, lt, &uio);
			uvmspace_free(vm);
			return error;
		}
	}

#ifdef DIAGNOSTIC
	panic("ptrace_machdep: impossible");
#endif

	return (0);
}