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/osfmk/ppc/misc.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  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * The contents of this file constitute Original Code as defined in and
    7  * are subject to the Apple Public Source License Version 1.1 (the
    8  * "License").  You may not use this file except in compliance with the
    9  * License.  Please obtain a copy of the License at
   10  * http://www.apple.com/publicsource and read it before using this file.
   11  * 
   12  * This Original Code and all software distributed under the License are
   13  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   14  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   15  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   16  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
   17  * License for the specific language governing rights and limitations
   18  * under the License.
   19  * 
   20  * @APPLE_LICENSE_HEADER_END@
   21  */
   22 /*
   23  * @OSF_COPYRIGHT@
   24  */
   25 #if 0  // dead code
   26 #include <debug.h>
   27 #include <mach_debug.h>
   28 
   29 #include <mach/ppc/thread_status.h>
   30 #include <mach/vm_types.h>
   31 #include <kern/thread.h>
   32 #include <kern/misc_protos.h>
   33 #include <ppc/proc_reg.h>
   34 #include <ppc/pmap.h>
   35 #include <ppc/misc_protos.h>
   36 #include <ppc/exception.h>
   37 
   38 /*
   39  * copyin/out_multiple - the assembler copyin/out functions jump to C for
   40  * help when the copyin lies over a segment boundary. The C breaks
   41  * down the copy into two sub-copies and re-calls the assembler with
   42  * these sub-copies. Very rare occurrance. Warning: These functions are
   43  * called whilst active_thread->thread_recover is still set.
   44  */
   45 
   46 extern boolean_t copyin_multiple(const char *src,
   47                                  char *dst,
   48                                  vm_size_t count);
   49 
   50 boolean_t copyin_multiple(const char *src,
   51                           char *dst,
   52                           vm_size_t count)
   53 {
   54         const char *midpoint;
   55         vm_size_t first_count;
   56         boolean_t first_result;
   57 
   58         /* Assert that we've been called because of a segment boundary,
   59          * this function is more expensive than the assembler, and should
   60          * only be called in this difficult case.
   61          */
   62         assert(((vm_offset_t)src & 0xF0000000) !=
   63                ((vm_offset_t)(src + count -1) & 0xF0000000));
   64 
   65         /* TODO NMGS define sensible constants for segments, and apply
   66          * to C and assembler (assembler is much harder)
   67          */
   68         midpoint = (const char*) ((vm_offset_t)(src + count) & 0xF0000000);
   69         first_count = (midpoint - src);
   70 
   71         first_result = copyin(CAST_USER_ADDR_T(src), dst, first_count);
   72         
   73         /* If there was an error, stop now and return error */
   74         if (first_result != 0)
   75                 return first_result;
   76 
   77         /* otherwise finish the job and return result */
   78         return copyin(CAST_USER_ADDR_T(midpoint), dst + first_count, count-first_count);
   79 }
   80 
   81 extern int copyout_multiple(const char *src, char *dst, vm_size_t count);
   82 
   83 int copyout_multiple(const char *src, char *dst, vm_size_t count)
   84 {
   85         char *midpoint;
   86         vm_size_t first_count;
   87         boolean_t first_result;
   88 
   89         /* Assert that we've been called because of a segment boundary,
   90          * this function is more expensive than the assembler, and should
   91          * only be called in this difficult case. For copyout, the
   92          * segment boundary is on the dst
   93          */
   94         assert(((vm_offset_t)dst & 0xF0000000) !=
   95                ((vm_offset_t)(dst + count - 1) & 0xF0000000));
   96 
   97         /* TODO NMGS define sensible constants for segments, and apply
   98          * to C and assembler (assembler is much harder)
   99          */
  100         midpoint = (char *) ((vm_offset_t)(dst + count) & 0xF0000000);
  101         first_count = (midpoint - dst);
  102 
  103         first_result = copyout(src, CAST_USER_ADDR_T(dst), first_count);
  104         
  105         /* If there was an error, stop now and return error */
  106         if (first_result != 0)
  107                 return first_result;
  108 
  109         /* otherwise finish the job and return result */
  110 
  111         return copyout(src + first_count, CAST_USER_ADDR_T(midpoint), count-first_count);
  112 }
  113 #endif // dead code
  114 

Cache object: 983171175c24369098db5f594ef98007


[ 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.