diff --git a/hypervisor/arch/x86/trusty.c b/hypervisor/arch/x86/trusty.c index af7ea7112..9ed5c5f2e 100644 --- a/hypervisor/arch/x86/trusty.c +++ b/hypervisor/arch/x86/trusty.c @@ -35,21 +35,6 @@ static struct trusty_key_info g_key_info = { .platform = 3U, .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 diff --git a/hypervisor/include/arch/x86/guest/guest.h b/hypervisor/include/arch/x86/guest/guest.h index 583ac302c..c0dc96649 100644 --- a/hypervisor/include/arch/x86/guest/guest.h +++ b/hypervisor/include/arch/x86/guest/guest.h @@ -46,6 +46,22 @@ #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 { uint64_t mem_bottom; uint64_t mem_top;