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.


initial checkin of symbiotic swap interface
[palacios.git] / palacios / src / palacios / vmm_sym_swap.c
1 /* 
2  * This file is part of the Palacios Virtual Machine Monitor developed
3  * by the V3VEE Project with funding from the United States National 
4  * Science Foundation and the Department of Energy.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> 
11  * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Jack Lange <jarusl@cs.northwestern.edu>
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19 #include <palacios/vmm.h>
20
21
22 #include <palacios/vmm_sym_swap.h>
23
24 // this is hardcoded in linux, but we should expose it via a sym interface
25 #define SWAP_DEV_SHIFT 5 
26
27 int v3_init_sym_swap(struct guest_info * info) {
28
29     memset(&(info->swap_state), 0, sizeof(struct v3_sym_swap_state));
30
31     return 0;
32 }
33
34
35 int v3_register_swap_disk(struct guest_info * info, int dev_index, 
36                           struct v3_swap_ops * ops, void * private_data) {
37     struct v3_sym_swap_state * swap_state = &(info->swap_state);
38
39     swap_state->devs[dev_index].present = 1;
40     swap_state->devs[dev_index].private_data = private_data;
41     swap_state->devs[dev_index].ops = ops;
42
43     return 0;
44 }
45
46
47 addr_t v3_get_swapped_pg_addr(struct guest_info * info, pte32_t * pte) {
48     struct v3_sym_swap_state * swap_state = &(info->swap_state);
49     uint32_t dev_index = *(uint32_t *)pte & ((1 << SWAP_DEV_SHIFT) - 1);
50     uint32_t pg_index = (*(uint32_t *)pte) >> SWAP_DEV_SHIFT;
51     struct v3_swap_dev * swp_dev = &(swap_state->devs[dev_index]);
52
53     return (addr_t)swp_dev->ops->get_swap_entry(pg_index, swp_dev->private_data);
54 }
55
56
57
58 int v3_swap_out_notify(struct guest_info * info, int pg_index, int dev_index) {
59     return -1;
60 }