mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 05:57:33 +00:00
hv: move boot_ctx offset definitions
Move the definitions of offset of fields in boot_ctx to the same header file that the struct boot_ctx is in, to reduce the possibility that some modification would make the offset inconsistant with the fields within the structure. Signed-off-by: Binbin Wu <binbin.wu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
197706ff16
commit
69522dc861
@ -4,22 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#define BOOT_CTX_CR0_OFFSET 0
|
||||
#define BOOT_CTX_CR3_OFFSET 8
|
||||
#define BOOT_CTX_CR4_OFFSET 16
|
||||
#define BOOT_CTX_IDT_OFFSET 24
|
||||
#define BOOT_CTX_GDT_OFFSET 34
|
||||
#define BOOT_CTX_LDT_SEL_OFFSET 44
|
||||
#define BOOT_CTX_TR_SEL_OFFSET 46
|
||||
#define BOOT_CTX_CS_SEL_OFFSET 48
|
||||
#define BOOT_CTX_SS_SEL_OFFSET 50
|
||||
#define BOOT_CTX_DS_SEL_OFFSET 52
|
||||
#define BOOT_CTX_ES_SEL_OFFSET 54
|
||||
#define BOOT_CTX_FS_SEL_OFFSET 56
|
||||
#define BOOT_CTX_GS_SEL_OFFSET 58
|
||||
#define BOOT_CTX_CS_AR_OFFSET 60
|
||||
#define BOOT_CTX_EFER_LOW_OFFSET 64
|
||||
#define BOOT_CTX_EFER_HIGH_OFFSET 68
|
||||
#include <vm0_boot.h>
|
||||
|
||||
.section entry, "ax"
|
||||
.align 8
|
||||
|
@ -7,20 +7,54 @@
|
||||
#ifndef VM0_BOOT_H
|
||||
#define VM0_BOOT_H
|
||||
|
||||
#ifdef ASSEMBLER
|
||||
#define BOOT_CTX_CR0_OFFSET 0
|
||||
#define BOOT_CTX_CR3_OFFSET 8
|
||||
#define BOOT_CTX_CR4_OFFSET 16
|
||||
#define BOOT_CTX_IDT_OFFSET 24
|
||||
#define BOOT_CTX_GDT_OFFSET 34
|
||||
#define BOOT_CTX_LDT_SEL_OFFSET 44
|
||||
#define BOOT_CTX_TR_SEL_OFFSET 46
|
||||
#define BOOT_CTX_CS_SEL_OFFSET 48
|
||||
#define BOOT_CTX_SS_SEL_OFFSET 50
|
||||
#define BOOT_CTX_DS_SEL_OFFSET 52
|
||||
#define BOOT_CTX_ES_SEL_OFFSET 54
|
||||
#define BOOT_CTX_FS_SEL_OFFSET 56
|
||||
#define BOOT_CTX_GS_SEL_OFFSET 58
|
||||
#define BOOT_CTX_CS_AR_OFFSET 60
|
||||
#define BOOT_CTX_EFER_LOW_OFFSET 64
|
||||
#define BOOT_CTX_EFER_HIGH_OFFSET 68
|
||||
#else
|
||||
#include <gpr.h>
|
||||
#define BOOT_CTX_CR0_OFFSET 0U
|
||||
#define BOOT_CTX_CR3_OFFSET 8U
|
||||
#define BOOT_CTX_CR4_OFFSET 16U
|
||||
#define BOOT_CTX_IDT_OFFSET 24U
|
||||
#define BOOT_CTX_GDT_OFFSET 34U
|
||||
#define BOOT_CTX_LDT_SEL_OFFSET 44U
|
||||
#define BOOT_CTX_TR_SEL_OFFSET 46U
|
||||
#define BOOT_CTX_CS_SEL_OFFSET 48U
|
||||
#define BOOT_CTX_SS_SEL_OFFSET 50U
|
||||
#define BOOT_CTX_DS_SEL_OFFSET 52U
|
||||
#define BOOT_CTX_ES_SEL_OFFSET 54U
|
||||
#define BOOT_CTX_FS_SEL_OFFSET 56U
|
||||
#define BOOT_CTX_GS_SEL_OFFSET 58U
|
||||
#define BOOT_CTX_CS_AR_OFFSET 60U
|
||||
#define BOOT_CTX_EFER_LOW_OFFSET 64U
|
||||
#define BOOT_CTX_EFER_HIGH_OFFSET 68U
|
||||
|
||||
typedef struct {
|
||||
struct dt_addr {
|
||||
uint16_t limit;
|
||||
uint64_t base;
|
||||
} __attribute__((packed)) dt_addr_t;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct boot_ctx {
|
||||
uint64_t cr0;
|
||||
uint64_t cr3;
|
||||
uint64_t cr4;
|
||||
|
||||
dt_addr_t idt;
|
||||
dt_addr_t gdt;
|
||||
struct dt_addr idt;
|
||||
struct dt_addr gdt;
|
||||
uint16_t ldt_sel;
|
||||
uint16_t tr_sel;
|
||||
|
||||
@ -47,5 +81,5 @@ struct boot_ctx {
|
||||
void *get_rsdp_from_uefi(void);
|
||||
void *get_ap_trampoline_buf(void);
|
||||
#endif
|
||||
|
||||
#endif /* ASSEMBLER */
|
||||
#endif /* VM0_BOOT_H */
|
||||
|
Loading…
Reference in New Issue
Block a user