Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel'
[palacios-OLD.git] / kitten / user / liblwk / aspace.c
1 /* Copyright (c) 2008, Sandia National Laboratories */
2
3 #include <lwk/liblwk.h>
4
5 int
6 aspace_map_region(
7         id_t         id,
8         vaddr_t      start,
9         size_t       extent,
10         vmflags_t    flags,
11         vmpagesize_t pagesz,
12         const char * name,
13         paddr_t      pmem
14 )
15 {
16         int status;
17
18         if ((status = aspace_add_region(id, start, extent, flags, pagesz, name)))
19                 return status;
20
21         if ((status = aspace_map_pmem(id, pmem, start, extent))) {
22                 aspace_del_region(id, start, extent);
23                 return status;
24         }
25
26         return 0;
27 }
28
29 int
30 aspace_map_region_anywhere(
31         id_t         id,
32         vaddr_t *    start,
33         size_t       extent,
34         vmflags_t    flags,
35         vmpagesize_t pagesz,
36         const char * name,
37         paddr_t      pmem
38 )
39 {
40         int status;
41
42 retry:
43         if ((status = aspace_find_hole(id, 0, extent, pagesz, start)))
44                 return status;
45
46         if ((status = aspace_add_region(id, *start, extent, flags, pagesz, name))) {
47                 if (status == -ENOTUNIQ)
48                         goto retry; /* we lost a race with someone */
49                 return status;
50         }
51
52         if ((status = aspace_map_pmem(id, pmem, *start, extent))) {
53                 aspace_del_region(id, *start, extent);
54                 return status;
55         }
56
57         return 0;
58 }