diff --git a/hypervisor/arch/x86/configs/vm_config.c b/hypervisor/arch/x86/configs/vm_config.c index 890999836..ee0f4cf00 100644 --- a/hypervisor/arch/x86/configs/vm_config.c +++ b/hypervisor/arch/x86/configs/vm_config.c @@ -5,6 +5,7 @@ */ #include +#include /* * @pre vm_id < CONFIG_MAX_VM_NUM @@ -23,16 +24,6 @@ uint8_t get_vm_severity(uint16_t vm_id) return vm_configs[vm_id].severity; } -bool uuid_is_equal(const uint8_t *uuid1, const uint8_t *uuid2) -{ - uint64_t uuid1_h = *(const uint64_t *)uuid1; - uint64_t uuid1_l = *(const uint64_t *)(uuid1 + 8); - uint64_t uuid2_h = *(const uint64_t *)uuid2; - uint64_t uuid2_l = *(const uint64_t *)(uuid2 + 8); - - return ((uuid1_h == uuid2_h) && (uuid1_l == uuid2_l)); -} - /** * return true if the input uuid is configured in VM * diff --git a/hypervisor/include/lib/util.h b/hypervisor/include/lib/util.h index d6918d27b..eff71cd3a 100644 --- a/hypervisor/include/lib/util.h +++ b/hypervisor/include/lib/util.h @@ -57,4 +57,17 @@ static inline uint8_t calculate_checksum8(const void *buf, uint32_t len) return (uint8_t)(0x100U - calculate_sum8(buf, len)); } +/** + * @pre (uuid1 != NULL) && (uuid2 != NULL) + */ +static inline bool uuid_is_equal(const uint8_t *uuid1, const uint8_t *uuid2) +{ + uint64_t uuid1_h = *(const uint64_t *)uuid1; + uint64_t uuid1_l = *(const uint64_t *)(uuid1 + 8); + uint64_t uuid2_h = *(const uint64_t *)uuid2; + uint64_t uuid2_l = *(const uint64_t *)(uuid2 + 8); + + return ((uuid1_h == uuid2_h) && (uuid1_l == uuid2_l)); +} + #endif /* UTIL_H */ diff --git a/misc/hv_prebuild/hv_prebuild.h b/misc/hv_prebuild/hv_prebuild.h index acf8efd51..dc93a5920 100644 --- a/misc/hv_prebuild/hv_prebuild.h +++ b/misc/hv_prebuild/hv_prebuild.h @@ -8,6 +8,6 @@ #define size_t new_size_t #include #undef size_t +#include -bool uuid_is_equal(const uint8_t *uuid1, const uint8_t *uuid2); bool sanitize_vm_config(void);