Skip to content

Commit

Permalink
style: format files using clang-format-19
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Rodríguez <[email protected]>
  • Loading branch information
malejo97 committed May 25, 2024
1 parent 2bee43b commit d61d7be
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/arch/armv8/armv8-r/mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
22 changes: 13 additions & 9 deletions src/core/inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions src/core/inc/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions src/core/inc/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions src/lib/inc/bit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__

Expand Down Expand Up @@ -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) \
{ \
Expand Down
16 changes: 8 additions & 8 deletions src/lib/inc/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit d61d7be

Please sign in to comment.