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.


Floating point context-switching and checkpoint/load
[palacios.git] / palacios / include / interfaces / vmm_lazy_fpu.h
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) 2013, The V3VEE Project <http://www.v3vee.org>
11  * All rights reserved.
12  *
13  * Author: Peter Dinda <pdinda@northwestern.edu>
14  *
15  * This is free software.  You are permitted to use,
16  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
17  */
18
19 #ifndef __VMM_LAZY_FPU
20 #define __VMM_LAZY_FPU
21
22 #include <palacios/vmm_types.h>
23
24
25 struct v3_lazy_fpu_iface {
26
27     // if these two are provided then lazy FP save/restore handled by host
28     // indicate that the calling thread has used floating point
29     void (*used_fpu)(void);
30     // indicate that the calling thread wants to use floating point again
31     void (*need_fpu)(void);
32
33 };
34
35
36 /*
37  *  function prototypes
38  */
39
40 extern void V3_Init_Lazy_FPU(struct v3_lazy_fpu_iface * palacios_lazy_fpu);
41
42 #ifdef __V3VEE__
43
44 #define V3_LAZY_FPU_USED()                                                  \
45   do {                                                                      \
46     extern struct v3_lazy_fpu_iface * palacios_lazy_fpu_hooks;              \
47     if ((palacios_lazy_fpu_hooks) && (palacios_lazy_fpu_hooks)->used_fpu)         { \
48       (palacios_lazy_fpu_hooks)->used_fpu();                                \
49     }                                                                       \
50   } while (0)
51
52 #define V3_LAZY_FPU_NEED()                                                  \
53   do {                                                                      \
54     extern struct v3_lazy_fpu_iface * palacios_lazy_fpu_hooks;              \
55     if ((palacios_lazy_fpu_hooks) && (palacios_lazy_fpu_hooks)->need_fpu)         { \
56         (palacios_lazy_fpu_hooks)->need_fpu();                              \
57     }                                                                       \
58   } while (0)
59
60 #endif
61
62 #endif