Print this page
patch lower-case-segops


  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  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]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _SYS_WATCHPOINT_H
  28 #define _SYS_WATCHPOINT_H
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 #include <sys/types.h>
  33 #include <vm/seg_enum.h>
  34 #include <sys/copyops.h>
  35 #include <sys/avl.h>
  36 
  37 #ifdef  __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 /*
  42  * Definitions for the VM implementation of watchpoints.
  43  * See proc(4) and <sys/procfs.h> for definitions of the user interface.
  44  */
  45 
  46 /*
  47  * Each process with watchpoints has a linked list of watched areas.
  48  * The list is kept sorted by user-level virtual address.
  49  */
  50 typedef struct watched_area {
  51         avl_node_t wa_link;     /* link in AVL tree */


  57 /*
  58  * The list of watched areas maps into a list of pages with modified
  59  * protections.  The list is kept sorted by user-level virtual address.
  60  */
  61 typedef struct watched_page {
  62         avl_node_t wp_link;     /* Link in AVL tree */
  63         struct watched_page *wp_list;   /* link in p_wprot */
  64         caddr_t wp_vaddr;       /* virtual address of this page */
  65         uchar_t wp_prot;        /* modified protection bits */
  66         uchar_t wp_oprot;       /* original protection bits */
  67         uchar_t wp_umap[3];     /* reference counts of user pr_mappage()s */
  68         uchar_t wp_kmap[3];     /* reference counts of kernel pr_mappage()s */
  69         ushort_t wp_flags;      /* see below */
  70         short   wp_read;        /* number of WA_READ areas in this page */
  71         short   wp_write;       /* number of WA_WRITE areas in this page */
  72         short   wp_exec;        /* number of WA_EXEC areas in this page */
  73 } watched_page_t;
  74 
  75 /* wp_flags */
  76 #define WP_NOWATCH      0x01    /* protections temporarily restored */
  77 #define WP_SETPROT      0x02    /* SEGOP_SETPROT() needed on this page */
  78 
  79 #ifdef  _KERNEL
  80 
  81 /*
  82  * These functions handle the necessary logic to perform the copy operation
  83  * while ignoring watchpoints.
  84  */
  85 extern int copyin_nowatch(const void *, void *, size_t);
  86 extern int copyout_nowatch(const void *, void *, size_t);
  87 extern int fuword32_nowatch(const void *, uint32_t *);
  88 extern int suword32_nowatch(void *, uint32_t);
  89 #ifdef _LP64
  90 extern int suword64_nowatch(void *, uint64_t);
  91 extern int fuword64_nowatch(const void *, uint64_t *);
  92 #endif
  93 
  94 /*
  95  * Disable watchpoints for a given region of memory.  When bracketed by these
  96  * calls, functions can use copyops and ignore watchpoints.
  97  */




  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  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]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _SYS_WATCHPOINT_H
  28 #define _SYS_WATCHPOINT_H
  29 


  30 #include <sys/types.h>
  31 #include <vm/seg_enum.h>
  32 #include <sys/copyops.h>
  33 #include <sys/avl.h>
  34 
  35 #ifdef  __cplusplus
  36 extern "C" {
  37 #endif
  38 
  39 /*
  40  * Definitions for the VM implementation of watchpoints.
  41  * See proc(4) and <sys/procfs.h> for definitions of the user interface.
  42  */
  43 
  44 /*
  45  * Each process with watchpoints has a linked list of watched areas.
  46  * The list is kept sorted by user-level virtual address.
  47  */
  48 typedef struct watched_area {
  49         avl_node_t wa_link;     /* link in AVL tree */


  55 /*
  56  * The list of watched areas maps into a list of pages with modified
  57  * protections.  The list is kept sorted by user-level virtual address.
  58  */
  59 typedef struct watched_page {
  60         avl_node_t wp_link;     /* Link in AVL tree */
  61         struct watched_page *wp_list;   /* link in p_wprot */
  62         caddr_t wp_vaddr;       /* virtual address of this page */
  63         uchar_t wp_prot;        /* modified protection bits */
  64         uchar_t wp_oprot;       /* original protection bits */
  65         uchar_t wp_umap[3];     /* reference counts of user pr_mappage()s */
  66         uchar_t wp_kmap[3];     /* reference counts of kernel pr_mappage()s */
  67         ushort_t wp_flags;      /* see below */
  68         short   wp_read;        /* number of WA_READ areas in this page */
  69         short   wp_write;       /* number of WA_WRITE areas in this page */
  70         short   wp_exec;        /* number of WA_EXEC areas in this page */
  71 } watched_page_t;
  72 
  73 /* wp_flags */
  74 #define WP_NOWATCH      0x01    /* protections temporarily restored */
  75 #define WP_SETPROT      0x02    /* segop_setprot() needed on this page */
  76 
  77 #ifdef  _KERNEL
  78 
  79 /*
  80  * These functions handle the necessary logic to perform the copy operation
  81  * while ignoring watchpoints.
  82  */
  83 extern int copyin_nowatch(const void *, void *, size_t);
  84 extern int copyout_nowatch(const void *, void *, size_t);
  85 extern int fuword32_nowatch(const void *, uint32_t *);
  86 extern int suword32_nowatch(void *, uint32_t);
  87 #ifdef _LP64
  88 extern int suword64_nowatch(void *, uint64_t);
  89 extern int fuword64_nowatch(const void *, uint64_t *);
  90 #endif
  91 
  92 /*
  93  * Disable watchpoints for a given region of memory.  When bracketed by these
  94  * calls, functions can use copyops and ignore watchpoints.
  95  */