4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _SYS_COPYOPS_H
28 #define _SYS_COPYOPS_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/types.h>
33 #include <sys/thread.h>
35 #include <sys/aio_req.h>
45 * Copy in/out vector operations. This structure is used to interpose
46 * on the kernel copyin/copyout/etc. operations for various purposes
47 * such as handling watchpoints in the affected user memory. When one of the
48 * copy operations causes a fault, the corresponding function in this vector is
49 * called to handle it.
51 * The 64-bit operations in the structure fetch and store extended
52 * words and are only used on platforms with 64 bit general
53 * registers e.g. sun4u.
55 * Since the only users of these interfaces (watchpoints and pxfs) perform the
56 * default action unless there is a page fault, we can save the overhead of
57 * having to go through this indirection unless there is a page fault. This
58 * improves performance both in general and when watchpoints are enabled. If,
59 * in the future, a consumer relies on being able to interpose on all actions,
60 * then this assumption will have to be undone.
62 * No consumers should call these functions directly. They are automatically
63 * handled by the generic versions.
65 typedef struct copyops
{
67 * unstructured byte copyin/out functions
69 int (*cp_copyin
)(const void *, void *, size_t);
70 int (*cp_xcopyin
)(const void *, void *, size_t);
71 int (*cp_copyout
)(const void *, void *, size_t);
72 int (*cp_xcopyout
)(const void *, void *, size_t);
73 int (*cp_copyinstr
)(const char *, char *, size_t, size_t *);
74 int (*cp_copyoutstr
)(const char *, char *, size_t, size_t *);
77 * fetch/store byte/halfword/word/extended word
79 int (*cp_fuword8
)(const void *, uint8_t *);
80 int (*cp_fuword16
)(const void *, uint16_t *);
81 int (*cp_fuword32
)(const void *, uint32_t *);
82 int (*cp_fuword64
)(const void *, uint64_t *);
84 int (*cp_suword8
)(void *, uint8_t);
85 int (*cp_suword16
)(void *, uint16_t);
86 int (*cp_suword32
)(void *, uint32_t);
87 int (*cp_suword64
)(void *, uint64_t);
89 int (*cp_physio
)(int (*)(struct buf
*), struct buf
*, dev_t
,
90 int, void (*)(struct buf
*), struct uio
*);
93 extern int default_physio(int (*)(struct buf
*), struct buf
*,
94 dev_t
, int, void (*)(struct buf
*), struct uio
*);
97 * Interfaces for installing and removing copyops.
99 extern void install_copyops(kthread_id_t tp
, copyops_t
*cp
);
100 extern void remove_copyops(kthread_id_t tp
);
101 extern int copyops_installed(kthread_id_t tp
);
109 #endif /* _SYS_COPYOPS_H */