xref: /titanic_41/usr/src/uts/common/xen/public/callback.h (revision ed5289f91b9bf164dccd6c75398362be77a4478d)
1 /******************************************************************************
2  * callback.h
3  *
4  * Register guest OS callbacks with Xen.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  *
24  * Copyright (c) 2006, Ian Campbell
25  */
26 
27 #ifndef __XEN_PUBLIC_CALLBACK_H__
28 #define __XEN_PUBLIC_CALLBACK_H__
29 
30 #include "xen.h"
31 
32 /*
33  * Prototype for this hypercall is:
34  *   long callback_op(int cmd, void *extra_args)
35  * @cmd        == CALLBACKOP_??? (callback operation).
36  * @extra_args == Operation-specific extra arguments (NULL if none).
37  */
38 
39 #define CALLBACKTYPE_event                 0
40 #define CALLBACKTYPE_failsafe              1
41 #define CALLBACKTYPE_syscall               2 /* x86_64 only */
42 /*
43  * sysenter is only available on x86_32 with the
44  * supervisor_mode_kernel option enabled.
45  */
46 #define CALLBACKTYPE_sysenter              3
47 #define CALLBACKTYPE_nmi                   4
48 
49 /*
50  * Disable event deliver during callback? This flag is ignored for event and
51  * NMI callbacks: event delivery is unconditionally disabled.
52  */
53 #define _CALLBACKF_mask_events             0
54 #define CALLBACKF_mask_events              (1U << _CALLBACKF_mask_events)
55 
56 /*
57  * Register a callback.
58  */
59 #define CALLBACKOP_register                0
60 struct callback_register {
61     uint16_t type;
62     uint16_t flags;
63     xen_callback_t address;
64 };
65 typedef struct callback_register callback_register_t;
66 DEFINE_XEN_GUEST_HANDLE(callback_register_t);
67 
68 /*
69  * Unregister a callback.
70  *
71  * Not all callbacks can be unregistered. -EINVAL will be returned if
72  * you attempt to unregister such a callback.
73  */
74 #define CALLBACKOP_unregister              1
75 struct callback_unregister {
76     uint16_t type;
77     uint16_t _unused;
78 };
79 typedef struct callback_unregister callback_unregister_t;
80 DEFINE_XEN_GUEST_HANDLE(callback_unregister_t);
81 
82 #endif /* __XEN_PUBLIC_CALLBACK_H__ */
83 
84 /*
85  * Local variables:
86  * mode: C
87  * c-set-style: "BSD"
88  * c-basic-offset: 4
89  * tab-width: 4
90  * indent-tabs-mode: nil
91  * End:
92  */
93