The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/norma/xmm_invoke.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1992 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie the
   24  * rights to redistribute these changes.
   25  */
   26 /*
   27  * HISTORY
   28  * $Log:        xmm_invoke.c,v $
   29  * Revision 2.2  92/03/10  16:29:22  jsb
   30  *      Merged in norma branch changes as of NORMA_MK7.
   31  *      [92/03/09  12:51:30  jsb]
   32  * 
   33  * Revision 2.1.2.1  92/02/21  11:27:27  jsb
   34  *      Removed reference counting from {M,K}_{REFERENCE,RELEASE} macros.
   35  *      Added check for null obj in {M,K}_CALL macros.
   36  *      Added call to xmm_obj_unlink to M_TERMINATE.
   37  *      [92/02/16  14:17:12  jsb]
   38  * 
   39  *      First checkin.
   40  *      [92/02/09  14:17:05  jsb]
   41  * 
   42  */
   43 /*
   44  *      File:   norma/xmm_invoke.c
   45  *      Author: Joseph S. Barrera III
   46  *      Date:   1992
   47  *
   48  *      Xmm invocation routines.
   49  */
   50 
   51 #include <norma/xmm_obj.h>
   52 
   53 #if     !XMM_USE_MACROS
   54 
   55 /*
   56  * I've considered automatically (i.e., in these macros) grabbing and
   57  * release obj or class locks, but I don't see a good protocol for
   58  * doing so.
   59  */
   60 
   61 #define M_REFERENCE\
   62         kern_return_t kr;\
   63         register xmm_obj_t m_mobj;\
   64 \
   65         m_mobj = mobj->m_mobj;\
   66         if (m_mobj == XMM_OBJ_NULL) {\
   67                 panic("m_invoke: null obj");\
   68                 return KERN_FAILURE;\
   69         }\
   70         kr = /* function call that follows */
   71 
   72 #define M_RELEASE\
   73         return kr;
   74 
   75 #define K_REFERENCE\
   76         kern_return_t kr;\
   77         register xmm_obj_t k_kobj;\
   78 \
   79         k_kobj = kobj->k_kobj;\
   80         if (k_kobj == XMM_OBJ_NULL) {\
   81                 panic("k_invoke: null obj");\
   82                 return KERN_FAILURE;\
   83         }\
   84         kr = /* function call that follows */
   85 
   86 #define K_RELEASE\
   87         return kr;
   88 
   89 #define R_REFERENCE\
   90         kern_return_t kr;\
   91 \
   92         kr = /* function call that follows */
   93 
   94 #define R_RELEASE\
   95         return kr;
   96 
   97 #if     __STDC__
   98 #define M_CALL(method)  (*m_mobj->class->m_ ## method)
   99 #define K_CALL(method)  (*k_kobj->class->k_ ## method)
  100 #define R_CALL(method)  (*xmm_m_reply(reply)->m_ ## method)
  101 #else   __STDC__
  102 #define M_CALL(method)  (*m_mobj->class->m_/**/method)
  103 #define K_CALL(method)  (*k_kobj->class->k_/**/method)
  104 #define R_CALL(method)  (*xmm_m_reply(reply)->m_/**/method)
  105 #endif  __STDC__
  106 
  107 kern_return_t
  108 M_INIT(mobj, k_kobj, pagesize, internal, size)
  109         xmm_obj_t mobj;
  110         xmm_obj_t k_kobj;
  111         vm_size_t pagesize;
  112         boolean_t internal;
  113         vm_size_t size;
  114 {
  115         M_REFERENCE
  116         M_CALL(init)(m_mobj, k_kobj, pagesize, internal, size);
  117         M_RELEASE
  118 }
  119 
  120 kern_return_t
  121 M_TERMINATE(mobj, kobj)
  122         xmm_obj_t mobj;
  123         xmm_obj_t kobj;
  124 {
  125         M_REFERENCE
  126         M_CALL(terminate)(m_mobj, kobj->m_kobj);
  127         xmm_obj_unlink(mobj, kobj);
  128         M_RELEASE
  129 }
  130 
  131 kern_return_t
  132 M_COPY(mobj, kobj, offset, length, new_mobj)
  133         xmm_obj_t mobj;
  134         xmm_obj_t kobj;
  135         vm_offset_t offset;
  136         vm_size_t length;
  137         xmm_obj_t new_mobj;
  138 {
  139         M_REFERENCE
  140         M_CALL(copy)(m_mobj, kobj->m_kobj, offset, length, new_mobj);
  141         M_RELEASE
  142 }
  143 
  144 kern_return_t
  145 M_DATA_REQUEST(mobj, kobj, offset, length, desired_access)
  146         xmm_obj_t mobj;
  147         xmm_obj_t kobj;
  148         vm_offset_t offset;
  149         vm_size_t length;
  150         vm_prot_t desired_access;
  151 {
  152         M_REFERENCE
  153         M_CALL(data_request)(m_mobj, kobj->m_kobj, offset, length,
  154                              desired_access);
  155         M_RELEASE
  156 }
  157 
  158 kern_return_t
  159 M_DATA_UNLOCK(mobj, kobj, offset, length, desired_access)
  160         xmm_obj_t mobj;
  161         xmm_obj_t kobj;
  162         vm_offset_t offset;
  163         vm_size_t length;
  164         vm_prot_t desired_access;
  165 {
  166         M_REFERENCE
  167         M_CALL(data_unlock)(m_mobj, kobj->m_kobj, offset, length,
  168                             desired_access);
  169         M_RELEASE
  170 }
  171 
  172 kern_return_t
  173 M_DATA_WRITE(mobj, kobj, offset, data, length)
  174         xmm_obj_t mobj;
  175         xmm_obj_t kobj;
  176         vm_offset_t offset;
  177         vm_offset_t data;
  178         vm_size_t length;
  179 {
  180         M_REFERENCE
  181         M_CALL(data_write)(m_mobj, kobj->m_kobj, offset, data, length);
  182         M_RELEASE
  183 }
  184 
  185 kern_return_t
  186 M_LOCK_COMPLETED(reply, offset, length)
  187         xmm_reply_t reply;
  188         vm_offset_t offset;
  189         vm_size_t length;
  190 {
  191         R_REFERENCE
  192         R_CALL(lock_completed)(reply, offset, length);
  193         R_RELEASE
  194 }
  195 
  196 kern_return_t
  197 M_SUPPLY_COMPLETED(reply, offset, length, result, error_offset)
  198         xmm_reply_t reply;
  199         vm_offset_t offset;
  200         vm_size_t length;
  201         kern_return_t result;
  202         vm_offset_t error_offset;
  203 {
  204         R_REFERENCE
  205         R_CALL(supply_completed)(reply, offset, length, result, error_offset);
  206         R_RELEASE
  207 }
  208 
  209 kern_return_t
  210 M_DATA_RETURN(mobj, kobj, offset, data, length)
  211         xmm_obj_t mobj;
  212         xmm_obj_t kobj;
  213         vm_offset_t offset;
  214         vm_offset_t data;
  215         vm_size_t length;
  216 {
  217         M_REFERENCE
  218         M_CALL(data_return)(m_mobj, kobj->m_kobj, offset, data, length);
  219         M_RELEASE
  220 }
  221 
  222 kern_return_t
  223 M_CHANGE_COMPLETED(reply, may_cache, copy_strategy)
  224         xmm_reply_t reply;
  225         boolean_t may_cache;
  226         memory_object_copy_strategy_t copy_strategy;
  227 {
  228         R_REFERENCE
  229         R_CALL(change_completed)(reply, may_cache, copy_strategy);
  230         R_RELEASE
  231 }
  232 
  233 kern_return_t
  234 K_DATA_UNAVAILABLE(kobj, offset, length)
  235         xmm_obj_t kobj;
  236         vm_offset_t offset;
  237         vm_size_t length;
  238 {
  239         K_REFERENCE
  240         K_CALL(data_unavailable)(k_kobj, offset, length);
  241         K_RELEASE
  242 }
  243 
  244 kern_return_t
  245 K_GET_ATTRIBUTES(kobj, object_ready, may_cache, copy_strategy)
  246         xmm_obj_t kobj;
  247         boolean_t *object_ready;
  248         boolean_t *may_cache;
  249         memory_object_copy_strategy_t *copy_strategy;
  250 {
  251         K_REFERENCE
  252         K_CALL(get_attributes)(k_kobj, object_ready, may_cache, copy_strategy);
  253         K_RELEASE
  254 }
  255 
  256 kern_return_t
  257 K_LOCK_REQUEST(kobj, offset, length, should_clean, should_flush, lock_value,
  258                reply)
  259         xmm_obj_t kobj;
  260         vm_offset_t offset;
  261         vm_size_t length;
  262         boolean_t should_clean;
  263         boolean_t should_flush;
  264         vm_prot_t lock_value;
  265         xmm_reply_t reply;
  266 {
  267         K_REFERENCE
  268         K_CALL(lock_request)(k_kobj, offset, length, should_clean,
  269                              should_flush, lock_value, xmm_k_reply(reply));
  270         K_RELEASE
  271 }
  272 
  273 kern_return_t
  274 K_DATA_ERROR(kobj, offset, length, error_value)
  275         xmm_obj_t kobj;
  276         vm_offset_t offset;
  277         vm_size_t length;
  278         kern_return_t error_value;
  279 {
  280         K_REFERENCE
  281         K_CALL(data_error)(k_kobj, offset, length, error_value);
  282         K_RELEASE
  283 }
  284 
  285 kern_return_t
  286 K_SET_READY(kobj, object_ready, may_cache, copy_strategy, use_old_pageout,
  287             memory_object_name, reply)
  288         xmm_obj_t kobj;
  289         boolean_t object_ready;
  290         boolean_t may_cache;
  291         memory_object_copy_strategy_t copy_strategy;
  292         boolean_t use_old_pageout;
  293         ipc_port_t memory_object_name;
  294         xmm_reply_t reply;
  295 {
  296         K_REFERENCE
  297         K_CALL(set_ready)(k_kobj, object_ready, may_cache, copy_strategy,
  298                           use_old_pageout, memory_object_name,
  299                           xmm_k_reply(reply));
  300         K_RELEASE
  301 }
  302 
  303 kern_return_t
  304 K_DESTROY(kobj, reason)
  305         xmm_obj_t kobj;
  306         kern_return_t reason;
  307 {
  308         K_REFERENCE
  309         K_CALL(destroy)(k_kobj, reason);
  310         K_RELEASE
  311 }
  312 
  313 kern_return_t
  314 K_DATA_SUPPLY(kobj, offset, data, length, lock_value, precious, reply)
  315         xmm_obj_t kobj;
  316         vm_offset_t offset;
  317         vm_offset_t data;
  318         vm_size_t length;
  319         vm_prot_t lock_value;
  320         boolean_t precious;
  321         xmm_reply_t reply;
  322 {
  323         K_REFERENCE
  324         K_CALL(data_supply)(k_kobj, offset, data, length, lock_value, precious,
  325                             xmm_k_reply(reply));
  326         K_RELEASE
  327 }
  328 
  329 kern_return_t
  330 _K_DESTROY(kobj, reason)
  331         xmm_obj_t kobj;
  332         kern_return_t reason;
  333 {
  334         return (*kobj->class->k_destroy)(kobj, reason);
  335 }
  336 
  337 #else   !XMM_USE_MACROS
  338 #endif  !XMM_USE_MACROS

Cache object: bd98fd8e93276a31a4bd01f48daf0604


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.