File tree Expand file tree Collapse file tree 5 files changed +64
-61
lines changed Expand file tree Collapse file tree 5 files changed +64
-61
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ LDSCRIPT := $(GNUEFI_DIR)/elf_$(ARCH)_efi.lds
61
61
INCDIR := $(SYSROOT ) /usr/include
62
62
63
63
CFLAGS =-I. -I.. -I../../../include/arch/x86/guest -I$(INCDIR ) /efi -I$(INCDIR ) /efi/$(ARCH ) \
64
+ -I../../../include/public -I../../../include/lib \
64
65
-DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \
65
66
-Wall -I../fs/ -D$(ARCH ) -O2 \
66
67
-include config.h
Original file line number Diff line number Diff line change 36
36
#include "efilinux.h"
37
37
#include "stdlib.h"
38
38
#include "boot.h"
39
+ #include "acrn_common.h"
39
40
#include "vm0_boot.h"
40
41
41
42
EFI_SYSTEM_TABLE * sys_table ;
Original file line number Diff line number Diff line change 7
7
#ifndef _VGPR_H_
8
8
#define _VGPR_H_
9
9
10
- /* General-purpose register layout aligned with the general-purpose register idx
11
- * when vmexit, such as vmexit due to CR access, refer to SMD Vol.3C 27-6.
12
- */
13
- struct acrn_gp_regs {
14
- uint64_t rax ;
15
- uint64_t rcx ;
16
- uint64_t rdx ;
17
- uint64_t rbx ;
18
- uint64_t rsp ;
19
- uint64_t rbp ;
20
- uint64_t rsi ;
21
- uint64_t rdi ;
22
- uint64_t r8 ;
23
- uint64_t r9 ;
24
- uint64_t r10 ;
25
- uint64_t r11 ;
26
- uint64_t r12 ;
27
- uint64_t r13 ;
28
- uint64_t r14 ;
29
- uint64_t r15 ;
30
- };
31
10
#endif
Original file line number Diff line number Diff line change 45
45
#define BOOT_CTX_EFER_HIGH_OFFSET 204U
46
46
#define SIZE_OF_BOOT_CTX 296U
47
47
48
- /* struct to define how the descriptor stored in memory.
49
- * Refer SDM Vol3 3.5.1 "Segment Descriptor Tables"
50
- * Figure 3-11
51
- */
52
- struct acrn_descriptor_ptr {
53
- uint16_t limit ;
54
- uint64_t base ;
55
- uint16_t reserved [3 ]; /* align struct size to 64bit */
56
- } __attribute__((packed ));
57
-
58
- struct acrn_vcpu_regs {
59
- struct acrn_gp_regs gprs ;
60
- struct acrn_descriptor_ptr gdt ;
61
- struct acrn_descriptor_ptr idt ;
62
-
63
- uint64_t rip ;
64
- uint64_t cs_base ;
65
- uint64_t cr0 ;
66
- uint64_t cr4 ;
67
- uint64_t cr3 ;
68
- uint64_t ia32_efer ;
69
- uint64_t rflags ;
70
- uint64_t reserved_64 [4 ];
71
-
72
- uint32_t cs_ar ;
73
- uint32_t reserved_32 [4 ];
74
-
75
- /* don't change the order of following sel */
76
- uint16_t cs_sel ;
77
- uint16_t ss_sel ;
78
- uint16_t ds_sel ;
79
- uint16_t es_sel ;
80
- uint16_t fs_sel ;
81
- uint16_t gs_sel ;
82
- uint16_t ldt_sel ;
83
- uint16_t tr_sel ;
84
-
85
- uint16_t reserved_16 [4 ];
86
- };
87
-
88
48
#ifdef CONFIG_EFI_STUB
89
49
struct efi_context {
90
50
struct acrn_vcpu_regs vcpu_regs ;
Original file line number Diff line number Diff line change @@ -248,6 +248,68 @@ struct acrn_create_vcpu {
248
248
uint16_t pcpu_id ;
249
249
} __aligned (8 );
250
250
251
+ /* General-purpose register layout aligned with the general-purpose register idx
252
+ * when vmexit, such as vmexit due to CR access, refer to SMD Vol.3C 27-6.
253
+ */
254
+ struct acrn_gp_regs {
255
+ uint64_t rax ;
256
+ uint64_t rcx ;
257
+ uint64_t rdx ;
258
+ uint64_t rbx ;
259
+ uint64_t rsp ;
260
+ uint64_t rbp ;
261
+ uint64_t rsi ;
262
+ uint64_t rdi ;
263
+ uint64_t r8 ;
264
+ uint64_t r9 ;
265
+ uint64_t r10 ;
266
+ uint64_t r11 ;
267
+ uint64_t r12 ;
268
+ uint64_t r13 ;
269
+ uint64_t r14 ;
270
+ uint64_t r15 ;
271
+ };
272
+
273
+ /* struct to define how the descriptor stored in memory.
274
+ * Refer SDM Vol3 3.5.1 "Segment Descriptor Tables"
275
+ * Figure 3-11
276
+ */
277
+ struct acrn_descriptor_ptr {
278
+ uint16_t limit ;
279
+ uint64_t base ;
280
+ uint16_t reserved [3 ]; /* align struct size to 64bit */
281
+ } __attribute__((packed ));
282
+
283
+ struct acrn_vcpu_regs {
284
+ struct acrn_gp_regs gprs ;
285
+ struct acrn_descriptor_ptr gdt ;
286
+ struct acrn_descriptor_ptr idt ;
287
+
288
+ uint64_t rip ;
289
+ uint64_t cs_base ;
290
+ uint64_t cr0 ;
291
+ uint64_t cr4 ;
292
+ uint64_t cr3 ;
293
+ uint64_t ia32_efer ;
294
+ uint64_t rflags ;
295
+ uint64_t reserved_64 [4 ];
296
+
297
+ uint32_t cs_ar ;
298
+ uint32_t reserved_32 [4 ];
299
+
300
+ /* don't change the order of following sel */
301
+ uint16_t cs_sel ;
302
+ uint16_t ss_sel ;
303
+ uint16_t ds_sel ;
304
+ uint16_t es_sel ;
305
+ uint16_t fs_sel ;
306
+ uint16_t gs_sel ;
307
+ uint16_t ldt_sel ;
308
+ uint16_t tr_sel ;
309
+
310
+ uint16_t reserved_16 [4 ];
311
+ };
312
+
251
313
/**
252
314
* @brief Info to set ioreq buffer for a created VM
253
315
*
You can’t perform that action at this time.
0 commit comments