Skip to content

Commit

Permalink
Fix compile errors due to c3a5816
Browse files Browse the repository at this point in the history
  • Loading branch information
lxylxy123456 committed Oct 19, 2022
1 parent c3a5816 commit a7cc524
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,6 @@ static u32 vmx_eap_initialize(
{
u16 type, length;
// Minimum length required by VT-d spec.
// TODO: remove magic number, should be something like sizeof(VTD_DRHD),
// but unfortunately VTD_DRHD contains other data.
const u16 min_length = 16;
_Static_assert(sizeof(VTD_DRHD) >= min_length);
hva_t remappingstructures_vaddr = (hva_t)remappingstructuresaddrphys;

xmhf_baseplatform_arch_flat_copy((u8 *)&type, (u8 *)(remappingstructures_vaddr + i), sizeof(u16));
Expand All @@ -329,10 +325,13 @@ static u32 vmx_eap_initialize(
switch (type)
{
case 0: // DRHD
// TODO: remove magic number 16. Should be something like
// sizeof(VTD_DRHD), but unfortunately VTD_DRHD contains other data.
_Static_assert(sizeof(VTD_DRHD) >= 16);
printf("DRHD at %lx, len=%u bytes\n", (remappingstructures_vaddr + i), length);
HALT_ON_ERRORCOND(vtd_num_drhd < VTD_MAX_DRHD);
HALT_ON_ERRORCOND(length >= min_length);
xmhf_baseplatform_arch_flat_copy((u8 *)&vtd_drhd[vtd_num_drhd], (u8 *)(remappingstructures_vaddr + i), min_length);
HALT_ON_ERRORCOND(length >= 16);
xmhf_baseplatform_arch_flat_copy((u8 *)&vtd_drhd[vtd_num_drhd], (u8 *)(remappingstructures_vaddr + i), 16);
vtd_num_drhd++;
i += (u32)length;
break;
Expand Down
2 changes: 2 additions & 0 deletions xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,10 @@ void xmhf_runtime_main(VCPU *vcpu, u32 isEarlyInit){
//initialize memory protection for this core
xmhf_memprot_initialize(vcpu);

#if defined (__DMAP__)
//remove DMAP structures from guest memory
xmhf_dmaprot_protect_drhd(vcpu);
#endif // __DMAP__

//initialize application parameter block and call app main
{
Expand Down

0 comments on commit a7cc524

Please sign in to comment.