2018-03-07 20:57:14 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
|
|
*
|
2018-05-26 01:49:13 +08:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2018-03-07 20:57:14 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef IDT_H
|
|
|
|
#define IDT_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* IDT is defined in assembly so we handle exceptions as early as possible.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Interrupt Descriptor Table (LDT) selectors are 16 bytes on x86-64 instead of
|
|
|
|
* 8 bytes.
|
|
|
|
*/
|
2018-12-18 21:59:41 +08:00
|
|
|
#define X64_IDT_DESC_SIZE (0x10U)
|
2018-03-07 20:57:14 +08:00
|
|
|
/* Number of the HOST IDT entries */
|
2018-12-18 21:59:41 +08:00
|
|
|
#define HOST_IDT_ENTRIES (0x100U)
|
2018-03-07 20:57:14 +08:00
|
|
|
/* Size of the IDT */
|
|
|
|
#define HOST_IDT_SIZE (HOST_IDT_ENTRIES * X64_IDT_DESC_SIZE)
|
|
|
|
|
|
|
|
#ifndef ASSEMBLER
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Definition of an 16 byte IDT selector.
|
|
|
|
*/
|
|
|
|
union idt_64_descriptor {
|
|
|
|
uint64_t value;
|
|
|
|
struct {
|
|
|
|
union {
|
|
|
|
uint32_t value;
|
|
|
|
struct {
|
|
|
|
uint32_t offset_15_0:16;
|
|
|
|
uint32_t segment_sel:16;
|
|
|
|
} bits;
|
|
|
|
} low32;
|
|
|
|
union {
|
|
|
|
uint32_t value;
|
|
|
|
struct {
|
|
|
|
uint32_t ist:3;
|
|
|
|
uint32_t bit_3_clr:1;
|
|
|
|
uint32_t bit_4_clr:1;
|
|
|
|
uint32_t bits_5_7_clr:3;
|
|
|
|
uint32_t type:4;
|
|
|
|
uint32_t bit_12_clr:1;
|
|
|
|
uint32_t dpl:2;
|
|
|
|
uint32_t present:1;
|
|
|
|
uint32_t offset_31_16:16;
|
|
|
|
} bits;
|
|
|
|
} high32;
|
|
|
|
uint32_t offset_63_32;
|
|
|
|
uint32_t rsvd;
|
HV: treewide: give names to unnamed structs/unions
According to the syntax defined in C99, each struct/union field must have an
identifier. This patch adds names to the previously unnamed fields for C99
compatibility.
Here is a summary of the names (marked with a pair of *stars*) added.
struct trusty_mem:
union {
struct {
struct key_info key_info;
struct trusty_startup_param startup_param;
} *data*;
uint8_t page[CPU_PAGE_SIZE];
} first_page;
struct ptdev_remapping_info:
union {
struct ptdev_msi_info msi;
struct ptdev_intx_info intx;
} *ptdev_intr_info*;
union code_segment_descriptor:
uint64_t value;
struct {
union {
...
} low32;
union {
...
} high32;
} *fields*;
similar changes are made to the following structures.
* union data_segment_descriptor,
* union system_segment_descriptor,
* union tss_64_descriptor, and
* union idt_64_descriptor
struct trace_entry:
union {
struct {
uint32_t a, b, c, d;
} *fields_32*;
struct {
uint8_t a1, a2, a3, a4;
uint8_t b1, b2, b3, b4;
uint8_t c1, c2, c3, c4;
uint8_t d1, d2, d3, d4;
} *fields_8*;
struct {
uint64_t e;
uint64_t f;
} *fields_64*;
char str[16];
} *payload*;
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-28 23:22:49 +08:00
|
|
|
} fields;
|
2018-03-07 20:57:14 +08:00
|
|
|
} __aligned(8);
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* Definition of the IDT.
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
struct host_idt {
|
|
|
|
union idt_64_descriptor host_idt_descriptors[HOST_IDT_ENTRIES];
|
|
|
|
} __aligned(8);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Definition of the IDT descriptor.
|
|
|
|
*/
|
|
|
|
struct host_idt_descriptor {
|
2018-06-29 14:29:34 +08:00
|
|
|
uint16_t len;
|
2018-03-07 20:57:14 +08:00
|
|
|
struct host_idt *idt;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
extern struct host_idt HOST_IDT;
|
|
|
|
extern struct host_idt_descriptor HOST_IDTR;
|
|
|
|
|
|
|
|
#endif /* end #ifndef ASSEMBLER */
|
|
|
|
|
|
|
|
#endif /* IDT_H */
|