1 /*
2  * (c) 2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3  *          Alexander Warg <warg@os.inf.tu-dresden.de>
4  *     economic rights: Technische Universität Dresden (Germany)
5  *
6  * This file is part of TUD:OS and distributed under the terms of the
7  * GNU General Public License 2.
8  * Please see the COPYING-GPL-2 file for details.
9  *
10  * As a special exception, you may use this file as part of a free software
11  * library without restriction.  Specifically, if other files instantiate
12  * templates or use macros or inline functions from this file, or you compile
13  * this file and link it with other files to produce an executable, this
14  * file does not by itself cause the resulting executable to be covered by
15  * the GNU General Public License.  This exception does not however
16  * invalidate any other reasons why the executable file might be covered by
17  * the GNU General Public License.
18  */
19 #pragma once
20 
21 #include <l4/sys/types.h>
22 
23 enum
24 {
25   /**
26    * Architecture specific version ID.
27    *
28    * This ID must match the version field in the l4_vcpu_state_t structure
29    * after enabling vCPU mode or extended vCPU mode for a thread.
30    */
31   L4_VCPU_STATE_VERSION = 0x23
32 };
33 
34 typedef struct l4_vcpu_arch_state_t
35 {
36   l4_umword_t host_fs_base;
37   l4_umword_t host_gs_base;
38   l4_uint16_t host_ds, host_es, host_fs, host_gs;
39 
40   l4_uint16_t const user_ds32;
41   l4_uint16_t const user_cs64;
42   l4_uint16_t const user_cs32;
43 } l4_vcpu_arch_state_t;
44 
45 
46 /**
47  * \brief vCPU registers.
48  * \ingroup l4_vcpu_api
49  */
50 typedef struct l4_vcpu_regs_t
51 {
52   l4_umword_t r15;     /**< r15 register */
53   l4_umword_t r14;     /**< r14 register */
54   l4_umword_t r13;     /**< r13 register */
55   l4_umword_t r12;     /**< r12 register */
56   l4_umword_t r11;     /**< r11 register */
57   l4_umword_t r10;     /**< r10 register */
58   l4_umword_t r9;      /**< r9 register */
59   l4_umword_t r8;      /**< r8 register */
60 
61   l4_umword_t di;      /**< rdi register */
62   l4_umword_t si;      /**< rsi register */
63   l4_umword_t bp;      /**< rbp register */
64   l4_umword_t pfa;     /**< page fault address */
65   l4_umword_t bx;      /**< rbx register */
66   l4_umword_t dx;      /**< rdx register */
67   l4_umword_t cx;      /**< rcx register */
68   l4_umword_t ax;      /**< rax register */
69 
70   l4_umword_t trapno;  /**< trap number */
71   l4_umword_t err;     /**< error code */
72 
73   l4_umword_t ip;      /**< instruction pointer */
74   l4_umword_t cs;      /**< dummy \internal */
75   l4_umword_t flags;   /**< eflags */
76   l4_umword_t sp;      /**< stack pointer */
77   l4_umword_t ss;
78   l4_umword_t fs_base;
79   l4_umword_t gs_base;
80   l4_uint16_t ds, es, fs, gs;
81 
82 } l4_vcpu_regs_t;
83 
84 /**
85  * \brief vCPU message registers.
86  * \ingroup l4_vcpu_api
87  */
88 typedef struct l4_vcpu_ipc_regs_t
89 {
90   l4_umword_t _res[1];
91   l4_umword_t label;
92   l4_umword_t _res2[5];
93   l4_msgtag_t tag;
94 } l4_vcpu_ipc_regs_t;
95