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/kernel/system/do_umap.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 /* The kernel call implemented in this file:
    2  *   m_type:    SYS_UMAP
    3  *
    4  * The parameters for this kernel call are:
    5  *    m5_i1:    CP_SRC_PROC_NR  (process number)        
    6  *    m5_c1:    CP_SRC_SPACE    (segment where address is: T, D, or S)
    7  *    m5_l1:    CP_SRC_ADDR     (virtual address)       
    8  *    m5_l2:    CP_DST_ADDR     (returns physical address)      
    9  *    m5_l3:    CP_NR_BYTES     (size of datastructure)         
   10  */
   11 
   12 #include "../system.h"
   13 
   14 #if USE_UMAP
   15 
   16 /*==========================================================================*
   17  *                              do_umap                                     *
   18  *==========================================================================*/
   19 PUBLIC int do_umap(m_ptr)
   20 register message *m_ptr;        /* pointer to request message */
   21 {
   22 /* Map virtual address to physical, for non-kernel processes. */
   23   int seg_type = m_ptr->CP_SRC_SPACE & SEGMENT_TYPE;
   24   int seg_index = m_ptr->CP_SRC_SPACE & SEGMENT_INDEX;
   25   vir_bytes offset = m_ptr->CP_SRC_ADDR;
   26   int count = m_ptr->CP_NR_BYTES;
   27   int proc_nr = (int) m_ptr->CP_SRC_PROC_NR;
   28   phys_bytes phys_addr;
   29 
   30   /* Verify process number. */
   31   if (proc_nr == SELF) proc_nr = m_ptr->m_source;
   32   if (! isokprocn(proc_nr)) return(EINVAL);
   33 
   34   /* See which mapping should be made. */
   35   switch(seg_type) {
   36   case LOCAL_SEG:
   37       phys_addr = umap_local(proc_addr(proc_nr), seg_index, offset, count); 
   38       break;
   39   case REMOTE_SEG:
   40       phys_addr = umap_remote(proc_addr(proc_nr), seg_index, offset, count); 
   41       break;
   42   case BIOS_SEG:
   43       phys_addr = umap_bios(proc_addr(proc_nr), offset, count); 
   44       break;
   45   default:
   46       return(EINVAL);
   47   }
   48   m_ptr->CP_DST_ADDR = phys_addr;
   49   return (phys_addr == 0) ? EFAULT: OK;
   50 }
   51 
   52 #endif /* USE_UMAP */

Cache object: 6ec3ca4e2d4e7e9df788f1096f75c108


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