mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-26 23:36:51 +00:00
hv: move save_segment/load_segment to a header file
save_segment/load_segment is common code and can be used outside of trusty, move to a header file. Signed-off-by: Binbin Wu <binbin.wu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
43db87cfed
commit
4acce9338a
@ -35,21 +35,6 @@ static struct trusty_key_info g_key_info = {
|
|||||||
.platform = 3U,
|
.platform = 3U,
|
||||||
.num_seeds = 1U
|
.num_seeds = 1U
|
||||||
};
|
};
|
||||||
#define save_segment(seg, SEG_NAME) \
|
|
||||||
{ \
|
|
||||||
seg.selector = exec_vmread16(SEG_NAME##_SEL); \
|
|
||||||
seg.base = exec_vmread(SEG_NAME##_BASE); \
|
|
||||||
seg.limit = exec_vmread32(SEG_NAME##_LIMIT); \
|
|
||||||
seg.attr = exec_vmread32(SEG_NAME##_ATTR); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define load_segment(seg, SEG_NAME) \
|
|
||||||
{ \
|
|
||||||
exec_vmwrite16(SEG_NAME##_SEL, seg.selector); \
|
|
||||||
exec_vmwrite(SEG_NAME##_BASE, seg.base); \
|
|
||||||
exec_vmwrite32(SEG_NAME##_LIMIT, seg.limit); \
|
|
||||||
exec_vmwrite32(SEG_NAME##_ATTR, seg.attr); \
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup trusty_apis Trusty APIs
|
* @defgroup trusty_apis Trusty APIs
|
||||||
|
@ -46,6 +46,22 @@
|
|||||||
|
|
||||||
#define E820_MAX_ENTRIES 32U
|
#define E820_MAX_ENTRIES 32U
|
||||||
|
|
||||||
|
#define save_segment(seg, SEG_NAME) \
|
||||||
|
{ \
|
||||||
|
seg.selector = exec_vmread16(SEG_NAME##_SEL); \
|
||||||
|
seg.base = exec_vmread(SEG_NAME##_BASE); \
|
||||||
|
seg.limit = exec_vmread32(SEG_NAME##_LIMIT); \
|
||||||
|
seg.attr = exec_vmread32(SEG_NAME##_ATTR); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define load_segment(seg, SEG_NAME) \
|
||||||
|
{ \
|
||||||
|
exec_vmwrite16(SEG_NAME##_SEL, seg.selector); \
|
||||||
|
exec_vmwrite(SEG_NAME##_BASE, seg.base); \
|
||||||
|
exec_vmwrite32(SEG_NAME##_LIMIT, seg.limit); \
|
||||||
|
exec_vmwrite32(SEG_NAME##_ATTR, seg.attr); \
|
||||||
|
}
|
||||||
|
|
||||||
struct e820_mem_params {
|
struct e820_mem_params {
|
||||||
uint64_t mem_bottom;
|
uint64_t mem_bottom;
|
||||||
uint64_t mem_top;
|
uint64_t mem_top;
|
||||||
|
Loading…
Reference in New Issue
Block a user