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_newmap.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_NEWMAP
    3  *
    4  * The parameters for this kernel call are:
    5  *    m1_i1:    PR_PROC_NR              (install new map for this process)
    6  *    m1_p1:    PR_MEM_PTR              (pointer to the new memory map)
    7  */
    8 #include "../system.h"
    9 
   10 #if USE_NEWMAP
   11 
   12 /*===========================================================================*
   13  *                              do_newmap                                    *
   14  *===========================================================================*/
   15 PUBLIC int do_newmap(m_ptr)
   16 message *m_ptr;                 /* pointer to request message */
   17 {
   18 /* Handle sys_newmap().  Fetch the memory map from PM. */
   19   register struct proc *rp;     /* process whose map is to be loaded */
   20   int caller;                   /* whose space has the new map (usually PM) */
   21   struct mem_map *map_ptr;      /* virtual address of map inside caller (PM) */
   22   phys_bytes src_phys;          /* physical address of map at the PM */
   23   int old_flags;                /* value of flags before modification */
   24 
   25   /* Extract message parameters and copy new memory map from PM. */
   26   caller = m_ptr->m_source;
   27   map_ptr = (struct mem_map *) m_ptr->PR_MEM_PTR;
   28   if (! isokprocn(m_ptr->PR_PROC_NR)) return(EINVAL);
   29   if (iskerneln(m_ptr->PR_PROC_NR)) return(EPERM);
   30   rp = proc_addr(m_ptr->PR_PROC_NR);
   31 
   32   /* Copy the map from PM. */
   33   src_phys = umap_local(proc_addr(caller), D, (vir_bytes) map_ptr, 
   34       sizeof(rp->p_memmap));
   35   if (src_phys == 0) return(EFAULT);
   36   phys_copy(src_phys,vir2phys(rp->p_memmap),(phys_bytes)sizeof(rp->p_memmap));
   37 
   38 #if (CHIP != M68000)
   39   alloc_segments(rp);
   40 #else
   41   pmmu_init_proc(rp);
   42 #endif
   43   old_flags = rp->p_rts_flags;  /* save the previous value of the flags */
   44   rp->p_rts_flags &= ~NO_MAP;
   45   if (old_flags != 0 && rp->p_rts_flags == 0) lock_enqueue(rp);
   46 
   47   return(OK);
   48 }
   49 #endif /* USE_NEWMAP */
   50 

Cache object: d2ebe20ec00ff3b650b8b76077ed5df2


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