From 473d87139708fcad842b645f68b228d4c2b0e5a9 Mon Sep 17 00:00:00 2001 From: "Li, Fei1" Date: Sat, 8 Dec 2018 00:06:59 +0800 Subject: [PATCH] hv: use uint32_t replace "unsigned int" Since it's typedef in "include/lib/types.h" Tracked-On: #861 Signed-off-by: Li, Fei1 --- hypervisor/bsp/uefi/efi/boot.c | 2 +- hypervisor/debug/logmsg.c | 2 +- hypervisor/debug/profiling.c | 2 +- hypervisor/include/lib/atomic.h | 2 +- hypervisor/include/lib/mem_mgt.h | 4 ++-- hypervisor/lib/crypto/mbedtls/ChangeLog | 4 ++-- hypervisor/lib/crypto/mbedtls/sha256.c | 2 +- hypervisor/lib/memory.c | 8 ++++---- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hypervisor/bsp/uefi/efi/boot.c b/hypervisor/bsp/uefi/efi/boot.c index a21ed30f7..a37cb98c9 100644 --- a/hypervisor/bsp/uefi/efi/boot.c +++ b/hypervisor/bsp/uefi/efi/boot.c @@ -124,7 +124,7 @@ again: */ for (i = 0, j = 0; i < map_size / desc_size; i++) { EFI_MEMORY_DESCRIPTOR *d; - unsigned int e820_type = 0; + uint32_t e820_type = 0; d = (EFI_MEMORY_DESCRIPTOR *)((unsigned long)map_buf + (i * desc_size)); switch(d->Type) { diff --git a/hypervisor/debug/logmsg.c b/hypervisor/debug/logmsg.c index 14a055a80..dcfedd64f 100644 --- a/hypervisor/debug/logmsg.c +++ b/hypervisor/debug/logmsg.c @@ -82,7 +82,7 @@ void do_logmsg(uint32_t severity, const char *fmt, ...) /* Check if flags specify to output to memory */ if (do_mem_log) { - unsigned int i, msg_len; + uint32_t i, msg_len; struct shared_buf *sbuf = (struct shared_buf *)per_cpu(sbuf, pcpu_id)[ACRN_HVLOG]; /* If sbuf is not ready, we just drop the massage */ diff --git a/hypervisor/debug/profiling.c b/hypervisor/debug/profiling.c index bf1e50d26..d81cab635 100644 --- a/hypervisor/debug/profiling.c +++ b/hypervisor/debug/profiling.c @@ -560,7 +560,7 @@ static void profiling_handle_msrops(void) /* * Interrupt handler for performance monitoring interrupts */ -static void profiling_pmi_handler(unsigned int irq, __unused void *data) +static void profiling_pmi_handler(uint32_t irq, __unused void *data) { uint64_t perf_ovf_status; uint32_t lvt_perf_ctr; diff --git a/hypervisor/include/lib/atomic.h b/hypervisor/include/lib/atomic.h index c31416f3f..9f6aea521 100644 --- a/hypervisor/include/lib/atomic.h +++ b/hypervisor/include/lib/atomic.h @@ -80,7 +80,7 @@ build_atomic_dec(atomic_dec32, "l", uint32_t) build_atomic_dec(atomic_dec64, "q", uint64_t) /** - * #define atomic_set32(P, V) (*(unsigned int *)(P) |= (V)) + * #define atomic_set32(P, V) (*(uint32_t *)(P) |= (V)) * * Parameters: * uint32_t* p A pointer to memory area that stores source diff --git a/hypervisor/include/lib/mem_mgt.h b/hypervisor/include/lib/mem_mgt.h index 9c93c43cc..06af61ab0 100644 --- a/hypervisor/include/lib/mem_mgt.h +++ b/hypervisor/include/lib/mem_mgt.h @@ -22,8 +22,8 @@ struct mem_pool { }; /* APIs exposing memory allocation/deallocation abstractions */ -void *malloc(unsigned int num_bytes); -void *calloc(unsigned int num_elements, unsigned int element_size); +void *malloc(uint32_t num_bytes); +void *calloc(uint32_t num_elements, uint32_t element_size); void free(const void *ptr); #endif /* MEM_MGT_H */ diff --git a/hypervisor/lib/crypto/mbedtls/ChangeLog b/hypervisor/lib/crypto/mbedtls/ChangeLog index 9e46c9722..4518efa60 100644 --- a/hypervisor/lib/crypto/mbedtls/ChangeLog +++ b/hypervisor/lib/crypto/mbedtls/ChangeLog @@ -738,7 +738,7 @@ Bugfix Security * Add checks to prevent signature forgeries for very large messages while using RSA through the PK module in 64-bit systems. The issue was caused by - some data loss when casting a size_t to an unsigned int value in the + some data loss when casting a size_t to an uint32_t value in the functions rsa_verify_wrap(), rsa_sign_wrap(), rsa_alt_sign_wrap() and mbedtls_pk_sign(). Found by Jean-Philippe Aumasson. * Fixed potential livelock during the parsing of a CRL in PEM format in @@ -1266,7 +1266,7 @@ Semi-API changes (technically public, morally private) * Changed pk_info_t into an opaque structure. * Changed cipher_base_t into an opaque structure. * Removed sig_oid2 and rename sig_oid1 to sig_oid in x509_crt and x509_crl. - * x509_crt.key_usage changed from uint8_t to unsigned int. + * x509_crt.key_usage changed from uint8_t to uint32_t. * Removed r and s from ecdsa_context * Removed mode from des_context and des3_context diff --git a/hypervisor/lib/crypto/mbedtls/sha256.c b/hypervisor/lib/crypto/mbedtls/sha256.c index f8bf4657a..af6ca21ea 100644 --- a/hypervisor/lib/crypto/mbedtls/sha256.c +++ b/hypervisor/lib/crypto/mbedtls/sha256.c @@ -158,7 +158,7 @@ int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx, { uint32_t temp1, temp2, W[64]; uint32_t A[8]; - unsigned int i; + uint32_t i; for( i = 0; i < 8; i++ ) A[i] = ctx->state[i]; diff --git a/hypervisor/lib/memory.c b/hypervisor/lib/memory.c index ce6cac569..9197f4e8a 100644 --- a/hypervisor/lib/memory.c +++ b/hypervisor/lib/memory.c @@ -31,7 +31,7 @@ static struct mem_pool Memory_Pool = { .contiguity_bitmap = Malloc_Heap_Contiguity_Bitmap }; -static void *allocate_mem(struct mem_pool *pool, unsigned int num_bytes) +static void *allocate_mem(struct mem_pool *pool, uint32_t num_bytes) { void *memory = NULL; @@ -213,7 +213,7 @@ static void deallocate_mem(struct mem_pool *pool, const void *ptr) * The return address will be PAGE_SIZE aligned if 'num_bytes' is greater * than PAGE_SIZE. */ -void *malloc(unsigned int num_bytes) +void *malloc(uint32_t num_bytes) { void *memory = NULL; @@ -234,7 +234,7 @@ void *malloc(unsigned int num_bytes) return memory; } -void *calloc(unsigned int num_elements, unsigned int element_size) +void *calloc(uint32_t num_elements, uint32_t element_size) { void *memory = malloc(num_elements * element_size); @@ -391,7 +391,7 @@ void *memset(void *base, uint8_t v, size_t n) asm volatile("cld ; rep ; stosq ; movl %3,%%ecx ; rep ; stosb" : "+c"(n_q), "+D"(dest_p) : "a" (v * 0x0101010101010101U), - "r"((unsigned int)count & 7U)); + "r"((uint32_t)count & 7U)); ret = (void *)dest_p; }