diff --git a/src/arch/armv8/armv8-r/mpu.c b/src/arch/armv8/armv8-r/mpu.c index 8acf13fe..cd715a2e 100644 --- a/src/arch/armv8/armv8-r/mpu.c +++ b/src/arch/armv8/armv8-r/mpu.c @@ -116,7 +116,7 @@ static inline void mpu_entry_set_perms(struct mp_region* mpr, struct mpu_perms m bool el1_priv = mpu_perms.el1 != PERM_NONE; perms_t perms = mpu_perms.el1 | mpu_perms.el2; - mpr->mem_flags.prbar &= (uint16_t) ~(PRBAR_PERMS_FLAGS_MSK); + mpr->mem_flags.prbar &= (uint16_t)~(PRBAR_PERMS_FLAGS_MSK); if (perms & PERM_W) { mpr->mem_flags.prbar |= PRBAR_AP_RW_EL2; } else { diff --git a/src/core/inc/config.h b/src/core/inc/config.h index 7154e7e2..7cdefc48 100644 --- a/src/core/inc/config.h +++ b/src/core/inc/config.h @@ -30,23 +30,27 @@ // clang-format on #define VM_IMAGE_OFFSET(img_name) ((paddr_t) & _##img_name##_vm_beg) -#define VM_IMAGE_SIZE(img_name) ((size_t) & _##img_name##_vm_size) +#define VM_IMAGE_SIZE(img_name) ((size_t)&_##img_name##_vm_size) #else #define VM_IMAGE(img_name, img_path) #define VM_IMAGE_OFFSET(img_name) ((paddr_t)0) #define VM_IMAGE_SIZE(img_name) ((size_t)0) #endif -#define VM_IMAGE_BUILTIN(img_name, image_base_addr) \ - { \ - .base_addr = image_base_addr, .load_addr = VM_IMAGE_OFFSET(img_name), \ - .size = VM_IMAGE_SIZE(img_name), .separately_loaded = false, \ +#define VM_IMAGE_BUILTIN(img_name, image_base_addr) \ + { \ + .base_addr = image_base_addr, \ + .load_addr = VM_IMAGE_OFFSET(img_name), \ + .size = VM_IMAGE_SIZE(img_name), \ + .separately_loaded = false, \ } -#define VM_IMAGE_LOADED(image_base_addr, image_load_addr, image_size) \ - { \ - .base_addr = image_base_addr, .load_addr = image_load_addr, .size = image_size, \ - .separately_loaded = true, \ +#define VM_IMAGE_LOADED(image_base_addr, image_load_addr, image_size) \ + { \ + .base_addr = image_base_addr, \ + .load_addr = image_load_addr, \ + .size = image_size, \ + .separately_loaded = true, \ } /* CONFIG_HEADER is just defined for compatibility with older configs */ diff --git a/src/core/inc/cpu.h b/src/core/inc/cpu.h index d14fac38..70c91533 100644 --- a/src/core/inc/cpu.h +++ b/src/core/inc/cpu.h @@ -48,9 +48,9 @@ void cpu_send_msg(cpuid_t cpu, struct cpu_msg* msg); typedef void (*cpu_msg_handler_t)(uint32_t event, uint64_t data); -#define CPU_MSG_HANDLER(handler, handler_id) \ - __attribute__((section(".ipi_cpumsg_handlers"), used)) \ - cpu_msg_handler_t __cpumsg_handler_##handler = handler; \ +#define CPU_MSG_HANDLER(handler, handler_id) \ + __attribute__((section(".ipi_cpumsg_handlers"), \ + used)) cpu_msg_handler_t __cpumsg_handler_##handler = handler; \ __attribute__((section(".ipi_cpumsg_handlers_id"), used)) volatile const size_t handler_id; struct cpu_synctoken { diff --git a/src/core/inc/types.h b/src/core/inc/types.h index 3b7ca4fe..0bd35ef8 100644 --- a/src/core/inc/types.h +++ b/src/core/inc/types.h @@ -25,23 +25,23 @@ typedef signed long ssize_t; typedef unsigned long asid_t; typedef unsigned long vmid_t; -#define INVALID_VMID ((vmid_t)-1) +#define INVALID_VMID ((vmid_t) - 1) typedef uintptr_t paddr_t; typedef uintptr_t regaddr_t; typedef uintptr_t vaddr_t; -#define MAX_VA ((vaddr_t)-1) +#define MAX_VA ((vaddr_t) - 1) #define INVALID_VA MAX_VA typedef size_t mpid_t; -#define INVALID_MPID ((mpid_t)-1) +#define INVALID_MPID ((mpid_t) - 1) typedef unsigned long colormap_t; typedef unsigned long cpuid_t; typedef unsigned long vcpuid_t; typedef unsigned long cpumap_t; -#define INVALID_CPUID ((cpuid_t)-1) +#define INVALID_CPUID ((cpuid_t) - 1) typedef unsigned irqid_t; diff --git a/src/lib/inc/bit.h b/src/lib/inc/bit.h index 168b6061..8512fdad 100644 --- a/src/lib/inc/bit.h +++ b/src/lib/inc/bit.h @@ -14,9 +14,9 @@ * word length masks with the cost of an extra shift instruction. For static masks, there should be * no extra costs. */ -#define BIT32_MASK(OFF, LEN) ((((UINT32_C(1) << ((LEN)-1)) << 1) - 1) << (OFF)) -#define BIT64_MASK(OFF, LEN) ((((UINT64_C(1) << ((LEN)-1)) << 1) - 1) << (OFF)) -#define BIT_MASK(OFF, LEN) (((((1UL) << ((LEN)-1)) << 1) - 1) << (OFF)) +#define BIT32_MASK(OFF, LEN) ((((UINT32_C(1) << ((LEN) - 1)) << 1) - 1) << (OFF)) +#define BIT64_MASK(OFF, LEN) ((((UINT64_C(1) << ((LEN) - 1)) << 1) - 1) << (OFF)) +#define BIT_MASK(OFF, LEN) (((((1UL) << ((LEN) - 1)) << 1) - 1) << (OFF)) #ifndef __ASSEMBLER__ @@ -52,7 +52,7 @@ mask <<= 1U; \ pos++; \ } \ - return (mask != 0U) ? pos : (ssize_t)-1; \ + return (mask != 0U) ? pos : (ssize_t) - 1; \ } \ static inline size_t PRE##_count(TYPE word) \ { \ diff --git a/src/lib/inc/util.h b/src/lib/inc/util.h index dd9066d3..2cbc6de6 100644 --- a/src/lib/inc/util.h +++ b/src/lib/inc/util.h @@ -9,20 +9,20 @@ /* UTILITY MACROS */ /* align VAL to TO which must be power a two */ -#define ALIGN(VAL, TO) ((((VAL) + (TO)-1) / (TO)) * TO) +#define ALIGN(VAL, TO) ((((VAL) + (TO) - 1) / (TO)) * TO) #define IS_ALIGNED(VAL, TO) (!((VAL) % (TO))) -#define ALIGN_FLOOR(VAL, TO) ((VAL) & ~((TO)-1)) +#define ALIGN_FLOOR(VAL, TO) ((VAL) & ~((TO) - 1)) #define NUM_PAGES(SZ) (ALIGN(SZ, PAGE_SIZE) / PAGE_SIZE) -#define PAGE_OFFSET_MASK ((PAGE_SIZE)-1) +#define PAGE_OFFSET_MASK ((PAGE_SIZE) - 1) #define PAGE_FRAME_MASK (~(PAGE_OFFSET_MASK)) #define SR_OR(VAL, SHIFT) (((VAL) >> (SHIFT)) | VAL) /* Next Power Of Two */ -#define NPOT(VAL) \ - ((SR_OR(((VAL)-1), 1) | SR_OR(SR_OR(((VAL)-1), 1), 2) | \ - SR_OR(SR_OR(SR_OR(((VAL)-1), 1), 2), 4) | \ - SR_OR(SR_OR(SR_OR(SR_OR(((VAL)-1), 1), 2), 4), 8) | \ - SR_OR(SR_OR(SR_OR(SR_OR(SR_OR(((VAL)-1), 1), 2), 4), 8), 16)) + \ +#define NPOT(VAL) \ + ((SR_OR(((VAL) - 1), 1) | SR_OR(SR_OR(((VAL) - 1), 1), 2) | \ + SR_OR(SR_OR(SR_OR(((VAL) - 1), 1), 2), 4) | \ + SR_OR(SR_OR(SR_OR(SR_OR(((VAL) - 1), 1), 2), 4), 8) | \ + SR_OR(SR_OR(SR_OR(SR_OR(SR_OR(((VAL) - 1), 1), 2), 4), 8), 16)) + \ 1) /* Previous Power Of Two */